Python PyQt5.QtWidgets.QDialog.Accepted() Examples
The following are 30
code examples of PyQt5.QtWidgets.QDialog.Accepted().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
PyQt5.QtWidgets.QDialog
, or try the search function
.
Example #1
Source File: custom_dialogs.py From parsec-cloud with GNU Affero General Public License v3.0 | 7 votes |
def get_text_input( parent, title, message, placeholder="", default_text="", completion=None, button_text=None, validator=None, ): w = TextInputWidget( message=message, placeholder=placeholder, default_text=default_text, completion=completion, button_text=button_text, validator=validator, ) d = GreyedDialog(w, title=title, parent=parent) w.dialog = d w.line_edit_text.setFocus() result = d.exec_() if result == QDialog.Accepted: return w.text return None
Example #2
Source File: main.py From raspiblitz with MIT License | 6 votes |
def on_button_4_clicked(self): log.debug("clicked: B4: {}".format(self.winId())) dialog_b4 = QDialog(flags=(Qt.Dialog | Qt.FramelessWindowHint)) ui = Ui_DialogConfirmOff() ui.setupUi(dialog_b4) dialog_b4.move(0, 0) ui.buttonBox.button(QDialogButtonBox.Yes).setText("Shutdown") ui.buttonBox.button(QDialogButtonBox.Retry).setText("Restart") ui.buttonBox.button(QDialogButtonBox.Cancel).setText("Cancel") ui.buttonBox.button(QDialogButtonBox.Yes).clicked.connect(self.b4_shutdown) ui.buttonBox.button(QDialogButtonBox.Retry).clicked.connect(self.b4_restart) dialog_b4.show() rsp = dialog_b4.exec_() if rsp == QDialog.Accepted: log.info("B4: pressed is: Accepted - Shutdown or Restart") else: log.info("B4: pressed is: Cancel")
Example #3
Source File: browsertab.py From qutebrowser with GNU General Public License v3.0 | 6 votes |
def show_dialog(self) -> None: """Print with a QPrintDialog.""" self.check_printer_support() def print_callback(ok: bool) -> None: """Called when printing finished.""" if not ok: message.error("Printing failed!") diag.deleteLater() def do_print() -> None: """Called when the dialog was closed.""" self.to_printer(diag.printer(), print_callback) diag = QPrintDialog(self._tab) if utils.is_mac: # For some reason we get a segfault when using open() on macOS ret = diag.exec_() if ret == QDialog.Accepted: do_print() else: diag.open(do_print)
Example #4
Source File: settingswidget.py From autokey with GNU General Public License v3.0 | 6 votes |
def on_set_window_filter_button_pressed(self): self.window_filter_dialog.exec_() if self.window_filter_dialog.result() == QDialog.Accepted: self.set_dirty() filter_text = self.window_filter_dialog.get_filter_text() if filter_text: self.window_filter_enabled = True self.clear_window_filter_button.setEnabled(True) self.window_filter_label.setText(filter_text) else: self.window_filter_enabled = False self.clear_window_filter_button.setEnabled(False) if self.current_item.inherits_filter(): text = self.current_item.parent.get_child_filter() else: text = "(None configured)" # TODO: i18n self.window_filter_label.setText(text)
Example #5
Source File: load_partial.py From pan-fca with Apache License 2.0 | 6 votes |
def _print_iron_skillet(self, flag): self._is_output += '</html>' self.ui.progress_bar.setValue(100) d = QDialog() ui = IRONSKILLET() ui.setupUi(d) resp = d.exec_() if resp == QDialog.Accepted: tmp = tempfile.NamedTemporaryFile(delete=True) path = tmp.name + '.html' f = open(path, 'w') f.write('<html><body>{}</body></html>'.format(self._is_output)) f.close() webbrowser.open('file://' + path) ############################################## # RESET FLAGS ##############################################
Example #6
Source File: test_dialogs.py From mu with GNU General Public License v3.0 | 6 votes |
def test_ModeSelector_get_mode(qtapp): """ Ensure that the ModeSelector will correctly return a selected mode (or raise the expected exception if cancelled). """ mock_window = QWidget() ms = mu.interface.dialogs.ModeSelector(mock_window) ms.result = mock.MagicMock(return_value=QDialog.Accepted) item = mock.MagicMock() item.icon = "name" ms.mode_list = mock.MagicMock() ms.mode_list.currentItem.return_value = item result = ms.get_mode() assert result == "name" ms.result.return_value = None with pytest.raises(RuntimeError): ms.get_mode()
Example #7
Source File: gui_z2.py From python101 with MIT License | 5 votes |
def getLoginHaslo(parent=None): dialog = LoginDialog(parent) dialog.login.setFocus() ok = dialog.exec_() login, haslo = dialog.loginHaslo() return (login, haslo, ok == QDialog.Accepted)
Example #8
Source File: settingswidget.py From autokey with GNU General Public License v3.0 | 5 votes |
def on_set_hotkey_button_pressed(self): self.hotkey_settings_dialog.exec_() if self.hotkey_settings_dialog.result() == QDialog.Accepted: self.set_dirty() self.hotkey_enabled = True key = self.hotkey_settings_dialog.key modifiers = self.hotkey_settings_dialog.build_modifiers() self.hotkey_label.setText(self.current_item.get_hotkey_string(key, modifiers)) self.clear_hotkey_button.setEnabled(True)
Example #9
Source File: windowfiltersettings.py From autokey with GNU General Public License v3.0 | 5 votes |
def _receiveWindowInfo(self, info): dlg = DetectDialog(self) dlg.populate(info) dlg.exec_() if dlg.result() == QDialog.Accepted: self.trigger_regex_line_edit.setText(dlg.get_choice()) self.detect_window_properties_button.setEnabled(True) # --- Signal handlers ---
Example #10
Source File: specialhotkeys.py From autokey with GNU General Public License v3.0 | 5 votes |
def on_set_config_button_pressed(self): self.show_config_dlg.exec_() if self.show_config_dlg.result() == QDialog.Accepted: self.use_config_hotkey = True key = self.show_config_dlg.key modifiers = self.show_config_dlg.build_modifiers() self.config_key_label.setText(self.show_config_dlg.target_item.get_hotkey_string(key, modifiers)) self.clear_config_button.setEnabled(True)
Example #11
Source File: dialog_list.py From Dwarf with GNU General Public License v3.0 | 5 votes |
def build_and_show(setup_list_cb, setup_list_cb_args, double_click_to_accept=False, checkable=False): dialog = ListDialog(setup_list_cb=setup_list_cb, setup_list_cb_args=setup_list_cb_args, double_click_to_accept=double_click_to_accept, checkable=checkable) if dialog.list.count() > 0: result = dialog.exec_() if checkable: if result == QDialog.Accepted: checked_items = dialog.get_checked_items() else: checked_items = [] return result == QDialog.Accepted, checked_items return result == QDialog.Accepted, dialog.list.selectedItems() return None
Example #12
Source File: dialog_scripts.py From Dwarf with GNU General Public License v3.0 | 5 votes |
def pick(app): """ helper """ dialog = ScriptsDialog(app) result = dialog.exec_() return result == QDialog.Accepted, dialog.script
Example #13
Source File: detached.py From Dwarf with GNU General Public License v3.0 | 5 votes |
def show_dialog(dwarf, process, reason, crash_log): dialog = QDialogDetached(dwarf, process, reason, crash_log) result = dialog.exec_() if result == QDialog.Accepted: if dialog._restart: return 0 elif dialog._terminate: return 1 return -1
Example #14
Source File: gui_z1.py From python101 with MIT License | 5 votes |
def getLoginHaslo(parent=None): dialog = LoginDialog(parent) dialog.login.setFocus() ok = dialog.exec_() login, haslo = dialog.loginHaslo() return (login, haslo, ok == QDialog.Accepted)
Example #15
Source File: gui_z5.py From python101 with MIT License | 5 votes |
def getLoginHaslo(parent=None): dialog = LoginDialog(parent) dialog.login.setFocus() ok = dialog.exec_() login, haslo = dialog.loginHaslo() return (login, haslo, ok == QDialog.Accepted)
Example #16
Source File: gui_z3.py From python101 with MIT License | 5 votes |
def getLoginHaslo(parent=None): dialog = LoginDialog(parent) dialog.login.setFocus() ok = dialog.exec_() login, haslo = dialog.loginHaslo() return (login, haslo, ok == QDialog.Accepted)
Example #17
Source File: PlotFeatures.py From tierpsy-tracker with MIT License | 5 votes |
def _get_save_name(self, ext): fullname = '{}_{}{}'.format(self.root_file, self.save_postfix ,ext) dialog = QFileDialog() dialog.selectFile(fullname) dialog.setOptions(QFileDialog.DontUseNativeDialog) dialog.setFileMode(QFileDialog.AnyFile) dialog.setAcceptMode(QFileDialog.AcceptSave) dialog.setNameFilters(['*' + ext]) ret = dialog.exec(); if (ret == QDialog.Accepted): fullname = dialog.selectedFiles()[0] return fullname
Example #18
Source File: gui_z4.py From python101 with MIT License | 5 votes |
def getLoginHaslo(parent=None): dialog = LoginDialog(parent) dialog.login.setFocus() ok = dialog.exec_() login, haslo = dialog.loginHaslo() return (login, haslo, ok == QDialog.Accepted)
Example #19
Source File: main.py From pqcom with MIT License | 5 votes |
def setup(self, warning=False): choice = self.setupDialog.show(warning) if choice == QDialog.Accepted: if self.actionRun.isChecked(): self.actionRun.setChecked(False) self.actionRun.setChecked(True)
Example #20
Source File: settings.py From guiscrcpy with GNU General Public License v3.0 | 5 votes |
def file_chooser(self): dialog = QFileDialog() dialog.setFilter(dialog.filter() | QtCore.QDir.Hidden) dialog.setDefaultSuffix('mp4') dialog.setAcceptMode(QFileDialog.AcceptSave) dialog.setNameFilters(['H.264 (*.mp4)', 'MKV (*.mkv)']) if dialog.exec_() == QDialog.Accepted: self.a6c1.setText(dialog.selectedFiles()[0])
Example #21
Source File: BSSID.py From tdm with GNU General Public License v3.0 | 5 votes |
def accept(self): for r in range(self.tw.rowCount()): key = self.tw.item(r, 0).text() val = self.tw.item(r, 1).text() self.settings.setValue(key, val) self.settings.endGroup() self.done(QDialog.Accepted)
Example #22
Source File: GPIO.py From tdm with GNU General Public License v3.0 | 5 votes |
def accept(self): payload = ["{} {}".format(k, gb.currentData()) for k, gb in self.gb.items()] self.sendCommand.emit(self.device.cmnd_topic("backlog"), "; ".join(payload)) QMessageBox.information(self, "GPIO saved", "Device will restart.") self.done(QDialog.Accepted)
Example #23
Source File: Patterns.py From tdm with GNU General Public License v3.0 | 5 votes |
def accept(self): for k in self.settings.childKeys(): self.settings.remove(k) for r in range(self.tw.rowCount()): val = self.tw.item(r, 0).text() # check for trailing / if (not val.endswith('/')): val += '/' self.settings.setValue(str(r), val) self.settings.endGroup() self.done(QDialog.Accepted)
Example #24
Source File: Broker.py From tdm with GNU General Public License v3.0 | 5 votes |
def accept(self): self.settings.setValue("hostname", self.hostname.text()) self.settings.setValue("port", self.port.value()) self.settings.setValue("username", self.username.text()) self.settings.setValue("password", self.password.text()) self.settings.setValue("connect_on_startup", self.cbConnectStartup.isChecked()) # self.settings.setValue("client_id", self.clientId.text()) self.settings.sync() self.done(QDialog.Accepted) ################################################################## # utils
Example #25
Source File: sparrowdialogs.py From sparrow-wifi with GNU General Public License v3.0 | 5 votes |
def done(self, result): if result == QDialog.Accepted: retVal = validateAndSend(False) if not retVal: return super().done(result)
Example #26
Source File: SLamParam.py From pyleecan with Apache License 2.0 | 5 votes |
def set_avd(self): """Open the GUI to allow the edition of the axial ventilation duct Parameters ---------- self : SLamParam A SLamParam object """ self.avd_win = DAVDuct(self.obj) return_code = self.avd_win.exec_() if return_code == QDialog.Accepted: # self.obj.axial_vent = self.avd_win.vent self.update_avd_text() # Notify the machine GUI that the machine has changed self.saveNeeded.emit()
Example #27
Source File: replay_gain.py From linux-show-player with GNU General Public License v3.0 | 5 votes |
def gain(self): gainUi = GainUi(MainWindow()) gainUi.exec_() if gainUi.result() == QDialog.Accepted: files = {} if gainUi.only_selected(): cues = Application().layout.get_selected_cues(MediaCue) else: cues = Application().cue_model.filter(MediaCue) for cue in cues: media = cue.media uri = media.input_uri() if uri is not None: if uri not in files: files[uri] = [media] else: files[uri].append(media) # Gain (main) thread self._gain_thread = GainMainThread(files, gainUi.threads(), gainUi.mode(), gainUi.ref_level(), gainUi.norm_level()) # Progress dialog self._progress = GainProgressDialog(len(files)) self._gain_thread.on_progress.connect(self._progress.on_progress, mode=Connection.QtQueued) self._progress.show() self._gain_thread.start()
Example #28
Source File: application.py From linux-show-player with GNU General Public License v3.0 | 5 votes |
def new_session_dialog(self): """Show the layout-selection dialog""" try: # Prompt the user for a new layout dialog = LayoutSelect() if dialog.exec_() != QDialog.Accepted: if self._layout is None: # If the user close the dialog, and no layout exists # the application is closed self.finalize() qApp.quit() exit() else: return # If a valid file is selected load it, otherwise load the layout if exists(dialog.filepath): self._load_from_file(dialog.filepath) else: self._new_session(dialog.selected()) except Exception as e: elogging.exception('Startup error', e) qApp.quit() exit(-1)
Example #29
Source File: sparrowdialogs.py From sparrow-wifi with GNU General Public License v3.0 | 5 votes |
def getSettings(parent = None): dialog = DBSettingsDialog(parent) result = dialog.exec_() # date = dialog.dateTime() dbSettings = dialog.getDBSettings() return (dbSettings, result == QDialog.Accepted)
Example #30
Source File: sparrowdialogs.py From sparrow-wifi with GNU General Public License v3.0 | 5 votes |
def done(self, result): if result == QDialog.Accepted: if len(self.fileinput.text()) == 0: QMessageBox.question(self, 'Error',"Please provide an output file.", QMessageBox.Ok) return super().done(result)