本文整理汇总了Python中PyQt5.QtWidgets.QTextBrowser.setText方法的典型用法代码示例。如果您正苦于以下问题:Python QTextBrowser.setText方法的具体用法?Python QTextBrowser.setText怎么用?Python QTextBrowser.setText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets.QTextBrowser
的用法示例。
在下文中一共展示了QTextBrowser.setText方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SourceViewer
# 需要导入模块: from PyQt5.QtWidgets import QTextBrowser [as 别名]
# 或者: from PyQt5.QtWidgets.QTextBrowser import setText [as 别名]
class SourceViewer(QDialog):
def __init__(self, browser):
super(SourceViewer, self).__init__(browser.parentWidget())
layout = QVBoxLayout()
layout.setContentsMargins(4, 4, 4, 4)
self.setLayout(layout)
self.urlLabel = QLabel(wordWrap=True)
layout.addWidget(self.urlLabel)
self.textbrowser = QTextBrowser()
layout.addWidget(self.textbrowser)
self.urlLabel.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
self.textbrowser.setLineWrapMode(QTextBrowser.NoWrap)
app.settingsChanged.connect(self.readSettings)
self.readSettings()
app.translateUI(self)
qutil.saveDialogSize(self, "helpbrowser/sourceviewer/size", QSize(400, 300))
def translateUI(self):
self.setWindowTitle(app.caption(_("LilyPond Source")))
def readSettings(self):
data = textformats.formatData('editor')
self.textbrowser.setPalette(data.palette())
self.textbrowser.setFont(data.font)
highlighter.highlight(self.textbrowser.document())
def showReply(self, reply):
reply.setParent(self)
self.urlLabel.setText(reply.url().toString())
self._reply = reply
reply.finished.connect(self.loadingFinished)
self.textbrowser.clear()
self.show()
def loadingFinished(self):
data = self._reply.readAll()
self._reply.close()
self._reply.deleteLater()
del self._reply
self.textbrowser.clear()
self.textbrowser.setText(str(data, 'utf-8', 'replace'))
highlighter.highlight(self.textbrowser.document())
示例2: __init__
# 需要导入模块: from PyQt5.QtWidgets import QTextBrowser [as 别名]
# 或者: from PyQt5.QtWidgets.QTextBrowser import setText [as 别名]
def __init__(self, exctype, excvalue, exctb):
super(ExceptionDialog, self).__init__()
self._tbshort = ''.join(traceback.format_exception_only(exctype, excvalue))
self._tbfull = ''.join(traceback.format_exception(exctype, excvalue, exctb))
layout = QVBoxLayout()
self.setLayout(layout)
self.errorLabel = QLabel()
layout.addWidget(self.errorLabel)
textview = QTextBrowser()
layout.addWidget(textview)
textview.setText(self._tbfull)
textview.moveCursor(QTextCursor.End)
layout.addWidget(widgets.Separator())
b = self.buttons = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
b.button(QDialogButtonBox.Ok).setIcon(icons.get("tools-report-bug"))
layout.addWidget(b)
b.accepted.connect(self.accept)
b.rejected.connect(self.reject)
self.resize(600,300)
app.translateUI(self)
self.exec_()
示例3: TextWindow
# 需要导入模块: from PyQt5.QtWidgets import QTextBrowser [as 别名]
# 或者: from PyQt5.QtWidgets.QTextBrowser import setText [as 别名]
class TextWindow(QDialog):
def __init__(self):
super().__init__()
self.txt = QTextBrowser(self)
self.layout = QGridLayout()
self.layout.addWidget(self.txt)
self.setLayout(self.layout)
self.setAttribute(Qt.WA_DeleteOnClose)
def setText(self, text):
self.txt.setText(text)
self.txt.adjustSize()
self.adjustSize()
示例4: Example1
# 需要导入模块: from PyQt5.QtWidgets import QTextBrowser [as 别名]
# 或者: from PyQt5.QtWidgets.QTextBrowser import setText [as 别名]
class Example1(QWidget):
def __init__(self):
super().__init__()
self.initUI()
self.s=[]
def initUI(self):
QToolTip.setFont(QFont('SansSerif', 40))
self.setGeometry(300,250,360,400)
self.setWindowTitle('Instructions')
self.toshow = QTextBrowser(self)
self.toshow.resize(270,300)
self.toshow.move(30,20)
self.toshow.setText('good')
# self.toshow.setText('\n'.join(self.s))
self.show()
def showIns(self):
self.toshow.setText('\n'.join(self.s))
示例5: Article
# 需要导入模块: from PyQt5.QtWidgets import QTextBrowser [as 别名]
# 或者: from PyQt5.QtWidgets.QTextBrowser import setText [as 别名]
#.........这里部分代码省略.........
self.manualClassLabels.append(manualClass)
self.calculatedClassLabels.append(calculatedClass)
layout.addWidget(entityLabel, i+1, 0, 1, 2)
layout.addWidget(calculatedClass, i+1, 2, 1, 1)
layout.addWidget(manualClass, i+1, 3, 1, 1)
# buttons row
classifyButton = QPushButton("Classify")
classifyButton.setFocusPolicy(Qt.NoFocus)
classifyButton.clicked.connect(self.classifyEntitiesInArticle)
clearButton = QPushButton("Clear")
clearButton.clicked.connect(self.clearClassification)
clearButton.setFocusPolicy(Qt.NoFocus)
saveButton = QPushButton("Save")
saveButton.clicked.connect(self.saveClassification)
saveButton.setFocusPolicy(Qt.NoFocus)
layout.addWidget(classifyButton, len(self.entities) + 1, 1, 1, 1)
layout.addWidget(clearButton, len(self.entities) + 1, 2, 1, 1)
layout.addWidget(saveButton, len(self.entities) + 1, 3, 1, 1)
layout.setColumnStretch(0, 1)
layout.setColumnStretch(1, 1)
layout.setColumnStretch(2, 1)
layout.setColumnStretch(3, 1)
return layout
def draw(self):
self.titleLabel.setText(self.articleTitle)
self.authorLabel.setText(self.articleAuthor)
self.dateLabel.setText(str(self.articleDate))
self.contentBrowser.setText(self.articleContent)
self.updateEntityBox()
def center(self):
qr = self.frameGeometry()
cp = QDesktopWidget().availableGeometry().center()
qr.moveCenter(cp)
self.move(qr.topLeft())
def previousArticle(self):
if self.listIndexArticle > 0:
self.listIndexArticle -= 1
self.articleId = self.articleList[self.listIndexArticle]
self.selectArticle(self.articleList[self.listIndexArticle])
self.setWindowTitle("Article id: " + str(self.articleId))
self.draw()
def nextArticle(self):
if self.listIndexArticle < len(self.articleList) - 1:
self.listIndexArticle += 1
self.articleId = self.articleList[self.listIndexArticle]
self.selectArticle(self.articleList[self.listIndexArticle])
self.setWindowTitle("Article id: " + str(self.articleId))
self.draw()
def saveClassification(self):
cursor = mysql_conn.cursor()
for i in xrange(len(self.manualClassLabels)):
示例6: PrecomputedVolumeBrowser
# 需要导入模块: from PyQt5.QtWidgets import QTextBrowser [as 别名]
# 或者: from PyQt5.QtWidgets.QTextBrowser import setText [as 别名]
class PrecomputedVolumeBrowser(QDialog):
def __init__(self, history=None, parent=None):
super().__init__(parent)
self._history = history or []
self.selected_url = None
self.setup_ui()
def setup_ui(self):
self.setMinimumSize(800, 200)
self.setWindowTitle('Precomputed Volume Selection Dialog')
main_layout = QVBoxLayout()
description = QLabel(self)
description.setText(
'enter base URL of volume starting with "precomputed://http..."'
'hit the "check URL" button to validate the entered address.')
main_layout.addWidget(description)
self.combo = QComboBox(self)
self.combo.setEditable(True)
self.combo.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Minimum)
self.combo.addItem("")
for item in self._history:
self.combo.addItem(item)
combo_label = QLabel(parent=self)
combo_label.setText("Enter volume address: ")
combo_layout = QHBoxLayout()
chk_button = QPushButton(self)
chk_button.setText('Check URL')
chk_button.clicked.connect(self.handle_chk_button_clicked)
combo_layout.addWidget(combo_label)
combo_layout.addWidget(self.combo)
combo_layout.addWidget(chk_button)
main_layout.addLayout(combo_layout)
# add some debug stuff
debug_label = QLabel(self)
debug_label.setText('debug: ')
self.debug_text = QTextBrowser(self)
debug_layout = QVBoxLayout()
debug_layout.addWidget(debug_label)
debug_layout.addWidget(self.debug_text)
main_layout.addLayout(debug_layout)
self.qbuttons = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
self.qbuttons.accepted.connect(self.accept)
self.qbuttons.rejected.connect(self.reject)
self.qbuttons.button(QDialogButtonBox.Ok).setEnabled(False)
main_layout.addWidget(self.qbuttons)
self.setLayout(main_layout)
def handle_chk_button_clicked(self, event):
self.selected_url = self.combo.currentText()
logger.debug(f"selected url: {self.selected_url}")
url = self.selected_url.lstrip('precomputed://')
try:
rv = RESTfulPrecomputedChunkedVolume(volume_url=url)
except Exception as e:
# :<
self.qbuttons.button(QDialogButtonBox.Ok).setEnabled(False)
self.debug_text.setText("")
qm = QMessageBox(self)
qm.setWindowTitle('An Error Occured!')
qm.setText(f"woops: {e}")
qm.show()
return
self.debug_text.setText(
f"volume encoding: {rv.get_encoding()}\n"
f"available scales: {rv.available_scales}\n"
f"using scale: {rv._use_scale}\n"
f"data shape: {rv.get_shape()}\n"
)
self.qbuttons.button(QDialogButtonBox.Ok).setEnabled(True)
示例7: DolphinUpdate
# 需要导入模块: from PyQt5.QtWidgets import QTextBrowser [as 别名]
# 或者: from PyQt5.QtWidgets.QTextBrowser import setText [as 别名]
#.........这里部分代码省略.........
settings_frame = QFrame()
settings_form = QFormLayout(settings_frame)
self.auto_launch_check = QCheckBox(settings_frame)
self.auto_launch_check.setChecked(self._udc.get_auto_launch())
settings_form.addRow("Auto Launch?", self.auto_launch_check)
self.launch_qt_check = QCheckBox(settings_frame)
self.launch_qt_check.setChecked(self._udc.get_qt())
settings_form.addRow("Launch QT Version?", self.launch_qt_check)
settings_form.setContentsMargins(0, 1, 2, 0)
self.statusBar().addPermanentWidget(settings_frame)
def launch_dolphin(self):
dolphin_dir = self.dolphin_dir.text()
if not dolphin_dir:
self.show_warning('Please select a dolphin folder.')
return
if (self.launch_qt_check.isChecked() == False):
dolphinexe = 'Dolphin.exe'
else:
dolphinexe = 'DolphinQt2.exe'
dolphin_path = os.path.join(dolphin_dir, dolphinexe)
if not os.path.isfile(dolphin_path):
self.show_warning('Could not find "' + dolphinexe + '".')
return
subprocess.Popen(dolphin_path, cwd=dolphin_dir)
self.close()
def update_version(self, message):
if message == 'finished':
self.version.setText(self.version.placeholderText())
self.version.setPlaceholderText("Installation Status Unknown")
self.version_status.setPixmap(self.check)
self._udc.set_user_version(self.version.text())
if self.auto_launch_check.isChecked() and QApplication.keyboardModifiers() != Qt.ShiftModifier:
QTimer.singleShot(1000, self.launch_dolphin)
else:
self.version.setPlaceholderText(message)
def download_new(self):
dolphin_dir = self.dolphin_dir.text()
version = self.version.text()
if self.current.text() == version:
self.show_warning('You already have the most recent version.')
return
elif not os.path.isdir(dolphin_dir):
self.show_warning('Your dolphin folder path is invalid.')
self.dolphin_dir_status.setPixmap(QPixmap("res/cancel.png"))
return
if not self.download_thread.isRunning():
if dir == 'Please Select a Dolphin Directory':
self.show_warning('Please select a dolphin folder.')
self.version.setText('')
self.download_thread.update(dolphin_dir, version)
self.download_thread.start()
def update_changelog(self, message):
self.changelog.setText(message)
def show_warning(self, message):
示例8: OWCSVFileImport
# 需要导入模块: from PyQt5.QtWidgets import QTextBrowser [as 别名]
# 或者: from PyQt5.QtWidgets.QTextBrowser import setText [as 别名]
class OWCSVFileImport(widget.OWWidget):
name = "CSV File Import"
description = "Import a data table from a CSV formatted file."
icon = "icons/CSVFile.svg"
outputs = [
widget.OutputSignal(
name="Data",
type=Orange.data.Table,
doc="Loaded data set."),
widget.OutputSignal(
name="Data Frame",
type=pd.DataFrame,
doc=""
)
]
class Error(widget.OWWidget.Error):
error = widget.Msg(
"Unexpected error"
)
encoding_error = widget.Msg(
"Encoding error\n"
"The file might be encoded in an unsupported encoding or it "
"might be binary"
)
#: Paths and options of files accessed in a 'session'
_session_items = settings.Setting(
[], schema_only=True) # type: List[Tuple[str, dict]]
#: Saved dialog state (last directory and selected filter)
dialog_state = settings.Setting({
"directory": "",
"filter": ""
}) # type: Dict[str, str]
MaxHistorySize = 50
want_main_area = False
buttons_area_orientation = None
def __init__(self, *args, **kwargs):
super().__init__(self, *args, **kwargs)
self.__committimer = QTimer(self, singleShot=True)
self.__committimer.timeout.connect(self.commit)
self.__executor = qconcurrent.ThreadExecutor()
self.__watcher = None # type: Optional[qconcurrent.FutureWatcher]
self.controlArea.layout().setSpacing(-1) # reset spacing
grid = QGridLayout()
grid.addWidget(QLabel("File:", self), 0, 0, 1, 1)
self.import_items_model = QStandardItemModel(self)
self.recent_combo = QComboBox(
self, objectName="recent-combo", toolTip="Recent files.",
sizeAdjustPolicy=QComboBox.AdjustToMinimumContentsLengthWithIcon,
minimumContentsLength=16,
)
self.recent_combo.setModel(self.import_items_model)
self.recent_combo.activated.connect(self.activate_recent)
self.recent_combo.setSizePolicy(
QSizePolicy.MinimumExpanding, QSizePolicy.Fixed)
self.browse_button = QPushButton(
"…", icon=self.style().standardIcon(QStyle.SP_DirOpenIcon),
toolTip="Browse filesystem", autoDefault=False,
)
self.browse_button.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
self.browse_button.clicked.connect(self.browse)
grid.addWidget(self.recent_combo, 0, 1, 1, 1)
grid.addWidget(self.browse_button, 0, 2, 1, 1)
self.controlArea.layout().addLayout(grid)
###########
# Info text
###########
box = gui.widgetBox(self.controlArea, "Info", addSpace=False)
self.summary_text = QTextBrowser(
verticalScrollBarPolicy=Qt.ScrollBarAsNeeded,
readOnly=True,
)
self.summary_text.viewport().setBackgroundRole(QPalette.NoRole)
self.summary_text.setFrameStyle(QTextBrowser.NoFrame)
self.summary_text.setMinimumHeight(self.fontMetrics().ascent() * 2 + 4)
self.summary_text.viewport().setAutoFillBackground(False)
box.layout().addWidget(self.summary_text)
button_box = QDialogButtonBox(
orientation=Qt.Horizontal,
standardButtons=QDialogButtonBox.Cancel | QDialogButtonBox.Retry
)
self.load_button = b = button_box.button(QDialogButtonBox.Retry)
b.setText("Load")
b.clicked.connect(self.__committimer.start)
b.setEnabled(False)
b.setDefault(True)
self.cancel_button = b = button_box.button(QDialogButtonBox.Cancel)
b.clicked.connect(self.cancel)
#.........这里部分代码省略.........
示例9: NewProjectManager
# 需要导入模块: from PyQt5.QtWidgets import QTextBrowser [as 别名]
# 或者: from PyQt5.QtWidgets.QTextBrowser import setText [as 别名]
class NewProjectManager(QDialog):
def __init__(self, parent=None):
super(NewProjectManager, self).__init__(parent, Qt.Dialog)
self.setWindowTitle(translations.TR_NEW_PROJECT)
self.setMinimumHeight(500)
vbox = QVBoxLayout(self)
vbox.addWidget(QLabel(translations.TR_CHOOSE_TEMPLATE))
vbox.addWidget(QLabel(translations.TR_TAB_PROJECTS))
hbox = QHBoxLayout()
self.list_projects = QListWidget()
self.list_projects.setProperty("wizard", True)
hbox.addWidget(self.list_projects)
self.list_templates = QListWidget()
self.list_templates.setProperty("wizard", True)
hbox.addWidget(self.list_templates)
self.text_info = QTextBrowser()
self.text_info.setProperty("wizard", True)
hbox.addWidget(self.text_info)
vbox.addLayout(hbox)
hbox2 = QHBoxLayout()
cancel = QPushButton(translations.TR_CANCEL)
choose = QPushButton(translations.TR_CHOOSE)
hbox2.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding,
QSizePolicy.Fixed))
hbox2.addWidget(cancel)
hbox2.addWidget(choose)
vbox.addLayout(hbox2)
self.template_registry = IDE.get_service("template_registry")
categories = self.template_registry.list_project_categories()
for category in categories:
self.list_projects.addItem(category)
cancel.clicked['bool'].connect(self.close)
choose.clicked['bool'].connect(self._start_wizard)
self.list_projects.itemSelectionChanged.connect(self._project_selected)
self.list_templates.itemSelectionChanged.connect(self._template_selected)
def _project_selected(self):
self.list_templates.clear()
item = self.list_projects.currentItem()
category = item.text()
for template in self.template_registry.list_templates_for_cateogory(
category):
item = QListWidgetItem(template.type_name)
item.setData(Qt.UserRole, template)
item = self.list_templates.addItem(item)
def _template_selected(self):
item = self.list_templates.currentItem()
ptype = item.data(Qt.UserRole)
self.text_info.setText(ptype.description)
def _start_wizard(self):
return QMessageBox.critical(self, "Beta Info", "Can not construct this segment!")
item = self.list_templates.currentItem()
if item is not None:
ptype = item.data(Qt.UserRole)
示例10: MainWindow
# 需要导入模块: from PyQt5.QtWidgets import QTextBrowser [as 别名]
# 或者: from PyQt5.QtWidgets.QTextBrowser import setText [as 别名]
#.........这里部分代码省略.........
# noab = len(list(filter(lambda x: self.active_buttons[x], self.active_buttons)))
# self.reject_value = noab - 1
def hide_unused_elements(self):
""" Hide the unused elements """
global arguments
if not arguments.forkedprogressbar:
self.progressBar.hide()
if not arguments.slider:
self.horizontalSlider.hide()
if not arguments.combobox:
self.comboBox.hide()
if not arguments.inputbox and not arguments.password:
self.lineEdit.hide()
if not arguments.combobox and not arguments.password:
self.label_2.hide()
def init_conf(self):
""" Initial configurations (buttons and labels) """
global arguments
if arguments.title:
self.setWindowTitle(pydialog_title)
if arguments.icon:
from PyQt5.QtGui import QIcon
icon = QIcon(arguments.icon)
self.setWindowIcon(icon)
if arguments.yesno or arguments.warningyesno:
self.enable_buttons(["yes_button", "no_button"])
if arguments.yesno:
self.label.setText(arguments.yesno)
else:
self.label.setText(arguments.warningyesno)
elif arguments.yesnocancel or arguments.warningyesnocancel:
self.enable_buttons(["yes_button", "no_button", "cancel_button"])
if arguments.yesnocancel:
self.label.setText(arguments.yesnocancel)
else:
self.label.setText(arguments.warningyesnocancel)
elif arguments.sorry or arguments.error or arguments.msgbox or arguments.textbox or arguments.about:
self.enable_buttons(["ok_button"])
if arguments.sorry:
self.label.setText(arguments.sorry)
elif arguments.error:
print("itt", arguments.error)
self.label.setText(arguments.error)
elif arguments.msgbox:
self.label.setText(arguments.msgbox)
elif arguments.textbox:
from PyQt5.QtWidgets import QTextBrowser
width = 400
height = 250
url = arguments.textbox[0]
if len(arguments.textbox) > 1:
width = int(arguments.textbox[1])
if len(arguments.textbox) > 2:
height = int(arguments.textbox[2])
self.textbrowser = QTextBrowser()
self.textbrowser.setMinimumSize(width, height)
self.verticalLayout_2.addWidget(self.textbrowser)
file = open(url, "r")
示例11: NewProjectManager
# 需要导入模块: from PyQt5.QtWidgets import QTextBrowser [as 别名]
# 或者: from PyQt5.QtWidgets.QTextBrowser import setText [as 别名]
class NewProjectManager(QDialog):
def __init__(self, parent=None):
super(NewProjectManager, self).__init__(parent, Qt.Dialog)
self.setWindowTitle(translations.TR_NEW_PROJECT)
self.setMinimumHeight(500)
vbox = QVBoxLayout(self)
vbox.addWidget(QLabel(translations.TR_CHOOSE_TEMPLATE))
vbox.addWidget(QLabel(translations.TR_TAB_PROJECTS))
hbox = QHBoxLayout()
self.list_projects = QListWidget()
self.list_projects.setProperty("wizard", True)
hbox.addWidget(self.list_projects)
self.list_templates = QListWidget()
self.list_templates.setProperty("wizard", True)
hbox.addWidget(self.list_templates)
self.text_info = QTextBrowser()
self.text_info.setProperty("wizard", True)
hbox.addWidget(self.text_info)
vbox.addLayout(hbox)
button_box = QDialogButtonBox(
QDialogButtonBox.Cancel | QDialogButtonBox.Ok)
choose_button = button_box.button(QDialogButtonBox.Ok)
choose_button.setText(translations.TR_CHOOSE)
# hbox2 = QHBoxLayout()
# cancel = QPushButton(translations.TR_CANCEL)
# choose = QPushButton(translations.TR_CHOOSE)
# hbox2.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding,
# QSizePolicy.Fixed))
# hbox2.addWidget(cancel)
# hbox2.addWidget(choose)
# vbox.addLayout(button_box)
vbox.addWidget(button_box)
self.template_registry = IDE.get_service("template_registry")
categories = self.template_registry.list_project_categories()
for category in categories:
self.list_projects.addItem(category)
button_box.accepted.connect(self.accept)
button_box.rejected.connect(self.reject)
# cancel.clicked.connect(self.close)
# choose.clicked.connect(self._start_wizard)
self.list_projects.itemSelectionChanged.connect(
self._project_selected)
self.list_templates.itemSelectionChanged.connect(
self._template_selected)
self.list_projects.setCurrentRow(0)
def accept(self):
logger.debug("Accept...")
self._start_wizard()
super().accept()
def _project_selected(self):
self.list_templates.clear()
item = self.list_projects.currentItem()
category = item.text()
for template in self.template_registry.list_templates_for_cateogory(
category):
item = QListWidgetItem(template.type_name)
item.setData(Qt.UserRole, template)
item = self.list_templates.addItem(item)
self.list_templates.setCurrentRow(0)
def _template_selected(self):
item = self.list_templates.currentItem()
ptype = item.data(Qt.UserRole)
self.text_info.setText(ptype.description)
def _start_wizard(self):
item = self.list_templates.currentItem()
if item is not None:
project_type = item.data(Qt.UserRole)
ninja = IDE.get_service("ide")
wizard = WizardProject(project_type, ninja)
wizard.show()
示例12: Example
# 需要导入模块: from PyQt5.QtWidgets import QTextBrowser [as 别名]
# 或者: from PyQt5.QtWidgets.QTextBrowser import setText [as 别名]
#.........这里部分代码省略.........
ex_button=QPushButton('Exit',self)
ex_button.resize(130,40)
ex_button.move(30,350)
ex_button.setFont(QFont('Calibri', 14, QFont.Bold))
ex_button.setStyleSheet("QPushButton{color:'#016d5d';background:'#e1e1e1'}")
ex_button.clicked.connect(self.exclicked)
en_button=QPushButton('Enter',self)
en_button.resize(130,40)
en_button.move(170,350)
en_button.setFont(QFont('Calibri', 14, QFont.Bold))
en_button.setStyleSheet("QPushButton{color:'#016d5d';background:'#e1e1e1'}")
# en_button.setFlat(True)
# grid.addWidget(button, 5, 1)
self.toshow = QTextBrowser(self)
self.toshow.resize(270,50)
self.toshow.move(30,20)
#self.toshow.append('enter1')
en_button.clicked.connect(self.enButtonClicked)
# inpEdit.setFixedWidth(400)
#self.move(300, 150)
self.setGeometry(300,250,360,400)
self.setWindowTitle('Calculator')
self.show()
def enButtonClicked(self):
self.comlist.append("=")
print('commlist',self.comlist)
str1 = ' '.join(self.comlist)
self.toshow.setFont(QFont('Calibri', 14, QFont.Bold))
self.toshow.setText(str1)
print('Instructions:')
self.comlist.pop()
tokens=[['id','s'],['=','reserved']]
for com in self.comlist:
if com in ['0','1','2','3']:
tokens.append(['num',com])
elif com in ['NOT','AND','OR','XOR']:
tokens.append([com.lower(),'reserved'])
else:
tokens.append([com,'reserved'])
print(tokens)
root=d_ast1.tree('headers')
headers=d_parser.d_par(tokens)
for header in headers:
#print(type(header),header.data)
if header.id==1:
root.add(header)
#print(header)
#print(root.getchildren())
cod=d_inte_gene.in_gene(headers)
ins=d_gene.d_gene(cod)
print(ins)
for inn in ins:
print(inn)
newWindow = Example1()
newWindow.toshow.setFont(QFont('Calibri', 14, QFont.Bold))
for inn in ins:
newWindow.s.append(inn)
newWindow.showIns()
newWindow.exec_()