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


Python QMessageBox.Ok方法代码示例

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


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

示例1: test_err_windows

# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import Ok [as 别名]
def test_err_windows(qtbot, qapp, pre_text, post_text, expected, caplog):

    def err_window_check():
        w = qapp.activeModalWidget()
        assert w is not None
        try:
            qtbot.add_widget(w)
            if not utils.is_mac:
                assert w.windowTitle() == 'title'
            assert w.icon() == QMessageBox.Critical
            assert w.standardButtons() == QMessageBox.Ok
            assert w.text() == expected
        finally:
            w.close()

    QTimer.singleShot(10, err_window_check)

    with caplog.at_level(logging.ERROR):
        error.handle_fatal_exc(ValueError("exception"), 'title',
                               pre_text=pre_text, post_text=post_text,
                               no_err_windows=False) 
开发者ID:qutebrowser,项目名称:qutebrowser,代码行数:23,代码来源:test_error.py

示例2: test_attributes

# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import Ok [as 别名]
def test_attributes(qtbot):
    """Test basic QMessageBox attributes."""
    title = 'title'
    text = 'text'
    parent = QWidget()
    qtbot.add_widget(parent)
    icon = QMessageBox.Critical
    buttons = QMessageBox.Ok | QMessageBox.Cancel

    box = msgbox.msgbox(parent=parent, title=title, text=text, icon=icon,
                        buttons=buttons)
    qtbot.add_widget(box)
    if not utils.is_mac:
        assert box.windowTitle() == title
    assert box.icon() == icon
    assert box.standardButtons() == buttons
    assert box.text() == text
    assert box.parent() is parent 
开发者ID:qutebrowser,项目名称:qutebrowser,代码行数:20,代码来源:test_msgbox.py

示例3: ssh_copy_to_clipboard_action

# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import Ok [as 别名]
def ssh_copy_to_clipboard_action(self):
        msg = QMessageBox()
        msg.setStandardButtons(QMessageBox.Ok)
        msg.setParent(self, QtCore.Qt.Sheet)

        index = self.sshComboBox.currentIndex()
        if index > 1:
            ssh_key_filename = self.sshComboBox.itemData(index)
            ssh_key_path = os.path.expanduser(f"~/.ssh/{ssh_key_filename}.pub")
            if os.path.isfile(ssh_key_path):
                pub_key = open(ssh_key_path).read().strip()
                clipboard = QApplication.clipboard()
                clipboard.setText(pub_key)

                msg.setText("Public Key Copied to Clipboard")
                msg.setInformativeText(
                    "The selected public SSH key was copied to the clipboard. "
                    "Use it to set up remote repo permissions."
                )

            else:
                msg.setText("Couldn't find public key.")
        else:
            msg.setText("Select a public key from the dropdown first.")
        msg.exec_() 
开发者ID:Mebus,项目名称:restatic,代码行数:27,代码来源:repo_tab.py

示例4: repo_unlink_action

# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import Ok [as 别名]
def repo_unlink_action(self):
        profile = self.profile()
        self.init_repo_stats()
        msg = QMessageBox()
        msg.setStandardButtons(QMessageBox.Ok)
        msg.setParent(self, QtCore.Qt.Sheet)
        selected_repo_id = self.repoSelector.currentData()
        selected_repo_index = self.repoSelector.currentIndex()
        if selected_repo_index > 2:
            repo = RepoModel.get(id=selected_repo_id)
            ArchiveModel.delete().where(ArchiveModel.repo_id == repo.id).execute()
            profile.repo = None
            profile.save()
            repo.delete_instance(recursive=True)  # This also deletes snapshots.
            self.repoSelector.setCurrentIndex(0)
            self.repoSelector.removeItem(selected_repo_index)
            msg.setText("Repository was Unlinked")
            msg.setInformativeText("You can always connect it again later.")
            msg.exec_()

            self.repo_changed.emit()
            self.init_repo_stats() 
开发者ID:Mebus,项目名称:restatic,代码行数:24,代码来源:repo_tab.py

示例5: add_preset

# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import Ok [as 别名]
def add_preset(self):
        name = self.nameLineEdit.text()
        ip = self.ipLineEdit.text()
        port = self.portSpinBox.value()
        password = self.passwordLineEdit.text()
        # Make sure password is non if empty
        if not password:
            password = None

        if not name:
            QMessageBox().warning(self, "Missing name", "Fill the name of preset", QMessageBox.Ok)
            return

        if not IpHelper.is_valid_ipv4(ip):
            QMessageBox().warning(self, "Invalid IP", "The IP address has invalid format", QMessageBox.Ok)
            return

        Settings().wifi_presets.append((name, ip, port, password))
        self.update_preset_list() 
