當前位置: 首頁>>代碼示例>>Python>>正文


Python QDialog.Accepted方法代碼示例

本文整理匯總了Python中PyQt5.QtWidgets.QDialog.Accepted方法的典型用法代碼示例。如果您正苦於以下問題:Python QDialog.Accepted方法的具體用法?Python QDialog.Accepted怎麽用?Python QDialog.Accepted使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PyQt5.QtWidgets.QDialog的用法示例。


在下文中一共展示了QDialog.Accepted方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: on_button_4_clicked

# 需要導入模塊: from PyQt5.QtWidgets import QDialog [as 別名]
# 或者: from PyQt5.QtWidgets.QDialog import Accepted [as 別名]
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") 
開發者ID:rootzoll,項目名稱:raspiblitz,代碼行數:25,代碼來源:main.py

示例2: show_dialog

# 需要導入模塊: from PyQt5.QtWidgets import QDialog [as 別名]
# 或者: from PyQt5.QtWidgets.QDialog import Accepted [as 別名]
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) 
開發者ID:qutebrowser,項目名稱:qutebrowser,代碼行數:24,代碼來源:browsertab.py

示例3: new_session_dialog

# 需要導入模塊: from PyQt5.QtWidgets import QDialog [as 別名]
# 或者: from PyQt5.QtWidgets.QDialog import Accepted [as 別名]
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) 
開發者ID:FrancescoCeruti,項目名稱:linux-show-player,代碼行數:27,代碼來源:application.py

示例4: get_text_input

# 需要導入模塊: from PyQt5.QtWidgets import QDialog [as 別名]
# 或者: from PyQt5.QtWidgets.QDialog import Accepted [as 別名]
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 
開發者ID:Scille,項目名稱:parsec-cloud,代碼行數:27,代碼來源:custom_dialogs.py

示例5: on_set_window_filter_button_pressed

# 需要導入模塊: from PyQt5.QtWidgets import QDialog [as 別名]
# 或者: from PyQt5.QtWidgets.QDialog import Accepted [as 別名]
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) 
開發者ID:autokey,項目名稱:autokey,代碼行數:20,代碼來源:settingswidget.py

示例6: test_ModeSelector_get_mode

# 需要導入模塊: from PyQt5.QtWidgets import QDialog [as 別名]
# 或者: from PyQt5.QtWidgets.QDialog import Accepted [as 別名]
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() 
開發者ID:mu-editor,項目名稱:mu,代碼行數:19,代碼來源:test_dialogs.py

示例7: _print_iron_skillet

# 需要導入模塊: from PyQt5.QtWidgets import QDialog [as 別名]
# 或者: from PyQt5.QtWidgets.QDialog import Accepted [as 別名]
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
    ############################################## 
開發者ID:PaloAltoNetworks,項目名稱:pan-fca,代碼行數:23,代碼來源:load_partial.py

示例8: set_avd

# 需要導入模塊: from PyQt5.QtWidgets import QDialog [as 別名]
# 或者: from PyQt5.QtWidgets.QDialog import Accepted [as 別名]
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() 
開發者ID:Eomys,項目名稱:pyleecan,代碼行數:17,代碼來源:SLamParam.py

示例9: gain

# 需要導入模塊: from PyQt5.QtWidgets import QDialog [as 別名]
# 或者: from PyQt5.QtWidgets.QDialog import Accepted [as 別名]
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() 
開發者ID:FrancescoCeruti,項目名稱:linux-show-player,代碼行數:36,代碼來源:replay_gain.py

示例10: getSettings

# 需要導入模塊: from PyQt5.QtWidgets import QDialog [as 別名]
# 或者: from PyQt5.QtWidgets.QDialog import Accepted [as 別名]
def getSettings(parent = None):
        dialog = DBSettingsDialog(parent)
        result = dialog.exec_()
        # date = dialog.dateTime()
        dbSettings = dialog.getDBSettings()
        return (dbSettings, result == QDialog.Accepted) 
開發者ID:ghostop14,項目名稱:sparrow-wifi,代碼行數:8,代碼來源:sparrowdialogs.py

示例11: done

# 需要導入模塊: from PyQt5.QtWidgets import QDialog [as 別名]
# 或者: from PyQt5.QtWidgets.QDialog import Accepted [as 別名]
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) 
開發者ID:ghostop14,項目名稱:sparrow-wifi,代碼行數:10,代碼來源:sparrowdialogs.py

示例12: onRestart

# 需要導入模塊: from PyQt5.QtWidgets import QDialog [as 別名]
# 或者: from PyQt5.QtWidgets.QDialog import Accepted [as 別名]
def onRestart(self):
        retVal = self.validateAndSend(True)
        if not retVal:
            return
        
        # Behave like OK but send restart flag
        super().done(QDialog.Accepted) 
開發者ID:ghostop14,項目名稱:sparrow-wifi,代碼行數:9,代碼來源:sparrowdialogs.py

示例13: showTelemetry

# 需要導入模塊: from PyQt5.QtWidgets import QDialog [as 別名]
# 或者: from PyQt5.QtWidgets.QDialog import Accepted [as 別名]
def showTelemetry(parent = None):
        dialog = TelemetryDialog(parent)
        result = dialog.exec_()
        return (result == QDialog.Accepted) 
開發者ID:ghostop14,項目名稱:sparrow-wifi,代碼行數:6,代碼來源:telemetry.py

示例14: exec_modal

# 需要導入模塊: from PyQt5.QtWidgets import QDialog [as 別名]
# 或者: from PyQt5.QtWidgets.QDialog import Accepted [as 別名]
def exec_modal(cls, jobs_ctx, config, addr, parent):
        w = cls(jobs_ctx=jobs_ctx, config=config, addr=addr)
        d = GreyedDialog(w, _("TEXT_BOOTSTRAP_ORG_TITLE"), parent=parent)
        w.dialog = d
        w.line_edit_login.setFocus()
        if d.exec_() == QDialog.Accepted and w.status:
            return w.status
        return None 
開發者ID:Scille,項目名稱:parsec-cloud,代碼行數:10,代碼來源:bootstrap_organization_widget.py

示例15: exec_modal

# 需要導入模塊: from PyQt5.QtWidgets import QDialog [as 別名]
# 或者: from PyQt5.QtWidgets.QDialog import Accepted [as 別名]
def exec_modal(cls, jobs_ctx, config, addr, parent):
        w = cls(jobs_ctx=jobs_ctx, config=config, addr=addr)
        d = GreyedDialog(w, _("TEXT_CLAIM_USER_TITLE"), parent=parent)
        w.dialog = d
        w.line_edit_token.setFocus()
        if d.exec_() == QDialog.Accepted and w.status:
            return w.status
        return None 
開發者ID:Scille,項目名稱:parsec-cloud,代碼行數:10,代碼來源:claim_user_widget.py


注:本文中的PyQt5.QtWidgets.QDialog.Accepted方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。