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()