开发者ID:BetaRavener,项目名称:uPyLoader,代码行数:21,代码来源:wifi_preset_dialog.py

示例6: main

# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import Ok [as 别名]
def main():
    QApplication.setApplicationName("Blender Version Manager")
    QApplication.setApplicationVersion("1.6.1 Beta")

    app = QApplication(sys.argv)

    proc_count = len([proc for proc in psutil.process_iter()
                      if proc.name() == "Blender Version Manager.exe"])

    if proc_count > 2:
        msg = QMessageBox(QMessageBox.Warning, "Blender Version Manager",
                          "Another instance is already running!",
                          QMessageBox.Ok)
        msg.setWindowIcon(QIcon(":/icons/app.svg"))
        msg.exec_()
    else:
        window = BVMQMainWindow(app)

        if not window.is_run_minimized:
            window.show()

        app.exec_() 
开发者ID:DotBow,项目名称:Blender-Version-Manager,代码行数:24,代码来源:main.py

示例7: runFunc

# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import Ok [as 别名]
def runFunc(self,func,*args,**kwargs):
        if self.serial is None:
            QMessageBox.critical(self,'Error','无设备连接',QMessageBox.Ok)
            return
        self.applyAll()
        def f():
            try:
                self.signalFuncBegin.emit()
                fgoFunc.suspendFlag=False
                fgoFunc.terminateFlag=False
                fgoFunc.fuse.reset()
                func(*args,**kwargs)
            except Exception as e:logger.exception(e)
            finally:
                self.signalFuncEnd.emit()
                playsound.playsound('sound/'+next(soundName))
        threading.Thread(target=f).start() 
开发者ID:hgjazhgj,项目名称:FGO-py,代码行数:19,代码来源:fgoGui.py

示例8: ssh_copy_to_clipboard_action

# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import Ok [as 别名]
def ssh_copy_to_clipboard_action(self):
        msg = QMessageBox()
        msg.setStandardButtons(QMessageBox.Ok)
        msg.setParent(self, QtCore.Qt.Sheet)

        index = self.sshComboBox.currentIndex()
        if index > 1:
            ssh_key_filename = self.sshComboBox.itemData(index)
            ssh_key_path = os.path.expanduser(f'~/.ssh/{ssh_key_filename}.pub')
            if os.path.isfile(ssh_key_path):
                pub_key = open(ssh_key_path).read().strip()
                clipboard = QApplication.clipboard()
                clipboard.setText(pub_key)

                msg.setText(self.tr("Public Key Copied to Clipboard"))
                msg.setInformativeText(self.tr(
                    "The selected public SSH key was copied to the clipboard. "
                    "Use it to set up remote repo permissions."))

            else:
                msg.setText(self.tr("Couldn't find public key."))
        else:
            msg.setText(self.tr("Select a public key from the dropdown first."))
        msg.exec_() 
开发者ID:borgbase,项目名称:vorta,代码行数:26,代码来源:repo_tab.py

示例9: repo_unlink_action

# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import Ok [as 别名]
def repo_unlink_action(self):
        profile = self.profile()
        self.init_repo_stats()
        msg = QMessageBox()
        msg.setStandardButtons(QMessageBox.Ok)
        msg.setParent(self, QtCore.Qt.Sheet)
        selected_repo_id = self.repoSelector.currentData()
        selected_repo_index = self.repoSelector.currentIndex()
        if selected_repo_index > 2:
            repo = RepoModel.get(id=selected_repo_id)
            ArchiveModel.delete().where(ArchiveModel.repo_id == repo.id).execute()
            profile.repo = None
            profile.save()
            repo.delete_instance(recursive=True)  # This also deletes archives.
            self.repoSelector.setCurrentIndex(0)
            self.repoSelector.removeItem(selected_repo_index)
            msg.setText(self.tr('Repository was Unlinked'))
            msg.setInformativeText(self.tr('You can always connect it again later.'))
            msg.exec_()

            self.repo_changed.emit()
            self.init_repo_stats() 
开发者ID:borgbase,项目名称:vorta,代码行数:24,代码来源:repo_tab.py

示例10: checkScanAlreadyRunning

# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import Ok [as 别名]
def checkScanAlreadyRunning(self):
        errcode, errmsg, hasBluetooth, hasUbertooth, spectrumScanRunning, discoveryScanRunning =  getRemoteBluetoothRunningServices(self.remoteAgentIP, self.remoteAgentPort)      
        
        if errcode == 0:
            if discoveryScanRunning:
                self.btnScan.setStyleSheet("background-color: rgba(255,0,0,255); border: none;")
                self.btnScan.setText('&Stop scanning')
                self.comboScanType.setEnabled(False)
            else:
                self.btnScan.setStyleSheet("background-color: rgba(2,128,192,255); border: none;")
                self.btnScan.setText('&Scan')
                self.comboScanType.setEnabled(True)
        else:
                QMessageBox.question(self, 'Error',"Error getting remote agent discovery status: " + errmsg, QMessageBox.Ok)

                self.btnScan.setStyleSheet("background-color: rgba(2,128,192,255); border: none;")
                self.btnScan.setText('&Scan')
                self.comboScanType.setEnabled(True) 
