def testQDialog(self): dlg = QInputDialog() dlg.setInputMode(QInputDialog.TextInput) lst = dlg.children() self.assert_(len(lst)) obj = lst[0] self._called = False obj.destroyed[QObject].connect(self.cb) obj = None del dlg self.assert_(self._called)
def _custom_input_dialog(self, ui, title, label, text_echo_mode=QLineEdit.Normal, input_mode=QInputDialog.TextInput): dlg = QInputDialog(ui) dlg.setTextEchoMode(text_echo_mode) dlg.setInputMode(input_mode) dlg.setWindowTitle(title) dlg.setLabelText(label) dlg.resize(250, 100) result = dlg.exec_() text = dlg.textValue() return (text, result)
def on_makePatchButton_clicked(self): project = self.getCurrentProject() package = self.currentPackage() if project is None or package is None: return dialog = QInputDialog(self.mainWindow) dialog.setInputMode(QInputDialog.TextInput) dialog.setLabelText(u"Patch name (should end with <i>.patch</i>):") dialog.setWindowTitle(u"Choose patch name...") le = dialog.findChildren(QLineEdit) if len(le) > 0: validator = QRegExpValidator(PATCH_NAME_REGEXP, le[0]) le[0].setText(u".patch") le[0].setValidator(validator) dialog.textValueSelected.connect(self.__createPatch) dialog.show()
def addString(self, *args): dlg = QInputDialog() dlg.setInputMode(QInputDialog.TextInput) txt, ok = dlg.getText(self, self.addCaption, self.addLabel) # , txt = txt.rstrip('\\') txt = txt.rstrip('/') txt = txt.rstrip(';') txt = txt.rstrip() # QLineEdit.Normal, self.listBox.currentItem().text()) if ok and (txt is not None): # if (not self.duplicatesOk and self.listBox.findItem(txt, CaseSensitive | ExactMatch)): # return self.listBox.addItem(txt) self.listBox.setCurrentRow(self.listBox.count() - 1) self.listBox.clearSelection() self.refreshList()