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()
def save_tc_history_callback(self): mt = MakoTranslate() d = Database(self.HISTORY_DB) d.create_history_table() widget_gui = QInputDialog() save_name, ok = QInputDialog.getText(widget_gui, "Save TC", "Name of TC to be saved:") if not ok: return pck_sec_header, src_data = self.view.get_tc_text() pck_sec_header = json.loads(mt.replace(pck_sec_header)) src_data = json.loads(mt.replace(src_data)) self.command["data"]["pck_sec_head"] = pck_sec_header self.command["data"]["user_data"]["src_data"] = src_data d.insert_db("INSERT INTO history VALUES(?, ?)", [[save_name, json.dumps(self.command)]]) self.show_history()