我们从Python开源项目中,提取了以下49个代码示例,用于说明如何使用PyQt4.QtGui.QTextEdit()。
def setupUi(self, Form): Form.setObjectName(_fromUtf8("Form")) Form.resize(582, 317) self.verticalLayoutWidget = QtGui.QWidget(Form) self.verticalLayoutWidget.setGeometry(QtCore.QRect(10, 10, 561, 261)) self.verticalLayoutWidget.setObjectName(_fromUtf8("verticalLayoutWidget")) self.verticalLayout = QtGui.QVBoxLayout(self.verticalLayoutWidget) self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) self.labelProgress = QtGui.QLabel(self.verticalLayoutWidget) font = QtGui.QFont() font.setPointSize(12) font.setBold(True) font.setWeight(75) self.labelProgress.setFont(font) self.labelProgress.setObjectName(_fromUtf8("labelProgress")) self.verticalLayout.addWidget(self.labelProgress) self.textEdit = QtGui.QTextEdit(self.verticalLayoutWidget) self.textEdit.setObjectName(_fromUtf8("textEdit")) self.verticalLayout.addWidget(self.textEdit) self.btnContinue = QtGui.QPushButton(Form) self.btnContinue.setGeometry(QtCore.QRect(450, 280, 90, 28)) self.btnContinue.setObjectName(_fromUtf8("btnContinue")) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form)
def initUI(self): self.text_show2 = QtGui.QTextEdit() self.text_show2.setText(SHOW2STR) self.text_show2.setReadOnly(True) self.text_hex = QtGui.QTextEdit() self.text_hex.setText(HEXSTR) self.text_hex.setReadOnly(True) self.save_but = QtGui.QPushButton(u'???PDF', self) self.save_but.setCheckable(False) self.save_but.clicked.connect(self.save_pdf) vbox = QtGui.QVBoxLayout() vbox.addWidget(self.text_show2) vbox.addWidget(self.text_hex) vbox.addWidget(self.save_but) self.setLayout(vbox) """ self.splitter = QtGui.QSplitter(self) self.splitter.addWidget(self.text_show2) self.splitter.addWidget(self.text_hex) self.splitter.setOrientation(QtCore.Qt.Vertical) """
def setupUi(self, MainDialog): MainDialog.setObjectName(_fromUtf8("MainDialog")) MainDialog.resize(438, 583) self.verticalLayout_2 = QtGui.QVBoxLayout(MainDialog) self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2")) self.verticalLayout = QtGui.QVBoxLayout() self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) self.label = QtGui.QLabel(MainDialog) self.label.setText(_fromUtf8("")) self.label.setPixmap(QtGui.QPixmap(_fromUtf8(":/Other/icons/mall_logo1_medium.png"))) self.label.setObjectName(_fromUtf8("label")) self.verticalLayout.addWidget(self.label) self.textEdit = QtGui.QTextEdit(MainDialog) self.textEdit.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) self.textEdit.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) self.textEdit.setReadOnly(True) self.textEdit.setObjectName(_fromUtf8("textEdit")) self.verticalLayout.addWidget(self.textEdit) self.verticalLayout_2.addLayout(self.verticalLayout) self.retranslateUi(MainDialog) QtCore.QMetaObject.connectSlotsByName(MainDialog)
def __init__(self, parent=None): super(ChangeUI_lable, self).__init__(parent) self.setWindowTitle("One") self.pushButton = QtGui.QPushButton("Rocky_Button") self.pushButton1 = QtGui.QPushButton("Clear") self.textEdit = QtGui.QTextEdit() layout = QtGui.QVBoxLayout() self.pushButton.clicked.connect(self.onClick) self.pushButton1.clicked.connect(self.onClick1) layout.addWidget(self.textEdit) layout.addWidget(self.pushButton) layout.addWidget(self.pushButton1) self.setLayout(layout)
def initMenubar(self): menubar = self.menuBar() # Creates objects for the toolbar menus file = menubar.addMenu("File") edit = menubar.addMenu("Edit") view = menubar.addMenu("View") file.addAction(self.newAction) file.addAction(self.openAction) file.addAction(self.saveAction) file.addAction(self.printAction) file.addAction(self.previewAction) edit.addAction(self.undoAction) edit.addAction(self.redoAction) edit.addAction(self.cutAction) edit.addAction(self.copyAction) edit.addAction(self.pasteAction) # Creates a QTextEdit object as the main PyQt object. # Then initialize the three menu toolbars to appear at the top of the editor # These will contain the markdown functions to be displayed in the editor
def initUI(self): self.text = QtGui.QTextEdit(self) self.setCentralWidget(self.text) self.initToolbar() self.initFormatbar() self.initMenubar() # Creates a statusbar for the window self.statusbar = self.statusBar() # Coordinates for the main PyQt widget self.setGeometry(100, 100, 1030, 800) self.setWindowTitle("CaptsLog")
def clearChildren (self, widget ): if ( isinstance(widget, QtGui.QLineEdit) or isinstance(widget, QtGui.QTextEdit)): widget.setText("") if ( isinstance(widget, QtGui.QComboBox) ): widget.setCurrentIndex( 0 ) if ( isinstance(widget, QtGui.QCheckBox) ): widget.setChecked( False ) if ( isinstance(widget, QtGui.QTableWidget) ): while widget.rowCount() > 0: widget.removeRow(0) # recursive call on chillun for child in widget.children(): self.clearChildren( child )
def closeEvent(self, event): print 'ui closed' # restore stdout sys.stdout = self.textEdit.stdout_bak sys.stderr = self.textEdit.stderr_bak # ptr = apiUI.MQtUtil.mainWindow() # mwin=sip.wrapinstance(long(ptr), QtGui.QObject) # cmdReporters = cmds.lsUI(type='cmdScrollFieldReporter') # cmdReporter = mwin.findChild(QtGui.QTextEdit, cmdReporters[0]) # sys.stdout=cmdReporter # sys.stderr =cmdReporter event.accept() # event.ignore()
def slotDisplayPreview(self): data = self.getCurrentFileData() displayDialog = QtGui.QDialog() displayDialog.setWindowTitle('Display attachment') textField = QtGui.QTextEdit() textField.setPlainText(data) textField.setReadOnly(True) saveButton = QtGui.QPushButton('&Save') saveButton.clicked.connect(self.askAndSaveFile) okButton = QtGui.QPushButton('&Ok') okButton.clicked.connect(displayDialog.accept) layout = QtGui.QVBoxLayout() layout.addWidget(textField) layout.addWidget(saveButton) layout.addWidget(okButton) displayDialog.setLayout(layout) displayDialog.exec_()
def __init__(self, parent=None): super(MainWindow, self).__init__(parent) self.createToolBox() self.textEdit = QtGui.QTextEdit() self.center_widget = self.demo_plot() #self.center_widget.subplots_adjust(0.05, 0.05, 1, 1) self.createActions() self.createMenus() self.createToolBars() self.createStatusBar() self.createDockWindows() self.setWindowTitle("QuantDigger") self.setUnifiedTitleAndToolBarOnMac(True) self.setCentralWidget(self.center_widget) self.center_widget.setFocus(True)
def initUI(self): # Layout are better for placing widgets layout = QtGui.QHBoxLayout() self.runButton = QtGui.QPushButton('Run') self.runButton.clicked.connect(self.callProgram) self.output = QtGui.QTextEdit() layout.addWidget(self.output) layout.addWidget(self.runButton) centralWidget = QtGui.QWidget() centralWidget.setLayout(layout) self.setCentralWidget(centralWidget) # QProcess object for external app self.process = QtCore.QProcess(self) # QProcess emits `readyRead` when there is data to be read self.process.readyRead.connect(self.dataReady) # Just to prevent accidentally running multiple times # Disable the button when process starts, and enable it when it finishes self.process.started.connect(lambda: self.runButton.setEnabled(False)) self.process.finished.connect(lambda: self.runButton.setEnabled(True)) #Function Main Start
def setupUi(self, qgpkgDlg): qgpkgDlg.setObjectName(_fromUtf8("qgpkgDlg")) qgpkgDlg.resize(456, 358) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(_fromUtf8(":/plugins/QgisGeopackage/about.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) qgpkgDlg.setWindowIcon(icon) self.verticalLayout = QtGui.QVBoxLayout(qgpkgDlg) self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) self.textEdit = QtGui.QTextEdit(qgpkgDlg) self.textEdit.setReadOnly(True) self.textEdit.setObjectName(_fromUtf8("textEdit")) self.verticalLayout.addWidget(self.textEdit) self.button_box = QtGui.QDialogButtonBox(qgpkgDlg) self.button_box.setOrientation(QtCore.Qt.Horizontal) self.button_box.setStandardButtons(QtGui.QDialogButtonBox.Close) self.button_box.setObjectName(_fromUtf8("button_box")) self.verticalLayout.addWidget(self.button_box) self.retranslateUi(qgpkgDlg) QtCore.QObject.connect(self.button_box, QtCore.SIGNAL(_fromUtf8("accepted()")), qgpkgDlg.accept) QtCore.QObject.connect(self.button_box, QtCore.SIGNAL(_fromUtf8("rejected()")), qgpkgDlg.reject) QtCore.QMetaObject.connectSlotsByName(qgpkgDlg)
def setupUi(self, Dialog): Dialog.setObjectName(_fromUtf8("Dialog")) Dialog.resize(400, 113) self.buttonBox = QtGui.QDialogButtonBox(Dialog) self.buttonBox.setGeometry(QtCore.QRect(40, 60, 341, 32)) self.buttonBox.setOrientation(QtCore.Qt.Horizontal) self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok) self.buttonBox.setObjectName(_fromUtf8("buttonBox")) self.label = QtGui.QLabel(Dialog) self.label.setGeometry(QtCore.QRect(10, 30, 71, 16)) self.label.setObjectName(_fromUtf8("label")) self.textEdit = QtGui.QTextEdit(Dialog) self.textEdit.setGeometry(QtCore.QRect(90, 30, 291, 21)) self.textEdit.setObjectName(_fromUtf8("textEdit")) self.sbRepeats = QtGui.QSpinBox(Dialog) self.sbRepeats.setGeometry(QtCore.QRect(90, 60, 50, 21)) self.sbRepeats.setObjectName(_fromUtf8("textEdit")) self.sbRepeats.setMinimum(1) self.sbRepeats.setMaximum(99) self.retranslateUi(Dialog) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), self.Accept) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), self.Reject) QtCore.QMetaObject.connectSlotsByName(Dialog) self.dlg = Dialog
def setupUi(self, Dialog): Dialog.setObjectName(_fromUtf8("Dialog")) Dialog.resize(800, 600) Dialog.setStyleSheet(_fromUtf8("\n" "background-color: rgb(85, 170, 127);")) self.joinchallenge = QtGui.QPushButton(Dialog) self.joinchallenge.setGeometry(QtCore.QRect(370, 346, 98, 41)) self.joinchallenge.setStyleSheet(_fromUtf8("color: rgb(0, 0, 49);")) self.joinchallenge.setObjectName(_fromUtf8("pushButton")) self.textEdit = QtGui.QTextEdit(Dialog) self.textEdit.setGeometry(QtCore.QRect(303, 160, 311, 51)) self.textEdit.setStyleSheet(_fromUtf8("background-color: rgb(255, 255, 255);")) self.textEdit.setObjectName(_fromUtf8("textEdit")) self.label = QtGui.QLabel(Dialog) self.label.setGeometry(QtCore.QRect(120, 160, 151, 41)) self.label.setStyleSheet(_fromUtf8("color: rgb(0, 0, 49);")) self.label.setObjectName(_fromUtf8("label")) self.retranslateUi(Dialog) QtCore.QMetaObject.connectSlotsByName(Dialog)
def __init__(self, database_ref): super(ResultsPage, self).__init__() self.database_ref = database_ref self.resultDisplay = QtGui.QTextEdit() self.resultDisplay.setFixedWidth(1200) self.resultDisplay.setReadOnly(True) self.resultDisplay.setStyleSheet("font: 10pt \"Courier\";") self.exportButton = QtGui.QPushButton('Export') self.grid = QtGui.QGridLayout() self.grid.setSpacing(20) self.grid.addWidget(self.resultDisplay, 1, 0, 5, 6) self.grid.addWidget(self.exportButton, 6, 0) self.setLayout(self.grid)
def event(self, e): result = QtGui.QMessageBox.event(self, e) self.setMinimumHeight(0) self.setMaximumHeight(16777215) self.setMinimumWidth(0) self.setMaximumWidth(16777215) self.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) textEdit = self.findChild(QtGui.QTextEdit) if textEdit != None : textEdit.setMinimumHeight(0) textEdit.setMaximumHeight(16777215) textEdit.setMinimumWidth(0) textEdit.setMaximumWidth(16777215) textEdit.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) return result
def setupUi(self, Form): Form.setObjectName(_fromUtf8("Form")) Form.resize(529, 329) self.selInfoWidget = QtGui.QWidget(Form) self.selInfoWidget.setGeometry(QtCore.QRect(260, 10, 264, 222)) self.selInfoWidget.setObjectName(_fromUtf8("selInfoWidget")) self.gridLayout = QtGui.QGridLayout(self.selInfoWidget) self.gridLayout.setMargin(0) self.gridLayout.setObjectName(_fromUtf8("gridLayout")) self.selDescLabel = QtGui.QLabel(self.selInfoWidget) self.selDescLabel.setText(_fromUtf8("")) self.selDescLabel.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) self.selDescLabel.setWordWrap(True) self.selDescLabel.setObjectName(_fromUtf8("selDescLabel")) self.gridLayout.addWidget(self.selDescLabel, 0, 0, 1, 1) self.selNameLabel = QtGui.QLabel(self.selInfoWidget) font = QtGui.QFont() font.setBold(True) font.setWeight(75) self.selNameLabel.setFont(font) self.selNameLabel.setText(_fromUtf8("")) self.selNameLabel.setObjectName(_fromUtf8("selNameLabel")) self.gridLayout.addWidget(self.selNameLabel, 0, 1, 1, 1) self.selectedTree = DataTreeWidget(self.selInfoWidget) self.selectedTree.setObjectName(_fromUtf8("selectedTree")) self.selectedTree.headerItem().setText(0, _fromUtf8("1")) self.gridLayout.addWidget(self.selectedTree, 1, 0, 1, 2) self.hoverText = QtGui.QTextEdit(Form) self.hoverText.setGeometry(QtCore.QRect(0, 240, 521, 81)) self.hoverText.setObjectName(_fromUtf8("hoverText")) self.view = FlowchartGraphicsView(Form) self.view.setGeometry(QtCore.QRect(0, 0, 256, 192)) self.view.setObjectName(_fromUtf8("view")) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form)
def __init__(self): QtGui.QWidget.__init__(self) self.setGeometry(50, 50, 500, 300) layout = QtGui.QVBoxLayout(self) self.button = QtGui.QPushButton('Test') self.edit = QtGui.QTextEdit() self.setStyleSheet("QTextEdit{border-image: url(bg.jpg);}") self.edit.setReadOnly(True) self.edit.setStyleSheet("QTextEdit{color:#FFFFFF},") layout.addWidget(self.edit) self.show() self.handleTest()
def __JournalView(self, parent): """Set up QPlainTextEdit. This function creates a Text Editor that cathces the output text from the mardown function and displays the html text. The size of this widget scales along with the window size. Note : The user should not be able to input any text in this widget. """ self.journalView = QtGui.QTextEdit(parent.centralWidget) self.journalView.setMinimumSize(QtCore.QSize(200, 600)) self.journalView.setObjectName(_fromUtf8("journalView")) self.journalView.setReadOnly(True)
def connectChildDirtyFlagSignals (self, widget ): if ( isinstance(widget, QtGui.QLineEdit)): widget.textEdited.connect(self.setDirtyFlag) if ( isinstance(widget, QtGui.QTextEdit)): widget.textChanged.connect(self.setDirtyFlag) if ( isinstance(widget, QtGui.QComboBox) ): widget.currentIndexChanged.connect(self.setDirtyFlag) if ( isinstance(widget, QtGui.QCheckBox) ): widget.stateChanged.connect(self.setDirtyFlag) # recursive call on chillun for child in widget.children(): if child != self.pageListEditor: self.connectChildDirtyFlagSignals( child )
def __init__(self): QtGui.QWidget.__init__(self) self.setWindowTitle(u"????") icon = QtGui.QIcon() icon.addPixmap( QtGui.QPixmap(_fromUtf8("ttt.ico")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.setWindowIcon(icon) self.filetext = QtGui.QLineEdit( os.path.join(os.path.dirname(__file__), "")) inputfile = QtGui.QPushButton(u"????") hbox = QtGui.QHBoxLayout() hbox.addWidget(QtGui.QLabel(u"????:")) hbox.addWidget(self.filetext) hbox.addWidget(inputfile) self.text = QtGui.QTextEdit("") hbox2 = QtGui.QHBoxLayout() hbox2.addWidget(self.text) okbutton = QtGui.QPushButton(u"??") hbox3 = QtGui.QHBoxLayout() hbox3.addStretch() hbox3.addWidget(okbutton) hbox3.addStretch() vbox = QtGui.QVBoxLayout() vbox.addLayout(hbox) vbox.addLayout(hbox2) vbox.addLayout(hbox3) self.setLayout(vbox) self.connect( inputfile, QtCore.SIGNAL("clicked()"), self.openfile_clicked) self.connect(okbutton, QtCore.SIGNAL("clicked()"), self.setup) self.resize(600, 400)
def __init__(self,application): super(FilterChoice,self).__init__() self.application = application self.setSizePolicy (QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Expanding) # make a label, a text editor, and a button self.label = QtGui.QLabel(self.DocText) self.label.setWordWrap(True) self.editor = QtGui.QTextEdit() self.editor.setAcceptRichText(False) self.editor.setPlainText('') self.searchButton = QtGui.QPushButton('New search') self.searchButton.clicked.connect(self.slotSearchButtonClicked) self.clearButton = QtGui.QPushButton('Clear') self.clearButton.clicked.connect(self.slotClearButtonClicked) self.undoButton = QtGui.QPushButton('Undo') self.undoButton.clicked.connect(self.editor.undo) buttonSubLayout = QtGui.QHBoxLayout() buttonSubLayout.addWidget(self.searchButton) buttonSubLayout.addWidget(self.clearButton) buttonSubLayout.addWidget(self.undoButton) self.layout = QtGui.QVBoxLayout() self.layout.addWidget(self.label) self.layout.addWidget(self.editor) self.layout.addLayout(buttonSubLayout) self.setLayout(self.layout) # This badly hacked parser validate the 'filter' user input, adds some quotes # and convert it into a dict, which is returned so that it can be passed on to PyMongo.collection.find # raises a WrongQueryException if something is wrong
def focusInEvent(self, event): if self.completer: self.completer.setWidget(self); QtGui.QTextEdit.focusInEvent(self, event)
def setupUi(self, Dialog): Dialog.setObjectName(_fromUtf8("Dialog")) Dialog.resize(412, 300) Dialog.setMinimumSize(QtCore.QSize(412, 300)) Dialog.setMaximumSize(QtCore.QSize(412, 300)) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/assets/logo.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) Dialog.setWindowIcon(icon) self.gridLayout_3 = QtGui.QGridLayout(Dialog) self.gridLayout_3.setObjectName(_fromUtf8("gridLayout_3")) self.connectP2pButton = QtGui.QPushButton(Dialog) self.connectP2pButton.setIconSize(QtCore.QSize(20, 20)) self.connectP2pButton.setObjectName(_fromUtf8("connectP2pButton")) self.gridLayout_3.addWidget(self.connectP2pButton, 3, 1, 1, 1) spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.gridLayout_3.addItem(spacerItem, 3, 0, 1, 1) self.messageText = QtGui.QTextEdit(Dialog) self.messageText.setObjectName(_fromUtf8("messageText")) self.gridLayout_3.addWidget(self.messageText, 2, 0, 1, 2) self.portLine = QtGui.QLineEdit(Dialog) self.portLine.setMinimumSize(QtCore.QSize(0, 34)) self.portLine.setEchoMode(QtGui.QLineEdit.Normal) self.portLine.setObjectName(_fromUtf8("portLine")) self.gridLayout_3.addWidget(self.portLine, 1, 0, 1, 2) self.ipaddressLine = QtGui.QLineEdit(Dialog) self.ipaddressLine.setMinimumSize(QtCore.QSize(0, 34)) self.ipaddressLine.setObjectName(_fromUtf8("ipaddressLine")) self.gridLayout_3.addWidget(self.ipaddressLine, 0, 0, 1, 2) self.retranslateUi(Dialog) QtCore.QMetaObject.connectSlotsByName(Dialog)
def __init__(self, parent=None): QtGui.QMainWindow.__init__(self, parent) self.setGeometry(300, 300, 350, 300) self.setWindowTitle('OpenFile') self.textEdit = QtGui.QTextEdit() self.setCentralWidget(self.textEdit) self.statusBar() self._label = QtGui.QLabel("Einkaufszaehler") self.statusBar().addPermanentWidget(self._label) self.statusBar().addPermanentWidget(self._label) self._label.setText("BLA2") self.setFocus() openFile = QtGui.QAction(QtGui.QIcon('open.png'), 'Open', self) openFile.setShortcut('Ctrl+O') openFile.setStatusTip('Open new File') self.connect(openFile, QtCore.SIGNAL('triggered()'), self.showDialog) menubar = self.menuBar() fileMenu = menubar.addMenu('&File') fileMenu.addAction(openFile)
def __init__( self ) : # Inherit all attributes of an instance of "QTextEdit". super( format_TextEdit, self ).__init__( ) #----------------------------------------------------------------------- # DEFINE THE FUNCTION FOR PRINTING AN INDENTATION. #-----------------------------------------------------------------------
def __init__(self): super(SolutionView, self).__init__() grid = QtGui.QGridLayout() self.solution = QtGui.QTextEdit() self.solutionLabel = QtGui.QLabel(Lang.value('SS_Solution')) self.keywords = KeywordsInputWidget() self.keywordsLabel = QtGui.QLabel(Lang.value('SS_Keywords')) self.comments = QtGui.QTextEdit() self.commentsLabel = QtGui.QLabel(Lang.value('SS_Comments')) grid.addWidget(self.solutionLabel, 0, 0) grid.addWidget(self.solution, 1, 0, 3, 1) grid.addWidget(self.keywordsLabel, 0, 1) grid.addWidget(self.keywords, 1, 1) grid.addWidget(self.commentsLabel, 2, 1) grid.addWidget(self.comments, 3, 1) self.setLayout(grid) Mainframe.sigWrapper.sigModelChanged.connect(self.onModelChanged) Mainframe.sigWrapper.sigLangChanged.connect(self.onLangChanged) self.solution.textChanged.connect(self.onChanged) self.keywords.textChanged.connect(self.onChanged) self.comments.textChanged.connect(self.onChanged) self.skip_model_changed = False
def createUIComponents(self): self.currentImageLabel = QtGui.QLabel(self) self.currentStatusLabel = QtGui.QLabel(self) self.swipeRightButton = QtGui.QPushButton('Like', self); self.swipeLeftButton = QtGui.QPushButton('Pass', self); self.superLikeButton = QtGui.QPushButton('Super-Like', self); self.swipeRightButton.clicked.connect(self.swipeRight); self.swipeLeftButton.clicked.connect(self.swipeLeft); self.superLikeButton.clicked.connect(self.superLike); self.personDescriptionTextEdit = QtGui.QTextEdit(); self.personDescriptionTextEdit.setEnabled(False); self.swipeInformationTextEdit = QtGui.QTextEdit(); self.swipeInformationTextEdit.setEnabled(False); self.eyeColorLabel = QtGui.QLabel(self); self.eyeColorLabel.setText("Eye Color: "); self.eyeColorComboBox = QtGui.QComboBox(self); self.eyeColorComboBox.activated[str].connect(self.changedEyeColor); self.addEyeColorOptions(); self.hairColorLabel = QtGui.QLabel(self); self.hairColorLabel.setText("Hair Color: "); self.hairColorComboBox = QtGui.QComboBox(self); self.hairColorComboBox.activated[str].connect(self.changedHairColor); self.addHairColorOptions();
def text_changed(self): prac_sess.editPara.setReadOnly(True) mytext = prac_sess.editPara.toPlainText() global input_l input_l=len(mytext) print input_l if input_l == 1: start_time = time() print start_time para_l = len(prac_sess.st) print input_l print para_l if input_l <= para_l: if mytext == prac_sess.st[0:input_l]: print "match" prac_sess.editPara.setStyleSheet("QTextEdit {color:black}") correctType.append(prac_sess.st[input_l-1]) print correctType else: prac_sess.editPara.setStyleSheet("QTextEdit {color:red}") wrongType.append(prac_sess.st[input_l-1]) print wrongType if input_l <= para_l: prac_sess.editPara.setReadOnly(False) else: self.final_time() self.resultSection() #initial activity
def update_progressbar(self, val): self.progressBar.setValue(val) if val == 5: self.timeToStart.setText("Go..Game will start ") self.timeToStart.setStyleSheet("QTextEdit {color:green}") #function to directly close App
def setupUi(self, Audio): Audio.setObjectName(_fromUtf8("Audio")) Audio.resize(580, 500) self.centralWidget = QtGui.QWidget(Audio) self.centralWidget.setObjectName(_fromUtf8("centralWidget")) self.play = QtGui.QPushButton(self.centralWidget) self.play.setGeometry(QtCore.QRect(20, 60, 84, 41)) self.play.setObjectName(_fromUtf8("play")) self.horizontalSlider = QtGui.QSlider(self.centralWidget) self.horizontalSlider.setGeometry(QtCore.QRect(120, 70, 451, 20)) self.horizontalSlider.setProperty("value", 24) self.horizontalSlider.setOrientation(QtCore.Qt.Horizontal) self.horizontalSlider.setObjectName(_fromUtf8("horizontalSlider")) self.audioTextEdit = QtGui.QTextEdit(self.centralWidget) self.audioTextEdit.setGeometry(QtCore.QRect(50, 190, 481, 131)) self.audioTextEdit.setObjectName(_fromUtf8("audioTextEdit")) self.audioTextEdit.setReadOnly(True) self.type = QtGui.QLabel(self.centralWidget) self.type.setGeometry(QtCore.QRect(60, 160, 61, 16)) self.type.setObjectName(_fromUtf8("type")) self.close = QtGui.QPushButton(self.centralWidget) self.close.setGeometry(QtCore.QRect(460, 400, 85, 27)) self.close.setObjectName(_fromUtf8("close")) self.finish = QtGui.QPushButton(self.centralWidget) self.finish.setGeometry(QtCore.QRect(350, 400, 85, 27)) self.finish.setObjectName(_fromUtf8("finish")) self.retranslateUi(Audio) QtCore.QMetaObject.connectSlotsByName(Audio)
def moveCursor(self,start,end): # We retrieve the QTextCursor object from the parent's QTextEdit cursor = self.parent.text.textCursor() # Then we set the position to the beginning of the last match cursor.setPosition(start) # Next we move the Cursor by over the match and pass the KeepAnchor parameter # which will make the cursor select the the match's text cursor.movePosition(QtGui.QTextCursor.Right,QtGui.QTextCursor.KeepAnchor,end - start) # And finally we set this new cursor as the parent's self.parent.text.setTextCursor(cursor)
def initUI(self): self.text = QtGui.QTextEdit(self) # Set the tab stop width to around 33 pixels which is # more or less 8 spaces self.text.setTabStopWidth(33) self.initToolbar() self.initFormatbar() self.initMenubar() self.setCentralWidget(self.text) # Initialize a statusbar for the window self.statusbar = self.statusBar() # If the cursor position changes, call the function that displays # the line and column number self.text.cursorPositionChanged.connect(self.cursorPosition) # We need our own context menu for tables self.text.setContextMenuPolicy(Qt.CustomContextMenu) self.text.customContextMenuRequested.connect(self.context) self.text.textChanged.connect(self.changed) self.setGeometry(100,100,1030,800) self.setWindowTitle("Writer") self.setWindowIcon(QtGui.QIcon("icons/icon.png"))
def __init__ (self, errors, parent = None) : #super (ErrorsDialog, self).__init__ () super (ErrorsDialog, self).__init__ (parent) errors.reverse () self.parent = parent #print self.parent.current_file, self.parent.current_list self.setAttribute (QtCore.Qt.WA_DeleteOnClose) saveAction = QtGui.QAction('Save log...', self) saveAction.setShortcut('Ctrl+S') saveAction.setStatusTip('Save displayed log file.') saveAction.triggered.connect(self.saveFile) saveErrAction = QtGui.QAction('Save unprocessed list...', self) saveErrAction.setShortcut('Ctrl+U') saveErrAction.setStatusTip('Save a list of unprocessed raw files.') saveErrAction.triggered.connect(self.saveErrFile) closeAction = QtGui.QAction('Close', self) closeAction.setShortcut('Ctrl+Q') closeAction.setStatusTip('Close error display') closeAction.triggered.connect(self.close) menubar = self.menuBar() fileMenu = menubar.addMenu('&File') fileMenu.addAction(saveAction) fileMenu.addAction (saveErrAction) fileMenu.addAction(closeAction) self.text = QtGui.QTextEdit(self) self.setCentralWidget(self.text) self.setGeometry(300,300,800,300) self.setWindowTitle('Errors X') self.show() self.setIt (errors) self.whatsLeft ()
def __init__ (self, errors, parent = None) : super (ErrorsDialog, self).__init__ (parent) self.setAttribute (QtCore.Qt.WA_DeleteOnClose) saveAction = QtGui.QAction('Save', self) saveAction.setShortcut('Ctrl+S') saveAction.setStatusTip('Save current file') saveAction.triggered.connect(self.saveFile) closeAction = QtGui.QAction('Close', self) closeAction.setShortcut('Ctrl+Q') closeAction.setStatusTip('Close error display') closeAction.triggered.connect(self.close) menubar = self.menuBar() fileMenu = menubar.addMenu('&File') fileMenu.addAction(saveAction) fileMenu.addAction(closeAction) self.text = QtGui.QTextEdit(self) self.setCentralWidget(self.text) self.setGeometry(300,300,800,300) self.setWindowTitle('Errors') self.show() self.setIt (errors)
def __init__(self): QtGui.QWidget.__init__(self) self.resultsLayout= QtGui.QVBoxLayout(self) self.setGeometry(100, 100, 500, 500) self.Workdir= os.getcwd() #the title of the results summary self.Title=QtGui.QLabel(self) self.Title.setText('Summary of the results') self.resultSummary= QtGui.QTextEdit() self.resultsLayout.addWidget(self.Title) self.resultsLayout.addWidget(self.resultSummary) self.setText()
def __init__(self, year, zone, solar_dir, wind_dir, tgt_dir, fmat, wrap, coords, return_code, output): super(RptDialog, self).__init__() self.parms = [str(year), str(zone), wrap, fmat, tgt_dir, solar_dir, wind_dir] if wrap == 'y': wrapy = 'Yes' else: wrapy = 'No' max_line = 0 self.lines = 'Parameters:\n Year: %s\n Wrap year: %s\n Time Zone: %s\n Output Format: %s\n' \ % (year, wrapy, zone, fmat) if fmat != 'srw': self.lines += ' Solar Files: %s\n' % solar_dir self.lines += ' Wind Files: %s\n' % wind_dir self.lines += ' Target Folder: %s\n' % tgt_dir if coords != '': self.lines += ' Coordinates: %s\n' % coords self.lines += 'Return Code:\n %s\n' % return_code self.lines += 'Output:\n' self.lines += output lenem = self.lines.split('\n') line_cnt = len(lenem) for i in range(line_cnt): max_line = max(max_line, len(lenem[i])) del lenem QtGui.QDialog.__init__(self) self.saveButton = QtGui.QPushButton(self.tr('&Save')) self.cancelButton = QtGui.QPushButton(self.tr('Cancel')) buttonLayout = QtGui.QHBoxLayout() buttonLayout.addStretch(1) buttonLayout.addWidget(self.saveButton) buttonLayout.addWidget(self.cancelButton) self.connect(self.saveButton, QtCore.SIGNAL('clicked()'), self, QtCore.SLOT('accept()')) self.connect(self.cancelButton, QtCore.SIGNAL('clicked()'), self, QtCore.SLOT('reject()')) self.widget = QtGui.QTextEdit() self.widget.setFont(QtGui.QFont('Courier New', 11)) fnt = self.widget.fontMetrics() ln = (max_line + 5) * fnt.maxWidth() ln2 = (line_cnt + 2) * fnt.height() screen = QtGui.QDesktopWidget().availableGeometry() if ln > screen.width() * .67: ln = int(screen.width() * .67) if ln2 > screen.height() * .67: ln2 = int(screen.height() * .67) self.widget.setSizePolicy(QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)) self.widget.resize(ln, ln2) self.widget.setPlainText(self.lines) layout = QtGui.QVBoxLayout() layout.addWidget(self.widget) layout.addLayout(buttonLayout) self.setLayout(layout) self.setWindowTitle('SIREN - Output from makeweather2') size = self.geometry() self.setGeometry(1, 1, ln + 10, ln2 + 35) size = self.geometry() self.move((screen.width() - size.width()) / 2, (screen.height() - size.height()) / 2) self.widget.show()
def __init__(self, year, zone, src_dir, tgt_dir, fmat, coords, return_code, output): super(RptDialog, self).__init__() self.parms = [str(year), str(zone), fmat, tgt_dir, src_dir] max_line = 0 self.lines = 'Parameters:\n Year: %s\n Time Zone: %s\n Input Format: %s\n' % \ (year, zone, fmat) self.lines += ' Rainfall Files: %s\n' % src_dir self.lines += ' Target Folder: %s\n' % tgt_dir if coords != '': self.lines += ' Coordinates: %s\n' % coords self.lines += 'Return Code:\n %s\n' % return_code self.lines += 'Output:\n' self.lines += output lenem = self.lines.split('\n') line_cnt = len(lenem) for i in range(line_cnt): max_line = max(max_line, len(lenem[i])) del lenem QtGui.QDialog.__init__(self) self.saveButton = QtGui.QPushButton(self.tr('&Save')) self.cancelButton = QtGui.QPushButton(self.tr('Cancel')) buttonLayout = QtGui.QHBoxLayout() buttonLayout.addStretch(1) buttonLayout.addWidget(self.saveButton) buttonLayout.addWidget(self.cancelButton) self.connect(self.saveButton, QtCore.SIGNAL('clicked()'), self, QtCore.SLOT('accept()')) self.connect(self.cancelButton, QtCore.SIGNAL('clicked()'), self, QtCore.SLOT('reject()')) self.widget = QtGui.QTextEdit() self.widget.setFont(QtGui.QFont('Courier New', 11)) fnt = self.widget.fontMetrics() ln = (max_line + 5) * fnt.maxWidth() ln2 = (line_cnt + 2) * fnt.height() screen = QtGui.QDesktopWidget().availableGeometry() if ln > screen.width() * .67: ln = int(screen.width() * .67) if ln2 > screen.height() * .67: ln2 = int(screen.height() * .67) self.widget.setSizePolicy(QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)) self.widget.resize(ln, ln2) self.widget.setPlainText(self.lines) layout = QtGui.QVBoxLayout() layout.addWidget(self.widget) layout.addLayout(buttonLayout) self.setLayout(layout) self.setWindowTitle('SIREN - Output from makerainfall2') size = self.geometry() self.setGeometry(1, 1, ln + 10, ln2 + 35) size = self.geometry() self.move((screen.width() - size.width()) / 2, (screen.height() - size.height()) / 2) self.widget.show()
def initUI(self): fields = [] label = [] self.edit = [] self.field_type = [] metrics = [] widths = [0, 0] heights = 0 i = -1 grid = QtGui.QGridLayout() self.web = QtGui.QTextEdit() if os.path.exists(self.anobject): htf = open(self.anobject, 'r') html = htf.read() htf.close() self.web.setHtml(QtCore.QString(html)) else: html = self.anobject if self.anobject[:5] == '<html': self.anobject = self.anobject.replace('[VERSION]', credits.fileVersion()) self.web.setHtml(QtCore.QString(self.anobject)) else: self.web.setPlainText(QtCore.QString(self.anobject)) metrics.append(self.web.fontMetrics()) try: widths[0] = metrics[0].boundingRect(self.web.text()).width() heights = metrics[0].boundingRect(self.web.text()).height() except: bits = html.split('\n') for lin in bits: if len(lin) > widths[0]: widths[0] = len(lin) heights = len(bits) fnt = self.web.fontMetrics() widths[0] = (widths[0]) * fnt.maxWidth() heights = (heights) * fnt.height() screen = QtGui.QDesktopWidget().availableGeometry() if widths[0] > screen.width() * .67: heights = int(heights / .67) widths[0] = int(screen.width() * .67) self.web.setReadOnly(True) i = 1 grid.addWidget(self.web, 0, 0) self.set_stuff(grid, widths, heights, i) QtGui.QShortcut(QtGui.QKeySequence('q'), self, self.quitClicked)
def __init__(self, year, zone, solar_dir, wind_dir, tgt_dir, fmat, wrap, coords, return_code, output): super(RptDialog, self).__init__() self.parms = [str(year), str(zone), wrap, fmat, tgt_dir, solar_dir, wind_dir] if wrap == 'y': wrapy = 'Yes' else: wrapy = 'No' max_line = 0 self.lines = 'Parameters:\n Year: %s\n Wrap year: %s\n Time Zone: %s\n Output Format: %s\n' \ % (year, wrapy, zone, fmat) if fmat != 'srw': self.lines += ' Solar Files: %s\n' % solar_dir self.lines += ' Wind Files: %s\n' % wind_dir self.lines += ' Target Folder: %s\n' % tgt_dir if coords != '': self.lines += ' Coordinates: %s\n' % coords self.lines += 'Return Code:\n %s\n' % return_code self.lines += 'Output:\n' self.lines += output lenem = self.lines.split('\n') line_cnt = len(lenem) for i in range(line_cnt): max_line = max(max_line, len(lenem[i])) del lenem QtGui.QDialog.__init__(self) self.saveButton = QtGui.QPushButton(self.tr('&Save')) self.cancelButton = QtGui.QPushButton(self.tr('Cancel')) buttonLayout = QtGui.QHBoxLayout() buttonLayout.addStretch(1) buttonLayout.addWidget(self.saveButton) buttonLayout.addWidget(self.cancelButton) self.connect(self.saveButton, QtCore.SIGNAL('clicked()'), self, QtCore.SLOT('accept()')) self.connect(self.cancelButton, QtCore.SIGNAL('clicked()'), self, QtCore.SLOT('reject()')) self.widget = QtGui.QTextEdit() self.widget.setFont(QtGui.QFont('Courier New', 11)) fnt = self.widget.fontMetrics() ln = (max_line + 5) * fnt.maxWidth() ln2 = (line_cnt + 2) * fnt.height() screen = QtGui.QDesktopWidget().availableGeometry() if ln > screen.width() * .67: ln = int(screen.width() * .67) if ln2 > screen.height() * .67: ln2 = int(screen.height() * .67) self.widget.setSizePolicy(QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)) self.widget.resize(ln, ln2) self.widget.setPlainText(self.lines) layout = QtGui.QVBoxLayout() layout.addWidget(self.widget) layout.addLayout(buttonLayout) self.setLayout(layout) self.setWindowTitle('makeweatherfiles - Output') size = self.geometry() self.setGeometry(1, 1, ln + 10, ln2 + 35) size = self.geometry() self.move((screen.width() - size.width()) / 2, (screen.height() - size.height()) / 2) self.widget.show()
def setupUi(self, Form): Form.setObjectName(_fromUtf8("Form")) Form.resize(898,700) self.gridLayout = QtGui.QGridLayout(Form) self.gridLayout.setObjectName(_fromUtf8("gridLayout")) self.baidu=QtGui.QRadioButton(Form) self.baidu.setObjectName(_fromUtf8("baidu")) self.qihu=QtGui.QRadioButton(Form) self.qihu.setObjectName(_fromUtf8("qihu")) self.sousou=QtGui.QRadioButton(Form) self.sousou.setObjectName(_fromUtf8("sousou")) self.shenma=QtGui.QRadioButton(Form) self.shenma.setObjectName(_fromUtf8("shenma")) self.isMobile=QtGui.QCheckBox(_fromUtf8("mobile")) self.isMobile.setObjectName(_fromUtf8("mobile")) self.l_se=QtGui.QLabel(Form) self.l_se.setObjectName(_fromUtf8("label_0")) self.gridLayout.addWidget(self.l_se,0,0,1,1) self.gridLayout.addWidget(self.baidu, 0, 1, 1, 1) self.gridLayout.addWidget(self.qihu, 0, 2, 1, 1) self.gridLayout.addWidget(self.sousou, 0, 3, 1, 1) self.gridLayout.addWidget(self.shenma, 0, 4, 1, 1) self.gridLayout.addWidget(self.isMobile,0,6,1,1) self.textEdit_2 = QtGui.QTextEdit(Form) self.textEdit_2.setObjectName(_fromUtf8("textEdit_2")) self.gridLayout.addWidget(self.textEdit_2, 2, 3, 1, 3) self.textEdit = QtGui.QTextEdit(Form) self.textEdit.setObjectName(_fromUtf8("textEdit")) self.gridLayout.addWidget(self.textEdit, 2, 0, 1, 3) self.tableView = QtGui.QTableWidget(Form) self.tableView.setObjectName(_fromUtf8("tableView")) self.tableView.setColumnCount(3) self.tableView.setColumnWidth(0,150) self.tableView.setHorizontalHeaderLabels([u"???",u"??",u"??"]) self.gridLayout.addWidget(self.tableView, 2, 6, 1, 1) self.label_3 = QtGui.QLabel(Form) self.label_3.setObjectName(_fromUtf8("label_3")) self.gridLayout.addWidget(self.label_3, 1, 6, 1, 1) self.label = QtGui.QLabel(Form) self.label.setObjectName(_fromUtf8("label")) self.gridLayout.addWidget(self.label, 1, 3, 1, 2) self.label_2 = QtGui.QLabel(Form) self.label_2.setObjectName(_fromUtf8("label_2")) self.gridLayout.addWidget(self.label_2, 1, 0, 1, 2) self.pushButton = QtGui.QPushButton(Form) self.pushButton.setObjectName(_fromUtf8("pushButton")) self.gridLayout.addWidget(self.pushButton, 3, 2, 1, 1) self.pushButton_2 = QtGui.QPushButton(Form) self.pushButton_2.setObjectName(_fromUtf8("pushButton_2")) self.gridLayout.addWidget(self.pushButton_2, 3, 3, 1, 1) self.pushButton_3 = QtGui.QPushButton(Form) self.pushButton_3.setObjectName(_fromUtf8("pushButton_3")) self.gridLayout.addWidget(self.pushButton_3, 3, 6, 1, 1) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form)
def __init__(self,geometry,parent): super(gmshFileEditor,self).__init__(parent) self.geometry=geometry #Bookkeeping self.currFn=None #Buttons self.btnDone=QtGui.QPushButton('Done') self.btnDone.connect(self.btnDone, QtCore.SIGNAL('clicked()'), self.donePressed) self.btnNew=QtGui.QPushButton('New') self.btnNew.connect(self.btnNew, QtCore.SIGNAL('clicked()'), self.newFile) self.btnOpen=QtGui.QPushButton('Open') self.btnOpen.connect(self.btnOpen, QtCore.SIGNAL('clicked()'), self.openFile) self.btnSave=QtGui.QPushButton('Save') self.btnSave.connect(self.btnSave, QtCore.SIGNAL('clicked()'), self.saveFile) self.btnSaveAs=QtGui.QPushButton('Save As') self.btnSaveAs.connect(self.btnSaveAs, QtCore.SIGNAL('clicked()'), self.saveFileAs) self.btnUse=QtGui.QPushButton('Use for geometry') self.btnUse.connect(self.btnUse, QtCore.SIGNAL('clicked()'), self.useForGeometry) #QTextEdit self.editor = QtGui.QTextEdit() #QHighLight self.highlighter=gmshHighlighter(self.editor,'Classic') #Layout self.hbox = QtGui.QHBoxLayout() self.hbox.addWidget(self.btnNew) self.hbox.addWidget(self.btnOpen) self.hbox.addWidget(self.btnSave) self.hbox.addWidget(self.btnSaveAs) self.hbox.addWidget(self.btnSaveAs) self.hbox.addWidget(self.btnUse) self.hbox.addWidget(self.btnDone) self.vbox = QtGui.QVBoxLayout() self.vbox.addWidget(self.editor) self.vbox.addLayout(self.hbox) self.setLayout(self.vbox) self.setWindowTitle('Edit Geometry File ') self.loadGeoFile() self.resize(700,500) self.show()
def initComponentsUI(self): # Wrapping options: #QtGui.QTextEdit.NoWrap, WidgetWidth, FixedPixelWidth, FixedColumnWidth # UI widget that will display the output of the input file self.fileDisplayUI = QtGui.QTextEdit('Drop a file here or use the command line') self.fileDisplayUI.setReadOnly(True) self.fileDisplayUI.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) self.fileDisplayUI.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) p = self.fileDisplayUI.palette() p.setColor(QtGui.QPalette.Base, QtGui.QColor(39, 40, 34)) p.setColor(QtGui.QPalette.Text, QtGui.QColor(255, 255, 255)) self.fileDisplayUI.setPalette(p) #self.fileDisplayUI.verticalScrollBar().valueChanged.connect(self.fileDisplayUI_BufferScroll) self.fileDisplayUI.installEventFilter(self) self.upperSplitter.addWidget(self.fileDisplayUI) # UI Widget that the user types filters into, the enter key adds the filter self.filterInputUI = QtGui.QLineEdit() self.filterInputUI.setFixedHeight(25) self.filterInputUI.setPlaceholderText('Enter filters here') p = self.filterInputUI.palette() p.setColor(QtGui.QPalette.Base, QtGui.QColor(200, 200, 200)) p.setColor(QtGui.QPalette.Text, QtGui.QColor(0, 0, 0)) self.filterInputUI.setPalette(p) self.filterInputUI.returnPressed.connect(self.filterDisplayUI_addNewFilter) self.lowerSplitter.addWidget(self.filterInputUI) # UI Widget that displays currently enabled filters self.filterDisplayUI = QtGui.QListWidget() self.filterDisplayUI.mousePressEvent = self.filterDisplayUI_mousePressedEvent self.filterDisplayUI.mouseDoubleClickEvent = self.filterDisplayUI_mouseDoubleClickEvent self.filterDisplayUI.keyPressEvent = self.filterDisplayUI_keyPressEvent # self.filterDisplayUI.setFocusPolicy(QtCore.Qt.NoFocus) p = self.filterDisplayUI.palette() p.setColor(QtGui.QPalette.Base, QtGui.QColor(39, 40, 34)) p.setColor(QtGui.QPalette.Text, QtGui.QColor(255, 255, 255)) p.setColor(QtGui.QPalette.Highlight, QtGui.QColor(49, 50, 46)) self.filterDisplayUI.setPalette(p) self.filterDisplayUI.installEventFilter(self) self.upperSplitter.addWidget(self.filterDisplayUI) self.upperSplitter.setSizes([1000, 100])
def __init__(self): super(PublishingView, self).__init__(QtCore.Qt.Horizontal) f = open('conf/chessfonts.yaml', 'r') self.config = yaml.load(f) f.close() for family in self.config['diagram-fonts']: self.config['config'][family]['fontinfo'] = self.loadFontInfo( self.config['config'][family]['glyphs-tab']) self.richText = QtGui.QTextEdit() self.richText.setReadOnly(True) w = QtGui.QWidget() vbox = QtGui.QVBoxLayout() self.labelDiaFont = QtGui.QLabel() vbox.addWidget(self.labelDiaFont) self.diaFontSelect = QtGui.QComboBox() self.diaFontSelect.addItems( [self.config['config'][x]['display-name'] for x in self.config['diagram-fonts']]) self.diaFontSelect.setCurrentIndex( self.config['diagram-fonts'].index(self.config['defaults']['diagram'])) vbox.addWidget(self.diaFontSelect) self.labelSolFont = QtGui.QLabel() vbox.addWidget(self.labelSolFont) self.solFontSelect = QtGui.QComboBox() self.solFontSelect.addItems( [self.config['config'][x]['display-name'] for x in self.config['inline-fonts']]) self.solFontSelect.setCurrentIndex( self.config['inline-fonts'].index(self.config['defaults']['inline'])) vbox.addWidget(self.solFontSelect) self.labelMemo = QtGui.QLabel() vbox.addWidget(self.labelMemo) vbox.addStretch(1) w.setLayout(vbox) self.addWidget(self.richText) self.addWidget(w) self.setStretchFactor(0, 1) self.diaFontSelect.currentIndexChanged.connect(self.onModelChanged) self.solFontSelect.currentIndexChanged.connect(self.onModelChanged) Mainframe.sigWrapper.sigModelChanged.connect(self.onModelChanged) Mainframe.sigWrapper.sigLangChanged.connect(self.onLangChanged) self.onLangChanged()
def setupUi(self, Form): Form.setObjectName(_fromUtf8("Form")) Form.resize(800, 600) self.label = QtGui.QLabel(Form) self.label.setGeometry(QtCore.QRect(170, 310, 50, 14)) self.label.setStyleSheet(_fromUtf8("color: rgb(0, 0, 49);")) self.label.setObjectName(_fromUtf8("label")) #self.q = 0 #self.finish_para = 0 #Add progress bar self.progressBar = QtGui.QProgressBar(Form) self.progressBar.setGeometry(QtCore.QRect(680, 0, 121, 23)) self.progressBar.setMinimumSize(QtCore.QSize(118, 23)) self.progressBar.setStyleSheet(_fromUtf8("color: rgb(0, 0, 50);")) self.progressBar.setObjectName(_fromUtf8("progressBar")) self.progressBar.setProperty("value", 0) self.progressBar.setMinimum(0) self.progressBar.setMaximum(5) #Add text box self.timeToStart = QtGui.QTextEdit(Form) self.timeToStart.setGeometry(QtCore.QRect(80, 40, 111, 31)) self.timeToStart.setObjectName(_fromUtf8("timeToStart")) self.timeToStart.setReadOnly(True) self.timeToStart.setText(" Start in ") # Add show text paragraph self.showPara = QtGui.QTextEdit(Form) self.showPara.setGeometry(QtCore.QRect(170, 130, 581, 161)) self.showPara.setObjectName(_fromUtf8("showPara")) self.showPara.setReadOnly(True) # Add Edit text box self.editPara = QtGui.QTextEdit(Form) self.editPara.setGeometry(QtCore.QRect(170, 325, 581, 161)) self.editPara.setObjectName(_fromUtf8("editPara")) self.editPara.setReadOnly(True) #if self.finish_para == 0: #self.editPara.textChanged.connect(self.text_changed) self.label_2 = QtGui.QLabel(Form) self.label_2.setGeometry(QtCore.QRect(170, 110, 81, 16)) self.label_2.setStyleSheet(_fromUtf8("color: rgb(0, 0, 49);")) self.label_2.setObjectName(_fromUtf8("label_2")) # add Ok button self.finish = QtGui.QPushButton(Form) self.finish.setGeometry(QtCore.QRect(670, 530, 51, 27)) self.finish.setStyleSheet(_fromUtf8("color: rgb(0, 0, 49);")) self.finish.setObjectName(_fromUtf8("finish")) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form)
def setupUi(self, Form): Form.setObjectName(_fromUtf8("Form")) Form.resize(800, 600) self.label = QtGui.QLabel(Form) self.label.setGeometry(QtCore.QRect(170, 310, 50, 14)) self.label.setStyleSheet(_fromUtf8("color: rgb(0, 0, 49);")) self.label.setObjectName(_fromUtf8("label")) #self.q = 0 #self.finish_para = 0 #Add progress bar self.progressBar = QtGui.QProgressBar(Form) self.progressBar.setGeometry(QtCore.QRect(680, 0, 121, 23)) self.progressBar.setMinimumSize(QtCore.QSize(118, 23)) self.progressBar.setStyleSheet(_fromUtf8("color: rgb(0, 0, 50);")) self.progressBar.setObjectName(_fromUtf8("progressBar")) self.progressBar.setProperty("value", 0) self.progressBar.setMinimum(0) self.progressBar.setMaximum(5) #Add text box self.timeToStart = QtGui.QTextEdit(Form) self.timeToStart.setGeometry(QtCore.QRect(80, 40, 111, 31)) self.timeToStart.setObjectName(_fromUtf8("timeToStart")) self.timeToStart.setReadOnly(True) self.timeToStart.setText(" Start in ") # Add show text paragraph self.showPara = QtGui.QTextEdit(Form) self.showPara.setGeometry(QtCore.QRect(170, 130, 581, 161)) self.showPara.setObjectName(_fromUtf8("showPara")) self.showPara.setReadOnly(True) # Add Edit text box self.editPara = QtGui.QTextEdit(Form) self.editPara.setGeometry(QtCore.QRect(170, 325, 581, 161)) self.editPara.setObjectName(_fromUtf8("editPara")) self.editPara.setReadOnly(True) #if self.finish_para == 0: #self.editPara.textChanged.connect(self.text_changed) self.label_2 = QtGui.QLabel(Form) self.label_2.setGeometry(QtCore.QRect(170, 110, 81, 16)) self.label_2.setStyleSheet(_fromUtf8("color: rgb(0, 0, 49);")) self.label_2.setObjectName(_fromUtf8("label_2")) # add Ok button self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form)