当前位置: 首页>>代码示例>>Python>>正文


Python QMessageBox.Yes方法代码示例

本文整理汇总了Python中PyQt5.QtWidgets.QMessageBox.Yes方法的典型用法代码示例。如果您正苦于以下问题:Python QMessageBox.Yes方法的具体用法?Python QMessageBox.Yes怎么用?Python QMessageBox.Yes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt5.QtWidgets.QMessageBox的用法示例。


在下文中一共展示了QMessageBox.Yes方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: closeEvent

# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import Yes [as 别名]
def closeEvent(self, event):
        """Display a message before leaving

        Parameters
        ----------
        self : DMachineSetup
            A DMachineSetup object
        event :
            The closing event
        """

        if self.is_save_needed:
            quit_msg = self.tr(
                "Unsaved changes will be lost.\nDo you want to save the machine?"
            )
            reply = QMessageBox.question(
                self,
                self.tr("Please save before closing"),
                quit_msg,
                QMessageBox.Yes,
                QMessageBox.No,
            )

            if reply == QMessageBox.Yes:
                self.s_save() 
开发者ID:Eomys,项目名称:pyleecan,代码行数:27,代码来源:DMachineSetup.py

示例2: on_btnCancelEditingMn_clicked

# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import Yes [as 别名]
def on_btnCancelEditingMn_clicked(self, checked):
        if self.app_config.is_modified():
            if WndUtils.queryDlg('Configuration modified. Discard changes?',
                                 buttons=QMessageBox.Yes | QMessageBox.Cancel,
                                 default_button=QMessageBox.Cancel, icon=QMessageBox.Warning) == QMessageBox.Yes:
                # reload the configuration (we don't keep the old values)
                sel_mn_idx = self.app_config.masternodes.index(self.cur_masternode)
                # reload the configuration from file
                self.load_configuration_from_file(self.app_config.app_config_file_name, ask_save_changes=False)
                self.editing_enabled = False
                if sel_mn_idx >= 0 and sel_mn_idx < len(self.app_config.masternodes):
                    self.cur_masternode = self.app_config.masternodes[sel_mn_idx]
                    self.display_masternode_config(sel_mn_idx)
                self.wdg_masternode.set_edit_mode(self.editing_enabled)
                self.update_edit_controls_state()
        else:
            if self.cur_masternode and self.cur_masternode.new:
                idx = self.app_config.masternodes.index(self.cur_masternode)
                if idx >= 0:
                    self.app_config.masternodes.remove(self.cur_masternode)
                    self.cboMasternodes.removeItem(self.cboMasternodes.currentIndex())
            self.editing_enabled = False
            self.wdg_masternode.set_edit_mode(self.editing_enabled)
            self.update_edit_controls_state()
        self.update_mn_controls_state() 
开发者ID:Bertrand256,项目名称:dash-masternode-tool,代码行数:27,代码来源:main_dlg.py

示例3: on_btnEnDisPin_clicked

# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import Yes [as 别名]
def on_btnEnDisPin_clicked(self):
        try:
            if self.hw_session and self.hw_session.hw_client:
                if self.pin_protection is True:
                    # disable
                    if self.queryDlg('Do you really want to disable PIN protection of your %s?' % self.main_ui.getHwName(),
                                     buttons=QMessageBox.Yes | QMessageBox.Cancel, default_button=QMessageBox.Cancel,
                                     icon=QMessageBox.Warning) == QMessageBox.Yes:
                        hw_intf.change_pin(self.main_ui.hw_session, remove=True)
                        self.read_hw_features()
                        self.updateControlsState()
                elif self.pin_protection is False:
                    # enable PIN
                    hw_intf.change_pin(self.main_ui.hw_session, remove=False)
                    self.read_hw_features()
                    self.updateControlsState()

        except Exception as e:
            self.errorMsg(str(e)) 
开发者ID:Bertrand256,项目名称:dash-masternode-tool,代码行数:21,代码来源:hw_setup_dlg.py

示例4: on_btnEnDisPass_clicked

# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import Yes [as 别名]
def on_btnEnDisPass_clicked(self):
        try:
            if self.hw_session and self.hw_session.hw_client:
                if self.passphrase_protection is True:
                    # disable passphrase
                    if self.queryDlg('Do you really want to disable passphrase protection of your %s?' % self.main_ui.getHwName(),
                                     buttons=QMessageBox.Yes | QMessageBox.Cancel, default_button=QMessageBox.Cancel,
                                     icon=QMessageBox.Warning) == QMessageBox.Yes:
                        hw_intf.enable_passphrase(self.hw_session, passphrase_enabled=False)
                        self.read_hw_features()
                        self.updateControlsState()
                elif self.passphrase_protection is False:
                    # enable passphrase
                    if self.queryDlg('Do you really want to enable passphrase protection of your %s?' % self.main_ui.getHwName(),
                                     buttons=QMessageBox.Yes | QMessageBox.Cancel, default_button=QMessageBox.Cancel,
                                     icon=QMessageBox.Warning) == QMessageBox.Yes:
                        hw_intf.enable_passphrase(self.hw_session, passphrase_enabled=True)
                        self.read_hw_features()
                        self.updateControlsState()

        except Exception as e:
            self.errorMsg(str(e)) 
