我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用PyQt4.QtGui.QDialog()。
def setupWin(self): super(self.__class__,self).setupWin() self.setGeometry(500, 300, 250, 110) # self.resize(250,250) #------------------------------ # template list: for frameless or always on top option #------------------------------ # - template : keep ui always on top of all; # While in Maya, dont set Maya as its parent ''' self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) ''' # - template: hide ui border frame; # While in Maya, use QDialog instead, as QMainWindow will make it disappear ''' self.setWindowFlags(QtCore.Qt.FramelessWindowHint) ''' # - template: best solution for Maya QDialog without parent, for always on-Top frameless ui ''' self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.WindowStaysOnTopHint) ''' # - template: for transparent and non-regular shape ui # note: use it if you set main ui to transparent, and want to use alpha png as irregular shape window # note: black color better than white for better look of semi trans edge, like pre-mutiply ''' self.setAttribute(QtCore.Qt.WA_TranslucentBackground) self.setStyleSheet("background-color: rgba(0, 0, 0,0);") '''
def __init__(self, parent_object, keyboard_type='default'): QtGui.QDialog.__init__(self) self.setWindowFlags(QtCore.Qt.Tool | QtCore.Qt.WindowStaysOnTopHint | QtCore.Qt.FramelessWindowHint) self.INPUT_WIDGET = None self.PARENT_OBJECT = parent_object self.signalMapper = QtCore.QSignalMapper(self) self.NO_ORD_KEY_LIST = list() self.NO_ORD_KEY_LIST.append(QtCore.Qt.Key_Left) self.NO_ORD_KEY_LIST.append(QtCore.Qt.Key_Up) self.NO_ORD_KEY_LIST.append(QtCore.Qt.Key_Right) self.NO_ORD_KEY_LIST.append(QtCore.Qt.Key_Down) self.NO_ORD_KEY_LIST.append(QtCore.Qt.Key_Backspace) self.NO_ORD_KEY_LIST.append(QtCore.Qt.Key_Enter) self.NO_ORD_KEY_LIST.append(QtCore.Qt.Key_Tab) self.NO_ORD_KEY_LIST.append(QtCore.Qt.Key_Escape) self.do_layout(keyboard_type) self.signalMapper.mapped[int].connect(self.buttonClicked)
def accept( self ): QtGui.QDialog.accept(self) self.autoSaveOnLow = self.cbxSaveOnLowConfidence.isChecked() self.dontUseYear = self.cbxDontUseYear.isChecked() self.assumeIssueOne = self.cbxAssumeIssueOne.isChecked() self.ignoreLeadingDigitsInFilename = self.cbxIgnoreLeadingDigitsInFilename.isChecked() self.removeAfterSuccess = self.cbxRemoveAfterSuccess.isChecked() self.nameLengthMatchTolerance = int(self.leNameLengthMatchTolerance.text()) self.waitAndRetryOnRateLimit = self.cbxWaitForRateLimit.isChecked() #persist some settings self.settings.save_on_low_confidence = self.autoSaveOnLow self.settings.dont_use_year_when_identifying = self.dontUseYear self.settings.assume_1_if_no_issue_num = self.assumeIssueOne self.settings.ignore_leading_numbers_in_filename = self.ignoreLeadingDigitsInFilename self.settings.remove_archive_after_successful_match = self.removeAfterSuccess self.settings.wait_and_retry_on_rate_limit = self.waitAndRetryOnRateLimit if self.cbxSpecifySearchString.isChecked(): self.searchString = unicode(self.leSearchString.text()) if len(self.searchString) == 0: self.searchString = None
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, chatType, selector, chatEntries, knownPlayerNames): QtGui.QDialog.__init__(self, parent) uic.loadUi(resourcePath("vi/ui/SystemChat.ui"), self) self.parent = parent self.chatType = 0 self.selector = selector self.chatEntries = [] for entry in chatEntries: self.addChatEntry(entry) titleName = "" if self.chatType == SystemChat.SYSTEM: titleName = self.selector.name self.system = selector for name in knownPlayerNames: self.playerNamesBox.addItem(name) self.setWindowTitle("Chat for {0}".format(titleName)) self.connect(self.closeButton, SIGNAL("clicked()"), self.closeDialog) self.connect(self.alarmButton, SIGNAL("clicked()"), self.setSystemAlarm) self.connect(self.clearButton, SIGNAL("clicked()"), self.setSystemClear) self.connect(self.locationButton, SIGNAL("clicked()"), self.locationSet)
def __init__(self, iface, function, parameters=None): QDialog.__init__(self) self.iface = iface self.setupUi(self) self.path = standard_path() self.model = None self.function = function if 'alpha' in parameters: self.alpha_box.setPlainText(str(parameters['alpha'])) if 'beta' in parameters: self.beta_box.setPlainText(str(parameters['beta'])) if function.upper() == 'EXPO': self.alpha_box.setEnabled(False) self.alpha_box.setPlainText('') if function.upper() == 'POWER': self.beta_box.setEnabled(False) self.beta_box.setPlainText('') # For adding skims self.but_done.clicked.connect(self.return_model)
def __init__(self, iface): QtGui.QDialog.__init__(self) self.iface = iface self.setupUi(self) # The whole software is prepared to deal with all geometry types, but it has only been tested to work with # polygons, so I am turning the other layer types off # self.valid_layer_types = point_types + line_types + poly_types + multi_poly + multi_line + multi_point self.valid_layer_types = poly_types + multi_poly self.fromlayer.currentIndexChanged.connect(partial(self.reload_fields, 'from')) self.tolayer.currentIndexChanged.connect(partial(self.reload_fields, 'to')) self.OK.clicked.connect(self.run) # We load the node and area layers existing in our canvas for layer in qgis.utils.iface.mapCanvas().layers(): # We iterate through all layers if 'wkbType' in dir(layer): if layer.wkbType() in self.valid_layer_types: self.fromlayer.addItem(layer.name()) self.tolayer.addItem(layer.name())
def __init__(self, iface): QtGui.QDialog.__init__(self) self.iface = iface self.setupUi(self) self.valid_layer_types = point_types + line_types + poly_types self.fromtype = None self.frommatchingtype = None QObject.connect(self.fromlayer, SIGNAL("currentIndexChanged(QString)"), self.set_from_fields) QObject.connect(self.tolayer, SIGNAL("currentIndexChanged(QString)"), self.set_to_fields) QObject.connect(self.fromfield, SIGNAL("currentIndexChanged(QString)"), self.reload_fields) QObject.connect(self.matchingfrom, SIGNAL("currentIndexChanged(QString)"), self.reload_fields_matching) QObject.connect(self.needsmatching, SIGNAL("stateChanged(int)"), self.works_field_matching) self.OK.clicked.connect(self.run) # We load the node and area layers existing in our canvas for layer in qgis.utils.iface.mapCanvas().layers(): # We iterate through all layers if 'wkbType' in dir(layer): if layer.wkbType() in self.valid_layer_types: self.fromlayer.addItem(layer.name()) self.tolayer.addItem(layer.name()) self.works_field_matching()
def __init__(self, iface): QDialog.__init__(self) QtGui.QDialog.__init__(self, None, QtCore.Qt.WindowStaysOnTopHint) self.iface = iface self.setupUi(self) self.field_types = {} self.centroids = None self.node_layer = None self.line_layer = None self.node_keys = None self.node_fields = None self.index = None self.matrix = None self.clickTool = PointTool(self.iface.mapCanvas()) self.path = standard_path() self.node_id = None self.res = PathResults() self.link_features = None self.do_dist_matrix.setEnabled(False) self.load_graph_from_file.clicked.connect(self.prepare_graph_and_network) self.from_but.clicked.connect(self.search_for_point_from) self.to_but.clicked.connect(self.search_for_point_to) self.do_dist_matrix.clicked.connect(self.produces_path)
def get_code(url, size=(640, 480), title="Google authentication"): """Open a QT webkit window and return the access code.""" app = QtGui.QApplication([]) dialog = QtGui.QDialog() dialog.setWindowTitle(title) dialog.resize(*size) webview = QtWebKit.QWebView() webpage = QtWebKit.QWebPage() webview.setPage(webpage) webpage.loadFinished.connect(lambda: _on_qt_page_load_finished(dialog, webview)) webview.setUrl(QtCore.QUrl.fromEncoded(url)) layout = QtGui.QGridLayout() layout.addWidget(webview) dialog.setLayout(layout) dialog.authorization_code = None dialog.show() app.exec_() return dialog.authorization_code
def save(self): cache_dir = self.IDC_leCacheDir.text() if self.util.check_dir(cache_dir) is False: self.util.dlg_warning( self.util.tr(u'py_dlg_set_warn_cache_not_use').format(self.settings.cache_dir) ) return # check URL - must not be empty api_url = self.IDC_leCkanApi.text() if self.util.check_api_url(api_url) is False: self.util.dlg_warning(self.util.tr(u'py_dlg_set_warn_ckan_url')) return self.settings.cache_dir = cache_dir self.settings.ckan_url = api_url self.settings.save() QDialog.accept(self)
def tblRule_itemDoubleClicked(self): ind = self.tblRule.currentRow() if ind>=0: formrule = FormRule() formrule.chkEnabled.setChecked(self.tblRule.item(ind, 0).text() == "True") if self.tblRule.item(ind, 1).text() == "Replace": formrule.optReplace.setChecked(True) else: formrule.optIgnore.setChecked(True) formrule.txtReplace.setEnabled(False) formrule.txtMatch.setText(self.tblRule.item(ind, 2).text()) formrule.txtReplace.setText(self.tblRule.item(ind, 3).text()) if QtGui.QDialog.Rejected == formrule.exec_(): return self.tblRule.item(ind, 0).setText(str(formrule.chkEnabled.isChecked())) if formrule.optReplace.isChecked(): self.tblRule.item(ind, 1).setText("Replace") self.tblRule.item(ind, 3).setText(formrule.txtReplace.text()) else: self.tblRule.item(ind, 1).setText("Ignore") self.tblRule.item(ind, 3).setText("") self.tblRule.item(ind, 2).setText(formrule.txtMatch.text()) parseRule() else: QtGui.QMessageBox.information(self, "Info", "Please select a row!")
def btnAddRule_clicked(self): formrule = FormRule() if QtGui.QDialog.Rejected == formrule.exec_(): return ind = self.tblRule.rowCount() self.tblRule.insertRow(ind) self.tblRule.setItem(ind, 0, QtGui.QTableWidgetItem(str(formrule.chkEnabled.isChecked()))) if formrule.optReplace.isChecked(): self.tblRule.setItem(ind, 1, QtGui.QTableWidgetItem("Replace")) self.tblRule.setItem(ind, 3, QtGui.QTableWidgetItem(formrule.txtReplace.text())) else: self.tblRule.setItem(ind, 1, QtGui.QTableWidgetItem("Ignore")) self.tblRule.setItem(ind, 3, QtGui.QTableWidgetItem("")) self.tblRule.setItem(ind, 2, QtGui.QTableWidgetItem(formrule.txtMatch.text())) parseRule() #Widgets events - Capturing tab
def Options(self): dlg = QtGui.QDialog() qdlg = Ui_ConfigDialog() qdlg.setupUi(dlg) qdlg.parent = self dlg.show() dlg.exec_() try: self.thread.midi_input, self.thread.midi_output = MIDI_GetInOut() self.thread.kb_channel = self.input_channel self.thread.midi_channel = self.midi_channel self.thread.num_steps = self.num_banks*16 except: pass self.curBank.setMaximum(self.num_banks-1) self.curSeq.setMaximum(self.num_seqs-1) seq = self.GetSequencer() seq.num_banks = self.num_banks seq.num_seqs = self.num_seqs seq.Resize(self.num_banks) seq.midi_channel = self.midi_channel
def Options(self): dlg = QtGui.QDialog() qdlg = Ui_ConfigDialog() qdlg.setupUi(dlg) qdlg.parent = self dlg.show() dlg.exec_() self.thread.midi_input, self.thread.midi_output = MIDI_GetInOut() self.thread.kb_channel = self.input_channel self.thread.midi_channel = self.midi_channel self.thread.num_steps = self.num_banks*16 self.curBank.setMaximum(self.num_banks-1) self.curSeq.setMaximum(self.num_seqs-1) seq = self.GetSequencer() seq.num_banks = self.num_banks seq.num_seqs = self.num_seqs seq.Resize(self.num_banks) seq.midi_channel = self.midi_channel
def exec_(self, sound): self.summary_widget.setSoundData(sound.data) self.editor_chk.setChecked(True) self.store_chk.setChecked(False) self.bank_combo.addItems([uppercase[b] for b in range(self.main.blofeld_library.banks)]) self.dump_sound_lbl.setText(sound.name) if not None in self.main.blofeld_current: bank, prog = self.main.blofeld_current self.bank_combo.setCurrentIndex(bank) self.prog_spin.setValue(prog+1) res = QtGui.QDialog.exec_(self) if not res: return False return self.editor_chk.isChecked(), (self.bank_combo.currentIndex(), self.prog_spin.value()-1) if self.store_chk.isChecked() else False # def resizeEvent(self, event): # self.setFixedSize(self.size())
def __init__(self, main, parent): QtGui.QDialog.__init__(self, parent) load_ui(self, 'dialogs/summary.ui') self.main = main dump_btn = QtGui.QPushButton('Dump') dump_btn.clicked.connect(self.sound_dump) dump_btn.setIcon(self.style().standardIcon(QtGui.QStyle.SP_ArrowRight)) self.buttonBox.addButton(dump_btn, QtGui.QDialogButtonBox.ActionRole) dial_icon = QtGui.QIcon() dial_icon.addFile(local_path('dial_icon.png')) edit_btn = QtGui.QPushButton('Edit') edit_btn.clicked.connect(self.sound_edit) edit_btn.setIcon(dial_icon) self.buttonBox.addButton(edit_btn, QtGui.QDialogButtonBox.AcceptRole) self.bank_combo.addItems([uppercase[l] for l in range(8)]) self.import_btn.clicked.connect(self.open) self.buttonBox.button(QtGui.QDialogButtonBox.Discard).clicked.connect(self.reject) self.summary_widget.setFocus()
def __init__(self, main, parent): QtGui.QDialog.__init__(self, parent) load_ui(self, 'dialogs/update_info.ui') self.main = main self.info_text.document().setIndentWidth(20) self.css_base = ''' .version { font-size: xx-large; margin-left: .5em; font-weight: bold; } .release { margin-left: 1.5em; margin-top: .5em; } .content { margin-left: .3em; margin-top: .8em; margin-bottom: .8em; } '''
def __init__(self, main, *args, **kwargs): QtGui.QDialog.__init__(self, main, *args, **kwargs) load_ui(self, 'dialogs/wavetable_undo.ui') self.main = main self.undo = self.main.undo self.undo_model = QtGui.QStandardItemModel() self.undo_list.setModel(self.undo_model) original = QtGui.QStandardItem('Initial state') setBoldItalic(original, True, False) self.undo_model.appendRow(original) self.undo.updated.connect(self.update) self.undo.indexChanged.connect(self.indexChanged) self.undo_list.doubleClicked.connect(self.do_action) self.undo_btn.clicked.connect(lambda: self.undo.setIndex(0)) self.redo_btn.clicked.connect(lambda: self.undo.setIndex(self.undo.count()))
def __init__(self, main): QtGui.QDialog.__init__(self, main) self.setModal(True) layout = QtGui.QGridLayout() self.setLayout(layout) icon = self.style().standardIcon(QtGui.QStyle.SP_MessageBoxWarning) icon_label = QtGui.QLabel(self) icon_label.setPixmap(icon.pixmap(32, 32)) layout.addWidget(icon_label, 0, 0, 2, 1) self.label = QtGui.QLabel() layout.addWidget(self.label, 0, 1, 1, 1) self.setWindowTitle('Wavetable dump') layout.addWidget(QtGui.QLabel('Please wait, and do not touch the Blofeld!'), 1, 1, 1, 1) self.slot = 80 self.name = 'MyWavetable001'
def __init__(self, parent=None, iface=None): """Constructor.""" QDialog.__init__(self, parent) # Set up the user interface from Designer. # After setupUI you can access any designer object by doing # self.<objectname>, and you can use autoconnect slots - see # http://qt-project.org/doc/qt-4.8/designer-using-a-ui-file.html # #widgets-and-dialogs-with-auto-connect self.parent = parent self.iface = iface self.setupUi(self) # Setting up progress window self.progress_dialog = QProgressDialog(self) self.progress_dialog.setAutoClose(False) title = self.tr('Progress') self.progress_dialog.setWindowTitle(title) self.restore_state() self.canvas = iface.mapCanvas()
def setupWin(self): self.setWindowTitle("TMP_UniversalToolUI_TND" + " - v" + self.version) self.setGeometry(300, 300, 800, 600) # win icon setup path = os.path.join(os.path.dirname(self.location),'icons','TMP_UniversalToolUI_TND.png') self.setWindowIcon(QtGui.QIcon(path)) # initial win drag position self.drag_position=QtGui.QCursor.pos() #self.resize(250,250) # - for frameless or always on top option #self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) # it will keep ui always on top of desktop, but to set this in Maya, dont set Maya as its parent #self.setWindowFlags(QtCore.Qt.FramelessWindowHint) # it will hide ui border frame, but in Maya, use QDialog instead as QMainWindow will disappear #self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.WindowStaysOnTopHint) # best for Maya case with QDialog without parent, for always top frameless ui # - for transparent and non-regular shape ui #self.setAttribute(QtCore.Qt.WA_TranslucentBackground) # use it if you set main ui to transparent and want to use alpha png as irregular shape window #self.setStyleSheet("background-color: rgba(0, 0, 0,0);") # black color better white color for get better look of semi trans edge, like pre-mutiply
def setupWin(self): self.setWindowTitle("UITranslator" + " - v" + self.version) self.setGeometry(300, 300, 300, 300) # win icon setup path = os.path.join(os.path.dirname(self.location),'icons','UITranslator.png') self.setWindowIcon(QtGui.QIcon(path)) # initial win drag position self.drag_position=QtGui.QCursor.pos() #self.resize(250,250) # - for frameless or always on top option #self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) # it will keep ui always on top of desktop, but to set this in Maya, dont set Maya as its parent #self.setWindowFlags(QtCore.Qt.FramelessWindowHint) # it will hide ui border frame, but in Maya, use QDialog instead as QMainWindow will disappear #self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.WindowStaysOnTopHint) # best for Maya case with QDialog without parent, for always top frameless ui # - for transparent and non-regular shape ui #self.setAttribute(QtCore.Qt.WA_TranslucentBackground) # use it if you set main ui to transparent and want to use alpha png as irregular shape window #self.setStyleSheet("background-color: rgba(0, 0, 0,0);") # black color better white color for get better look of semi trans edge, like pre-mutiply
def __init__(self, items, label=None , parent=None): # if using the Qt4Agg backend for matplotlib, the following line needs to be comment out # app=QtGui.QApplication(sys.argv) QtGui.QDialog.__init__(self) self.ui = Ui_selectorDialogForm() self.ui.setupUi(self) self.ui.listWidget.setSelectionMode(QtGui.QListWidget.MultiSelection) if label == None: self.setWindowTitle('ChiantiPy') else: self.setWindowTitle('ChiantiPy - '+label) imagefile = os.path.join(ChiantiPy.__path__[0], "images/chianti2.png") self.setWindowIcon(QtGui.QIcon(imagefile)) for anitem in items: # print ' item = ', anitem, QtCore.QString(anitem) self.ui.listWidget.addItem(str(anitem)) self.exec_()
def __init__(self, items, label=None , parent=None): # if using the Qt4Agg backend for matplotlib, the following line needs to be comment out # app=QtGui.QApplication(sys.argv) QtGui.QDialog.__init__(self) # app=QtGui.QApplication(sys.argv) self.ui = Ui_choice2DialogForm() self.ui.setupUi(self) if label == None: self.setWindowTitle('ChiantiPy') else: self.setWindowTitle('ChiantiPy - '+label) self.setWindowIcon(QtGui.QIcon('images/chianti2.png')) for anitem in items: # print ' item = ', anitem, QtCore.QString(anitem) self.ui.numListWidget.addItem(str(anitem)) self.ui.denListWidget.addItem(str(anitem)) self.exec_() #
def __init__(self,parent = None): QtGui.QDialog.__init__(self, parent) self.parent = parent self.formats = ["%A, %d. %B %Y %H:%M", "%A, %d. %B %Y", "%d. %B %Y %H:%M", "%d.%m.%Y %H:%M", "%d. %B %Y", "%d %m %Y", "%d.%m.%Y", "%x", "%X", "%H:%M"] self.initUI()
def __init__(self): QtGui.QDialog.__init__(self) self.ui = uic.loadUi("TDStoTDS3.ui", self) self.centerOnScreen() self.inputFile = "" self.outputFile = "" self.rtFileName = "" self.rtFileData = "" self.drFileName = "" self.drFileData = "" self.config = configparser.ConfigParser() self.config.read('TMV3.ini') self.tdsDate = 0 self.ui.BtnFileTDS.clicked.connect(self.loadTDS) self.ui.BtnFileRT.clicked.connect(self.loadRT) self.ui.BtnFileDR.clicked.connect(self.loadDR) self.ui.BtnOk.clicked.connect(self.onBtnOk) self.ui.BtnCancel.clicked.connect(self.onBtnCancel)
def __init__(self, model, title,parent=None): #global model QtGui.QDialog.__init__(self,parent) self.ui = uic.loadUi("Choose.ui", self) self.centerOnScreen() self.signals = Signal() self._config = configparser.ConfigParser() self._config.read('TMV3.ini') self.ret = False self.sel = [] self.selIdx = [] self.ui.setWindowTitle(title) self.ui.tableView.setModel(model) self.ui.BtnOk.clicked.connect(self.onBtnOk) self.ui.BtnCancel.clicked.connect(self.onBtnCancel) self.ui.tableView.doubleClicked.connect(self.onBtnOk) try: self.ui.show() except Exception as err: print(err)
def __init__(self): QtGui.QDialog.__init__(self) self.ui = uic.loadUi("TLMtoTLM3.ui", self) self.centerOnScreen() self.inputFile = "" self.outputFile = "" self.tkrNo = 0 self.tkrCount = 0 self.valueLists = [] self.config = configparser.ConfigParser() self.config.read('TMV3.ini') _ret = self.config['Antenna']['AntennaList'] self.saveFlag = True self.ticket = Ticket() self.signals = Signal() self.ui.BtnFile.clicked.connect(self.loadTLM) self.ui.BtnDel.clicked.connect(self.onBtnDel) self.ui.BtnSave.clicked.connect(self.onBtnSave) self.ui.BtnOk.clicked.connect(self.onBtnOk) self.ui.BtnCancel.clicked.connect(self.onBtnCancel) self.ui.tableWidget.cellChanged.connect(self.onTableTouch) pass
def __init__(self): QtGui.QDialog.__init__(self) self.ui = uic.loadUi("TLMtoTLM3.ui", self) self.centerOnScreen() self.inputFile = "" self.outputFile = "" self.tlmNo = 0 self.tlmCount = 0 self.valueLists = [] self.config = configparser.ConfigParser() self.config.read('TMV3.ini') _ret = self.config['Limit']['LimitList'] self.LimitList = _ret.split('\n') self.saveFlag = True self.ui.BtnFile.clicked.connect(self.loadTLM) self.ui.BtnDel.clicked.connect(self.onBtnDel) self.ui.BtnSave.clicked.connect(self.onBtnSave) self.ui.BtnOk.clicked.connect(self.onBtnOk) self.ui.BtnCancel.clicked.connect(self.onBtnCancel) self.ui.tableWidget.cellChanged.connect(self.onTableTouch) pass
def print_save(parent, typeStr, unitStr, defaultSize): """ this method to help PrintSaveDialog return values """ dialog = PrintSaveParaDialog(parent, typeStr, unitStr, defaultSize) result = dialog.exec_() if result==QtGui.QDialog.Rejected: return returnVal = dialog.getResult() if returnVal == None: returnVal = PrintSaveParaDialog.print_save(parent, typeStr, unitStr, defaultSize) return returnVal ########################################## ############### CLASS #################### # Author: Lan # Updated: 201507 # CLASS: Canvas - to show the graph
def main(): print('TestApp argv:', sys.argv) app = QtGui.QApplication([]) dialog = QtGui.QDialog() dialog.setLayout(QtGui.QVBoxLayout()) button1 = QtGui.QPushButton('Click me1', dialog, objectName='but1') button1.pressed.connect(make_handler(1)) dialog.layout().addWidget(button1) button2 = QtGui.QPushButton('Click me2', dialog, objectName='but2') button2.pressed.connect(make_handler(2)) dialog.layout().addWidget(button2) dialog.show() # When the app is tested with PyQtTester, the exit here is skipped ... sys.exit(app.exec()) # ... this is printed instead. print('TestApp says: Bye bye.')
def __init__(self, videos, parent): QtGui.QDialog.__init__(self, parent) self.videos = videos self.setupUi(self)
def editItem(self): row = self.selectionModel().selectedRows()[0].row() title, addr = self.data[row][0], self.data[row][1] dialog = QtGui.QDialog(self) edit_dialog = Add_Bookmark_Dialog() edit_dialog.setupUi(dialog) edit_dialog.titleEdit.setText(title) edit_dialog.addressEdit.setText(addr) dialog.setWindowTitle('Edit Item') if (dialog.exec_() == QtGui.QDialog.Accepted): title = unicode(edit_dialog.titleEdit.text()) self.data[row][0], self.data[row][1] = title, unicode(edit_dialog.addressEdit.text()) self.item(row, 0).setText(title) self.data_changed = True
def __init__(self, parent=None): QtGui.QDialog.__init__(self, parent) self.resize(500, 200) self.setWindowTitle(u'???????') screen = QtGui.QDesktopWidget().screenGeometry() size = self.geometry() self.move((screen.width()-size.width())/2, (screen.height()-size.height())/2) self.initUI() self.show()
def __init__(self, parent=None): QtGui.QDialog.__init__(self, parent) self.resize(500, 600) self.setWindowTitle(u'???????') screen = QtGui.QDesktopWidget().screenGeometry() size = self.geometry() self.move((screen.width()-size.width())/2, (screen.height()-size.height())/2) self.initUI() self.show()
def __init__(self, parent=None): QtGui.QDialog.__init__(self, parent) self.resize(300, 100) self.setWindowTitle(u'???') screen = QtGui.QDesktopWidget().screenGeometry() size = self.geometry() self.move((screen.width()-size.width())/2, (screen.height()-size.height())/2) self.initUI() self.show()
def __init__(self, guimain): QtGui.QDialog.__init__(self) self.dialog = FlowConfigUi.Ui_Dialog() self.dialog.setupUi(self) self.connecthandlers() self.guimain = guimain
def __init__(self, hexedit): QtGui.QDialog.__init__(self) self.dialog = TextViewDialogUi.Ui_Dialog() self.dialog.setupUi(self)
def __init__(self, hexedit): QtGui.QDialog.__init__(self) self.dialog = HexDialogInsertUi.Ui_HexDialogInsert() self.dialog.setupUi(self) self.connecthandlers() self.hexedit = hexedit # tightly couples to hexedit self.point = None
def __init__(self, hexedit): QtGui.QDialog.__init__(self) self.dialog = AboutDialogUi.Ui_MainDialog() self.dialog.setupUi(self)
def __init__(self,parent = None): super(MyPopup, self).__init__() self.setGeometry(200, 100, 600, 400) self.setWindowTitle("Port Scanner") self.setStyleSheet("QDialog{border-image: url(bg.jpg)}") self.Button = QtGui.QPushButton(self) self.Button.clicked.connect(self.Run_Something) self.Button.setText("Scan Ports") self.Button.move(250,170)
def accept( self ): progdialog = QtGui.QProgressDialog("", "Cancel", 0, len(self.rename_list), self) progdialog.setWindowTitle( "Renaming Archives" ) progdialog.setWindowModality(QtCore.Qt.WindowModal) progdialog.show() for idx,item in enumerate(self.rename_list): QtCore.QCoreApplication.processEvents() if progdialog.wasCanceled(): break progdialog.setValue(idx) idx += 1 progdialog.setLabelText( item['new_name'] ) if item['new_name'] == os.path.basename( item['archive'].path ): print item['new_name'] , "Filename is already good!" continue if not item['archive'].isWritable(check_rar_status=False): continue folder = os.path.dirname( os.path.abspath( item['archive'].path ) ) new_abs_path = utils.unique_file( os.path.join( folder, item['new_name'] ) ) os.rename( item['archive'].path, new_abs_path) item['archive'].rename( new_abs_path ) progdialog.close() QtGui.QDialog.accept(self)
def reject(self): QtGui.QDialog.reject(self) self.isdone = True
def accept( self ): QtGui.QDialog.accept(self) self.deleteOriginal = self.cbxDeleteOriginal.isChecked() self.addToList = self.cbxAddToList.isChecked() if self.radioDontCreate.isChecked(): self.fileConflictBehavior = ExportConflictOpts.dontCreate elif self.radioCreateNew.isChecked(): self.fileConflictBehavior = ExportConflictOpts.createUnique #else: # self.fileConflictBehavior = ExportConflictOpts.overwrite
def accept( self ): if self.cbRole.currentText() == "" or self.leName.text() == "": QtGui.QMessageBox.warning(self, self.tr("Whoops"), self.tr("You need to enter both role and name for a credit.")) else: QtGui.QDialog.accept(self)
def accept(self): self.saveMatch() self.current_match_set_idx += 1 if self.current_match_set_idx == len( self.match_set_list ): # no more items QtGui.QDialog.accept(self) else: self.updateData()
def reject(self): reply = QtGui.QMessageBox.question(self, self.tr("Cancel Matching"), self.tr("Are you sure you wish to cancel the matching process?"), QtGui.QMessageBox.Yes, QtGui.QMessageBox.No ) if reply == QtGui.QMessageBox.No: return QtGui.QDialog.reject(self)
def helpClicked(self): dialog = displayobject.AnObject(QtGui.QDialog(), self.helpfile, title='Resource Help', section='resource') dialog.exec_()
def helpClicked(self): dialog = AnObject(QtGui.QDialog(), self.help, title='Help for makeweather2 (' + fileVersion() + ')', section='makeweather') dialog.exec_()