当前位置: 首页>>代码示例>>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;未经允许,请勿转载。