开发者ID:Bertrand256,项目名称:dash-masternode-tool,代码行数:24,代码来源:hw_setup_dlg.py

示例5: main

# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import Yes [as 别名]
def main(qtbot,mocker):

    mocker.patch.object(QMessageBox, 'question', return_value=QMessageBox.Yes)

    win = MainWindow()
    win.show()

    qtbot.addWidget(win)

    editor = win.components['editor']
    editor.set_text(code)

    debugger = win.components['debugger']
    debugger._actions['Run'][0].triggered.emit()

    return qtbot, win 
开发者ID:CadQuery,项目名称:CQ-editor,代码行数:18,代码来源:test_app.py

示例6: main_multi

# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import Yes [as 别名]
def main_multi(qtbot,mocker):

    mocker.patch.object(QMessageBox, 'question', return_value=QMessageBox.Yes)
    mocker.patch.object(QFileDialog, 'getSaveFileName', return_value=('out.step',''))

    win = MainWindow()
    win.show()

    qtbot.addWidget(win)
    qtbot.waitForWindowShown(win)
    
    editor = win.components['editor']
    editor.set_text(code_multi)

    debugger = win.components['debugger']
    debugger._actions['Run'][0].triggered.emit()

    return qtbot, win 
开发者ID:CadQuery,项目名称:CQ-editor,代码行数:20,代码来源:test_app.py

示例7: closeEvent

# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import Yes [as 别名]
def closeEvent(self, event):
        """关闭事件"""
        reply = QMessageBox.question(self, u'退出',
                                     u'确认退出?', QMessageBox.Yes |
                                     QMessageBox.No, QMessageBox.No)
        
        if reply == QMessageBox.Yes:
            for widget in list(self.widgetDict.values()):
                widget.close()
            
            self.mainEngine.exit()
            event.accept()
        else:
            event.ignore()
    
    # ---------------------------------------------------------------------- 
开发者ID:quantOS-org,项目名称:TradeSim,代码行数:18,代码来源:uiMainWindow.py

示例8: profile_delete_action

# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import Yes [as 别名]
def profile_delete_action(self):
        if self.profileSelector.count() > 1:
            to_delete = BackupProfileModel.get(id=self.profileSelector.currentData())

            # Remove pending background jobs
            to_delete_id = str(to_delete.id)
            msg = self.tr("Are you sure you want to delete profile '{}'?".format(to_delete.name))
            reply = QMessageBox.question(self, self.tr("Confirm deletion"),
                                         msg, QMessageBox.Yes | QMessageBox.No, QMessageBox.No)

            if reply == QMessageBox.Yes:
                if self.app.scheduler.get_job(to_delete_id):
                    self.app.scheduler.remove_job(to_delete_id)

                to_delete.delete_instance(recursive=True)
                self.profileSelector.removeItem(self.profileSelector.currentIndex())
                self.profile_select_action(0) 
开发者ID:borgbase,项目名称:vorta,代码行数:19,代码来源:main_window.py

示例9: closeEvent

# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import Yes [as 别名]
def closeEvent(self, event):
        # Save window state in SettingsModel
        SettingsModel.update({SettingsModel.str_value: str(self.frameGeometry().width())})\
            .where(SettingsModel.key == 'previous_window_width')\
            .execute()
        SettingsModel.update({SettingsModel.str_value: str(self.frameGeometry().height())})\
            .where(SettingsModel.key == 'previous_window_height')\
            .execute()

        if not is_system_tray_available():
            run_in_background = QMessageBox.question(self,
                                                     trans_late("MainWindow QMessagebox",
                                                                "Quit"),
                                                     trans_late("MainWindow QMessagebox",
                                                                "Should Vorta continue to run in the background?"),
                                                     QMessageBox.Yes | QMessageBox.No)
            if run_in_background == QMessageBox.No:
                self.app.quit()
        event.accept() 
开发者ID:borgbase,项目名称:vorta,代码行数:21,代码来源:main_window.py

示例10: getRemoteFile

# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import Yes [as 别名]
def getRemoteFile(self, agentIP, agentPort, filename):
        url = "http://" + agentIP + ":" + str(agentPort) + "/system/getrecording/" + filename

        dirname, runfilename = os.path.split(os.path.abspath(__file__))
        recordingsDir = dirname + '/recordings'
        fullPath = recordingsDir + '/' + filename
        
        if os.path.isfile(fullPath):
            reply = QMessageBox.question(self, 'Question',"Local file by that name already exists.  Overwrite?", QMessageBox.Yes | QMessageBox.No, QMessageBox.No)

            if reply == QMessageBox.No:
                return
        
        try:
            # urllib.urlretrieve(url, fullPath)
            urlretrieve(url, fullPath)
            return 0, ""
        except:
            return 1, "Error downloading and saving file." 
开发者ID:ghostop14,项目名称:sparrow-wifi,代码行数:21,代码来源:sparrowdialogs.py