开发者ID:ghostop14,项目名称:sparrow-wifi,代码行数:20,代码来源:sparrowdialogs.py

示例11: validateAllowedIPs

# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import Ok [as 别名]
def validateAllowedIPs(self, allowedIPstr):
        if len(allowedIPstr) > 0:
            ippattern = re.compile('([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})')
            if ',' in allowedIPstr:
                tmpList = allowedIPstr.split(',')
                for curItem in tmpList:
                    ipStr = curItem.replace(' ', '')
                    try:
                        ipValue = ippattern.search(ipStr).group(1)
                    except:
                        QMessageBox.question(self, 'Error','ERROR: Unknown IP pattern: ' + ipStr, QMessageBox.Ok)
                        return False
            else:
                ipStr = allowedIPstr.replace(' ', '')
                try:
                    ipValue = ippattern.search(ipStr).group(1)
                except:
                    QMessageBox.question(self, 'Error','ERROR: Unknown IP pattern: ' + ipStr, QMessageBox.Ok)
                    return False
                    
        return True 
开发者ID:ghostop14,项目名称:sparrow-wifi,代码行数:23,代码来源:sparrowdialogs.py

示例12: make_further_instructions

# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import Ok [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

示例13: telegramBotSettings

# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import Ok [as 别名]
def telegramBotSettings(self):
        cfg = ConfigParser()
        cfg.read('./config/telegramBot.cfg', encoding='utf-8-sig')
        read_only = cfg.getboolean('telegramBot', 'read_only')
        # read_only = False
        if read_only:
            text = '基于安全考虑,系统拒绝了本次请求。'
            informativeText = '<b>请联系设备管理员。</b>'
            CoreUI.callDialog(QMessageBox.Critical, text, informativeText, QMessageBox.Ok)
        else:
            token = cfg.get('telegramBot', 'token')
            chat_id = cfg.get('telegramBot', 'chat_id')
            proxy_url = cfg.get('telegramBot', 'proxy_url')
            message = cfg.get('telegramBot', 'message')

            self.telegramBotDialog = TelegramBotDialog()
            self.telegramBotDialog.tokenLineEdit.setText(token)
            self.telegramBotDialog.telegramIDLineEdit.setText(chat_id)
            self.telegramBotDialog.socksLineEdit.setText(proxy_url)
            self.telegramBotDialog.messagePlainTextEdit.setPlainText(message)
            self.telegramBotDialog.exec()

    # 设备响铃进程 
开发者ID:winterssy,项目名称:face_recognition_py,代码行数:25,代码来源:core.py

示例14: updateTxtFileList

# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import Ok [as 别名]
def updateTxtFileList(self, videos_list):
        if videos_list:
            #test that it is a valid text file with a list of files inside of it.
            try:
                with open(videos_list, 'r') as fid:
                    first_line = fid.readline().strip()
                    if not os.path.exists(first_line):
                        raise FileNotFoundError
            except:
                QMessageBox.critical(
                        self,
                        "It is not a text file with a valid list of files.",
                        "The selected file does not seem to contain a list of valid files to process.\n"
                        "Plase make sure to select a text file that contains a list of existing files.",
                        QMessageBox.Ok)
                return


        self.videos_list = videos_list
        self.ui.p_videos_list.setText(videos_list) 
开发者ID:ver228,项目名称:tierpsy-tracker,代码行数:22,代码来源:BatchProcessing.py

示例15: _h_tag_worm

# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import Ok [as 别名]
def _h_tag_worm(self, label_ind):
        if not self.worm_index_type == 'worm_index_manual':
            return

        worm_ind = self.current_worm_index

        if self.frame_data is None:
            return

        if not worm_ind in self.frame_data['worm_index_manual'].values:
            QMessageBox.critical(
                self,
                'The selected worm is not in this frame.',
                'Select a worm in the current frame to label.',
                QMessageBox.Ok)
            return

        good = self.trajectories_data['worm_index_manual'] == worm_ind
        self.trajectories_data.loc[good, 'worm_label'] = label_ind
        self.updateImage() 
开发者ID:ver228,项目名称:tierpsy-tracker,代码行数:22,代码来源:MWTrackerViewer.py


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