示例11: make_further_instructions

# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import Yes [as 别名]
def make_further_instructions(self, pr):
        def further_instructions():
            response = QMessageBox.information(self, "Next Step", "To continue, send the necessary amounts of Bitcoin to the addresses specified in the 'Outputs' field above. Once broadcast, press Yes to Continue or Cancel to quit.", QMessageBox.Cancel | QMessageBox.Yes, QMessageBox.Cancel)
            if response == QMessageBox.Cancel:
                sys.exit()
            elif response == QMessageBox.Yes:
                if pr.details.payment_url:
                    raw_tx, okPressed1 = QInputDialog.getText(self, "Enter Raw Transaction","Enter the hex of the transaction that was just made:", QLineEdit.Normal, "")
                    if okPressed1 and raw_tx != '':
                        ref_addr, okPressed2 = QInputDialog.getText(self, "Enter Refund Address","Enter a refund address:", QLineEdit.Normal, "")
                        if okPressed2 and ref_addr != '':
                            try:
                                result = pr.send_ack(raw_tx.strip(), ref_addr.strip())
                                if result[0]:
                                    QMessageBox.information(self, "Complete!", "Payment request successful: " + result[1] + "\n\nClick Ok to exit", QMessageBox.Ok, QMessageBox.Ok)
                                    sys.exit()
                                else:
                                    QMessageBox.error(self, "Error!", "Payment request was not successful: " + result[1] + "\n\nClick Ok to exit", QMessageBox.Ok, QMessageBox.Ok)
                                    sys.exit()
                            except:
                                QMessageBox.error(self, "Error!", "There was an error parsing the raw transaction or address. Please restart and try again.\n\nClick Ok to exit", QMessageBox.Ok, QMessageBox.Ok)
                                sys.exit()
                                
        return further_instructions 
开发者ID:achow101,项目名称:payment-proto-interface,代码行数:26,代码来源:gui.py

示例12: msg_box

# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import Yes [as 别名]
def msg_box(text, title=None, icon=None, parent=None, buttons=QMessageBox.Yes | QMessageBox.No, default=QMessageBox.No,
            type=QMessageBox.Question):
    res = get_themed_box(parent)

    if title is not None:
        res.setWindowTitle(title)

    if icon is not None:
        res.setWindowIcon(icon)

    res.setIcon(type)
    res.setStandardButtons(buttons)
    res.setDefaultButton(default)
    res.setText(text)
    res.adjustSize()

    if parent:
        center_widget(res, parent)

    return res 
开发者ID:TuringApp,项目名称:Turing,代码行数:22,代码来源:widgets.py

示例13: promptToSave

# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import Yes [as 别名]
def promptToSave(self):
        if cm.ConfigManager.SETTINGS[cm.PROMPT_TO_SAVE]:
            # TODO: i18n
            result = QMessageBox.question(
                self.window(),
                "Save changes?",
                "There are unsaved changes. Would you like to save them?",
                QMessageBox.Yes | QMessageBox.No | QMessageBox.Cancel
            )

            if result == QMessageBox.Yes:
                return self.on_save()
            elif result == QMessageBox.Cancel:
                return True
            else:
                return False
        else:
            # don't prompt, just save
            return self.on_save()

    # ---- Signal handlers 
开发者ID:autokey,项目名称:autokey,代码行数:23,代码来源:centralwidget.py

示例14: closeEvent

# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import Yes [as 别名]
def closeEvent(self, event):
        reply = QMessageBox.question(self, 'Exit',
            "Are you sure to quit?", QMessageBox.Yes |
            QMessageBox.No, QMessageBox.No)

        if reply == QMessageBox.Yes:
            print dn
            os.chdir(dn)
            print dn
            os.chdir('../..')
            print dn
            print '''
###################################################
#              Author Storm Shadow                #
#                                                 #
#              Follow me on twitter               #
#                  @zadow28                       #
###################################################
#              Ida pro  python Editor             #
###################################################
'''
            event.accept()
        else:
            event.ignore() 
开发者ID:techbliss,项目名称:Python_editor,代码行数:26,代码来源:pyeditor.py

示例15: _onEgReportAnswer

# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import Yes [as 别名]
def _onEgReportAnswer(self, event):
        """获取引擎报告应答数据并显示报告"""
        data = event.getData()
        id = event.getStrategyId()

        tempResult = data["Result"]
        if not tempResult["Fund"]:
            self._logger.info(f"[UI][{id}]: Report data is empty!")
            # QMessageBox.information(None, '提示', '回测数据为空!', QMessageBox.Yes)
            return

        self._reportData = tempResult

        # 取到报告数据弹出报告
        if self._reportData:
            self._logger.info(f"[UI][{id}]: Receiving report data answer successfully!")
            self._app.reportDisplay(self._reportData, id)
            return

        self._logger.info(f"[UI][{id}]: Report data received is empty!") 
开发者ID:epolestar,项目名称:equant,代码行数:22,代码来源:model.py


注:本文中的PyQt5.QtWidgets.QMessageBox.Yes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。