Python PyQt5.QtWidgets.QMessageBox 模块,No() 实例源码

我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用PyQt5.QtWidgets.QMessageBox.No()

项目:gpvdm    作者:roderickmackenzie    | 项目源码 | 文件源码
def yes_no_cancel_dlg(parent,text):
    if parent!=None:
        msgBox = QMessageBox(parent)
        msgBox.setIcon(QMessageBox.Question)
        msgBox.setText("Question")
        msgBox.setInformativeText(text)
        msgBox.setStandardButtons(QMessageBox.Yes| QMessageBox.No| QMessageBox.Cancel  )
        msgBox.setDefaultButton(QMessageBox.No)
        reply = msgBox.exec_()
        if reply == QMessageBox.Yes:
            return "yes"
        elif reply == QMessageBox.No:
            return "no"
        else:
            return "cancel"
    else:
        reply = input(text+"y/n/c")

        if reply == "y":
            return "yes"
        elif reply == "n":
            return "no"
        else:
            return "cancel"
项目:ciba    作者:FindHao    | 项目源码 | 文件源码
def __init__(self):
        super(MainFrame, self).__init__()
        # ??qt?????????????
        self.clipboard = QtGui.QGuiApplication.clipboard()
        self.setupUi(self)
        self.connects()
        # ??????????????focusoutevent??????bug
        self.setFocus()
        self.setFocusPolicy(QtCore.Qt.StrongFocus)
        # todo: ?????
        self.query = Query()
        # self.setWindowFlags(QtCore.Qt.Popup)
        self.player = QMediaPlayer()
        # ????????? (????)
        self.open = True
        # ????
        has_new, r_version = version_check()
        if has_new:
            QMessageBox.question(self, '????', 'Github??????? %s\n https://github.com/FindHao/ciba/releases' % r_version,
                                         QMessageBox.Yes, QMessageBox.No)
项目:opcua-modeler    作者:FreeOpcUa    | 项目源码 | 文件源码
def _save_as(self):
        path, ok = QFileDialog.getSaveFileName(self.modeler, caption="Save OPC UA XML", filter="XML Files (*.xml *.XML)")
        if ok:
            if os.path.isfile(path):
                reply = QMessageBox.question(
                    self.modeler,
                    "OPC UA Modeler",
                    "File already exit, do you really want to save to this file?",
                    QMessageBox.Yes | QMessageBox.No | QMessageBox.Cancel
                )
                if reply != QMessageBox.Yes:
                    return
            if self._last_model_dir != os.path.dirname(path):
                self._last_model_dir = os.path.dirname(path)
                self.settings.setValue("last_model_dir", self._last_model_dir)
            self._model_mgr.save_model(path)
项目:uitester    作者:IfengAutomation    | 项目源码 | 文件源码
def conflict_tags_submit(self):
        """
        submit conflict tags
        :return:
        """
        updata_tag_message_list = self.get_table_data()
        again_conflict_data = self.get_conflict_data(updata_tag_message_list)
        self.wait_dialog = WaitDialog(self)
        self.wait_dialog.setWindowModality(Qt.ApplicationModal)
        if again_conflict_data:
            message = str(again_conflict_data) + " has existed, whether to continue to submit"
            reply = QMessageBox.information(self, "merge conflicts", message, QMessageBox.Yes | QMessageBox.No)
            if reply == QMessageBox.Yes:
                self.wait_dialog.show()
                thread = Thread(target=self.case_data_manager.merge_conflict_data_callback,
                                args=(updata_tag_message_list, self.callback))
                thread.start()
        else:
            self.wait_dialog.show()
            thread = Thread(target=self.case_data_manager.merge_conflict_data_callback,
                            args=(updata_tag_message_list, self.callback))
            thread.start()
项目:uitester    作者:IfengAutomation    | 项目源码 | 文件源码
def closeEvent(self, close_even):
        if self.tag_id_line_edit.text() != '':
            if self.tag.name != self.tag_name_line_edit.text() or self.tag.description != self.tag_description_text_edit.toPlainText():
                reply = QMessageBox.information(self, 'close window', 'Changes not saved, confirm close?',
                                                QMessageBox.Yes, QMessageBox.No)
                if reply != QMessageBox.Yes:
                    close_even.ignore()
                    return
        else:
            if self.tag_id_line_edit.text() != '' or self.tag_description_text_edit.toPlainText() != '':
                reply = QMessageBox.information(self, 'close window', 'Changes not saved, confirm close?',
                                                QMessageBox.Yes, QMessageBox.No)
                if reply != QMessageBox.Yes:
                    close_even.ignore()
                    return
        self.refresh_signal.emit()
项目:ovirt-desktop-client    作者:nkovacne    | 项目源码 | 文件源码
def make_button(self, filename, tooltip, alignment=Qt.AlignCenter):
        """
            Description: Creates a QLabel which will contain an image and will
                         simulate a button. No associated text will be shown.
            Arguments: 1. filename: The filename of the icon/image to show 
                       2. tooltip: Some text to show as a tooltip to the image
                       3. alignment: Alignment of the button (center by default)
            Returns: The created QLabel button
        """

        global STANDARDCELLCSS, IMGDIR

        filepath = '%s%s%s' % (IMGDIR, filename, '.png')
        icon = QImage(filepath)
        image = QLabel()
        image.setToolTip('<span style="color:#B9B900">%s</span>' % (tooltip))
        image.setStyleSheet(STANDARDCELLCSS)
        image.setPixmap(QPixmap.fromImage(icon))
        image.setAlignment(alignment)

        return image
项目:ovirt-desktop-client    作者:nkovacne    | 项目源码 | 文件源码
def forget_creds(self):
        """
            Description: Invoked when the user clicks on the 'Forget credentials' button in the toolbar.
            Arguments: None
            Returns: Nothing
        """

        global conf

        self.lastclick = int(time())         # Last click timestamp update

        reply = QMessageBox.question(None, _('apptitle') + ': ' + _('confirm'), _('confirm_forget_creds'), QMessageBox.Yes | QMessageBox.No, QMessageBox.No)

        if reply == QMessageBox.Yes:
            remove(conf.USERCREDSFILE)
            self.forgetCredsAction.setDisabled(True)
            QMessageBox.information(None, _('apptitle') + ': ' + _('success'), _('creds_forgotten'))
项目:ovirt-desktop-client    作者:nkovacne    | 项目源码 | 文件源码
def confirm_quit(self):
        """
            Description: Asks for confirmation from the user's side to close the app.
            Arguments: None
            Returns: True if the user wants to close the app, False otherwise.
        """

        global conf

        reply = QMessageBox.question(None, _('apptitle') + ': ' + _('confirm'), _('confirm_quit'), QMessageBox.Yes | QMessageBox.No, QMessageBox.No)

        if reply == QMessageBox.Yes:
            self.logout(reconnect=False)
            return True
        else:
            return False
项目:anki-connect    作者:FooSoft    | 项目源码 | 文件源码
def upgrade(self):
        response = QMessageBox.question(
            self.anki.window(),
            'AnkiConnect',
            'Upgrade to the latest version?',
            QMessageBox.Yes | QMessageBox.No
        )

        if response == QMessageBox.Yes:
            data = download(URL_UPGRADE)
            if data is None:
                QMessageBox.critical(self.anki.window(), 'AnkiConnect', 'Failed to download latest version.')
            else:
                path = os.path.splitext(__file__)[0] + '.py'
                with open(path, 'w') as fp:
                    fp.write(makeStr(data))
                QMessageBox.information(self.anki.window(), 'AnkiConnect', 'Upgraded to the latest version, please restart Anki.')
                return True

        return False
项目:OpenTutorials_PyQt    作者:RavenKyu    | 项目源码 | 文件源码
def slot_new(self):
        """
        ???? ?? ? ??
        :return:
        """
        if not self.is_saved:
            reply = QMessageBox.information(
                self, self.tr("Save"), self.tr("??? ??? ?????????"),
                QMessageBox.Save | QMessageBox.No | QMessageBox.Cancel, QMessageBox.Save)
            if reply == QMessageBox.Save:
                if not self.slot_save():
                    return  # ?? ??
            elif reply == QMessageBox.No:
                pass
            else:
                return  # ?? ??
        self.init_setting()
项目:urh    作者:jopohl    | 项目源码 | 文件源码
def my_close(self):
        settings = constants.SETTINGS
        not_show = settings.value('not_show_close_dialog', False, type=bool)

        if not not_show:
            cb = QCheckBox("Do not show this again.")
            msgbox = QMessageBox(QMessageBox.Question, "Confirm close", "Are you sure you want to close?")
            msgbox.addButton(QMessageBox.Yes)
            msgbox.addButton(QMessageBox.No)
            msgbox.setDefaultButton(QMessageBox.No)
            msgbox.setCheckBox(cb)

            reply = msgbox.exec()

            not_show_again = bool(cb.isChecked())
            settings.setValue("not_show_close_dialog", not_show_again)
            self.not_show_again_changed.emit()
            if reply != QMessageBox.Yes:
                return

        self.closed.emit(self)
项目:urh    作者:jopohl    | 项目源码 | 文件源码
def save_protocol(self):
        for msg in self.proto_analyzer.messages:
            if not msg.decoder.is_nrz:
                reply = QMessageBox.question(self, "Saving of protocol",
                                             "You want to save this protocol with an encoding different from NRZ.\n"
                                             "This may cause loss of information if you load it again.\n\n"
                                             "Save anyway?", QMessageBox.Yes | QMessageBox.No)
                if reply != QMessageBox.Yes:
                    return
                else:
                    break

        text = "protocol"
        filename = FileOperator.get_save_file_name("{0}.proto.xml".format(text), caption="Save protocol")

        if not filename:
            return

        self.proto_analyzer.to_xml_file(filename=filename, decoders=self.decodings,
                                        participants=self.project_manager.participants, write_bits=True)
项目:urh    作者:jopohl    | 项目源码 | 文件源码
def save_before_close(self):
        if not self.already_saved and self.device.current_index > 0:
            reply = QMessageBox.question(self, self.tr("Save data?"),
                                         self.tr("Do you want to save the data you have captured so far?"),
                                         QMessageBox.Yes | QMessageBox.No | QMessageBox.Abort)
            if reply == QMessageBox.Yes:
                self.on_save_clicked()
            elif reply == QMessageBox.Abort:
                return False

        try:
            sample_rate = self.device.sample_rate
        except:
            sample_rate = 1e6

        self.files_recorded.emit(self.recorded_files, sample_rate)
        return True
项目:BigBrotherBot-For-UrT43    作者:ptitbigorneau    | 项目源码 | 文件源码
def process_delete(self, process):
        """
        Handle the removal of a B3 process.
        """
        msgbox = QMessageBox()
        msgbox.setIcon(QMessageBox.Question)
        msgbox.setWindowTitle('CONFIRM')
        msgbox.setText('Are you sure?')
        msgbox.setInformativeText('Do you want to remove %s?' % process.name)
        msgbox.setStandardButtons(QMessageBox.No|QMessageBox.Yes)
        msgbox.setDefaultButton(QMessageBox.No)
        msgbox.layout().addItem(QSpacerItem(300, 0, QSizePolicy.Minimum, QSizePolicy.Expanding),
                                msgbox.layout().rowCount(), 0, 1, msgbox.layout().columnCount())
        msgbox.exec_()

        if msgbox.result() == QMessageBox.Yes:
            if process.state() != QProcess.NotRunning:
                self.process_shutdown(process)
            process.delete()
            self.repaint()
项目:pyzcto    作者:miguelmarco    | 项目源码 | 文件源码
def importmultisig(self):
        n = self.spinBox_multisign.value()
        addresses = str(self.plainTextEdit_multisigkeys.toPlainText()).splitlines()
        for i in range(len(addresses)):
            if addresses[i] in self.pubkeys:
                addresses[i] = self.pubkeys[addresses[i]]
        self.pushButton_importmultisig.setEnabled(False)
        res = self.callzcash('addmultisigaddress', [n,addresses])
        multisigaddress = str(self.lineEdit_multisigaddress.text())
        messagebox = QMessageBox()
        messagebox.setText("Importing address.\n\nDo you want to rescan the blockchain? \n\n Rescanning the blockchain allows to use the funds sent to the multisig address before this moment but will take several minutes. The program will be irresponsive during that time.\n\n If you don't rescan the blockchain, you will still be able to create payment orders for the funds that will be received in the future, or to sign orders created by other signers.")
        messagebox.setWindowTitle("")
        messagebox.setStandardButtons(QMessageBox.Yes | QMessageBox.No)
        rescan = messagebox.exec_() == QMessageBox.Yes
        self.callzcash('importaddress', [multisigaddress, "", rescan])

        self.update()
项目:ucasAutoLog    作者:CheerL    | 项目源码 | 文件源码
def cancel_update(self):
        if not self.finish:
            reply = QMessageBox.question(
                self, '????', '???????', QMessageBox.Yes | QMessageBox.No, QMessageBox.No)
            if reply == QMessageBox.Yes:
                pl.kill_thread(name='update')
                self.timer.stop()
                STATUS.UPDATE, STATUS.UPDATE_ALL, STATUS.UPDATE_NOW = None, 0, 0
                self.close()
        else:
            self.close()

        if STATUS.UPDATE_DLG:
            STATUS.UPDATE_DLG.close()
            STATUS.UPDATE_DLG = None
        if STATUS.MAIN:
            STATUS.MAIN.user_info_table_update()
            STATUS.MAIN.show_update_result()
项目:Thread-Chat-Client    作者:Nyamcat    | 项目源码 | 文件源码
def with_btn_click(self):
        if self.input_PW.text() == '':
            QMessageBox.warning(self, '?? ??', '????? ??? ???')
            return

        answer = QMessageBox.warning(self, '?? ??', '??? ?? ???????\n??? ??? ??? ??????.', QMessageBox.Ok|QMessageBox.No)
        if (answer == QMessageBox.No):
            return
        else:
            mysocket.sendMsg(s, '2', key)
            mysocket.sendMsg(s, self.input_PW.text(), key)
            result = mysocket.getMsg(s, key)
            if result == 'PW different' or result == 'PW different ':
                print(result)
                QMessageBox.warning(self, '?? ??', '?? ?? ??')
                return
            else:
                QMessageBox.information(self, '?? ??', '???? ??????. ??~')
                self.hide()
                tmp = MainWidget()
                tmp.hide()
                tmp = Login()
                tmp.run()
项目:Thread-Chat-Client    作者:Nyamcat    | 项目源码 | 文件源码
def with_btn_click(self):
        if self.input_PW.text() == '':
            QMessageBox.warning(self, '?? ??', '????? ??? ???')
            return

        answer = QMessageBox.warning(self, '?? ??', '??? ?? ???????\n??? ??? ??? ??????.', QMessageBox.Ok|QMessageBox.No)
        if (answer == QMessageBox.No):
            return
        else:
            QMessageBox.information(self, '??? ??', '?? ????')
            """
            mysocket.sendMsg(s, '2', key)
            mysocket.sendMsg(s, self.input_PW.text(), key)
            result = mysocket.getMsg(s, key)
            if result == 'PW different' or result == 'PW different ':
                QMessageBox.warning(self, '?? ??', '?? ?? ??')
                return
            else:
                QMessageBox.information(self, '?? ??', '???? ??????. ??~')
                ??? ???.
            """
项目:StudentsManager    作者:Zaeworks    | 项目源码 | 文件源码
def onDelete(self):
        student = self.selection
        if not student:
            return
        confirm = QMessageBox.warning(QtWidgets.QWidget(),
                                      "????", "????????",
                                      QMessageBox.Yes | QMessageBox.No)
        if confirm == QMessageBox.Yes:
            item = self.tableIndex[student]
            n = self.studentTable.topLevelItemCount()
            for i in range(0, n):
                if self.studentTable.topLevelItem(i) == item:
                    self.studentTable.takeTopLevelItem(i)
                    self.tableList.remove(student)
                    self.tableIndex.pop(student)
                    break
            public.studentManager.delete(student)
项目:coliform-project    作者:uprm-research-resto    | 项目源码 | 文件源码
def tempPlot(self):
        try:
            self.y_title_axis = ['Temperature Plot', 'Temperature vs Time', 't(s)', 'T(C)', 'Sensor']
            MultiPlot.Plot(self.tf, len(self.ids), self.y_title_axis)
        except KeyError:
            mb = QMessageBox()
            mb.setIcon(QMessageBox.Information)
            mb.setWindowTitle('Error')
            mb.setText('No temperature sensor connected.')
            mb.setStandardButtons(QMessageBox.Ok)
            mb.show()
项目:coliform-project    作者:uprm-research-resto    | 项目源码 | 文件源码
def closeEvent(self, event):
        reply = QMessageBox.question(self, 'Message', 'Are you sure you want to quit?',
                                     QMessageBox.Yes | QMessageBox.No, QMessageBox.No)
        if reply == QMessageBox.Yes:
            event.accept()
        else:
            event.ignore()
项目:coliform-project    作者:uprm-research-resto    | 项目源码 | 文件源码
def closeEvent(self, event):
        reply = QMessageBox.question(self, 'Message', 'Are you sure you want to quit?',
                                     QMessageBox.Yes | QMessageBox.No, QMessageBox.No)
        if reply == QMessageBox.Yes:
            event.accept()
        else:
            event.ignore()

    # def quitApp(self):
    #     QCoreApplication.instance().quit()
项目:coliform-project    作者:uprm-research-resto    | 项目源码 | 文件源码
def closeEvent(self, event):
        reply = QMessageBox.question(self, 'Message', 'Are you sure you want to quit?',
                                     QMessageBox.Yes | QMessageBox.No, QMessageBox.No)
        if reply == QMessageBox.Yes:
            event.accept()
        else:
            event.ignore()

    # def quitApp(self):
    #     QCoreApplication.instance().quit()
项目:incubator-senssoft-userale-pyqt5    作者:apache    | 项目源码 | 文件源码
def closeEvent(self, event):

        reply = QMessageBox.question(self, 'Message',
            "Are you sure to quit?", QMessageBox.Yes | 
            QMessageBox.No, QMessageBox.No)

        if reply == QMessageBox.Yes:
            event.accept()
        else:
            event.ignore()
项目:face    作者:MOluwole    | 项目源码 | 文件源码
def Exit(self):
        reply = QMessageBox.question(self, "Exit?", "Would you like to exit?", QMessageBox.Yes | QMessageBox.No,
                                     QMessageBox.No)
        if reply == QMessageBox.Yes:
            sys.exit()
            # sys.exit()
项目:Remote_raspberrypi_GPIO_Control    作者:Rahul14singh    | 项目源码 | 文件源码
def closeEvent(self, event):
        reply = QMessageBox.question(self, 'Message',
            "Are you sure to quit?", QMessageBox.Yes | 
            QMessageBox.No, QMessageBox.No)
        if reply == QMessageBox.Yes:
            if success==1:
                self.Connect.ssh.close()
            event.accept()
        else:
            event.ignore()
项目:VIRTUAL-PHONE    作者:SumanKanrar-IEM    | 项目源码 | 文件源码
def initUI(self):
        self.setWindowTitle(self.title)
        self.setGeometry(self.left, self.top, self.width, self.height)

        buttonReply = QMessageBox.question(self, 'PyQt5 message', "Do you want to save?", QMessageBox.YesToAll | QMessageBox.No | QMessageBox.Cancel, QMessageBox.Cancel)
        print(int(buttonReply))
        if buttonReply == QMessageBox.Yes:
            print('Yes clicked.')
        if buttonReply == QMessageBox.No:
            print('No clicked.')
        if buttonReply == QMessageBox.Cancel:
            print('Cancel')

        self.show()
项目:gpvdm    作者:roderickmackenzie    | 项目源码 | 文件源码
def yes_no_dlg(parent,text):
    msgBox = QMessageBox(parent)
    msgBox.setIcon(QMessageBox.Question)
    msgBox.setText("Question")
    msgBox.setInformativeText(text)
    msgBox.setStandardButtons(QMessageBox.Yes| QMessageBox.No )
    msgBox.setDefaultButton(QMessageBox.No)
    reply = msgBox.exec_()
    if reply == QMessageBox.Yes:
        return True
    else:
        return False
项目:gpvdm    作者:roderickmackenzie    | 项目源码 | 文件源码
def yes_no_cancel_dlg(parent,text):
    msgBox = QMessageBox(parent)
    msgBox.setIcon(QMessageBox.Question)
    msgBox.setText("Question")
    msgBox.setInformativeText(text)
    msgBox.setStandardButtons(QMessageBox.Yes| QMessageBox.No| QMessageBox.Cancel  )
    msgBox.setDefaultButton(QMessageBox.No)
    reply = msgBox.exec_()
    if reply == QMessageBox.Yes:
        return "yes"
    elif reply == QMessageBox.No:
        return "no"
    else:
        return "cancel"
项目:ciba    作者:FindHao    | 项目源码 | 文件源码
def refresh_window(self, text):
        """???????"""
        # ???????
        self.setFixedSize(400, 300)
        cur = QtGui.QCursor.pos()
        x = cur.x() + 20
        y = cur.y() + 20
        # ????????????????
        window_h = QDesktopWidget().screenGeometry().height()
        window_w = QDesktopWidget().screenGeometry().width()
        if x + 400 > window_h or y + 300 > window_w:
            x -= 20 + 400
            y -= 20 + 300
        self.move(x, y)

        self.setWindowTitle("search for:")
        self.search_words.setText(text)
        # ???????
        self.voice_play2.hide()
        self.voice_play1.hide()
        if len(self.query.word.voices) >= 2:
            self.voice_label1.setText(self.query.word.voices[1][0])
            self.voice_label2.setText(self.query.word.voices[0][0])
            print(self.query.word.voices[1][0])
            # self.voice_play1.clicked.connect(lambda: self.play_voice(self.query.word.voices[0][1]))
            # self.voice_play2.clicked.connect(lambda: self.play_voice(self.query.word.voices[1][1]))
            self.play_voice(self.query.word.voices[1][1])
        elif len(self.query.word.voices) == 1:
            print("lenth 1")
            self.voice_label1.setText(self.query.word.voices[0][0])
            # self.voice_play1.clicked.connect(lambda: self.play_voice(self.query.word.voices[0][1]))
            self.play_voice(self.query.word.voices[0][1])
        else:
            self.voice_label1.setText("No voices found.")

        base_info = ''
        for x in self.query.word.props:
            base_info += x + self.query.word.props[x] + '\n'
        self.base_infor_label.setText(base_info)
项目:pysport    作者:sportorg    | 项目源码 | 文件源码
def auto_save(self):
        main_window = self.get_main_window()
        if not main_window:
            return
        if not main_window.get_configuration().get('autosave'):
            return
        if main_window.file:
            main_window.save_file()
            logging.info(_('Auto save'))
        else:
            logging.warning(_('No file to auto save'))
项目:opcua-modeler    作者:FreeOpcUa    | 项目源码 | 文件源码
def try_close_model(self):
        if self._model_mgr.modified:
            reply = QMessageBox.question(
                self.modeler,
                "OPC UA Modeler",
                "Model is modified, do you really want to close model?",
                QMessageBox.Yes | QMessageBox.No | QMessageBox.Cancel
            )
            if reply != QMessageBox.Yes:
                return False
        self._model_mgr.close_model(force=True)
        return True
项目:ovirt-desktop-client    作者:nkovacne    | 项目源码 | 文件源码
def confirm_quit(self):
        """
            Description: Confirm whether to quit or not the app. This option must be present
                         in case the user cannot authenticate against oVirt, in which case the
                         main window won't be shown but the application will exit instead.
            Arguments: None
            Returns: Nothing, just quits if user confirms.
        """

        cq = QMessageBox.question(self, _('apptitle') + ': ' + _('confirm'), _('confirm_quit'), QMessageBox.Yes | QMessageBox.No, QMessageBox.No)
        if cq == QMessageBox.Yes:
            quit()
项目:ovirt-desktop-client    作者:nkovacne    | 项目源码 | 文件源码
def change_status(self, rowid):
        """
            Description: If the user clicks on the column which determines VM's status, we'll allow them
                         to change VM's status. This method shows a confirmation dialog and if accepted,
                         it will be notified to oVirt.
            Arguments: The row id that has been clicked. This relationship is stored using the VmData class.
            Returns: Nothing
        """

        global conf

        self.lastclick = int(time())         # Last click timestamp update

        curvmstatus = self.vmdata[rowid].vmstatus
        if curvmstatus != 'up' and curvmstatus != 'down':
            QMessageBox.warning(None, _('apptitle') + ': ' + _('warning'), _('vm_in_unchangeable_status'))
            return

        reply = QMessageBox.question(None, _('apptitle') + ': ' + _('confirm'), '%s <b>%s</b>. %s: <b>%s</b>.' % (_('current_vm_status'), self.current_vm_status(curvmstatus), _('confirm_vm_status_change'), self.toggle_vm_action(curvmstatus)), QMessageBox.Yes | QMessageBox.No, QMessageBox.No)

        if reply == QMessageBox.Yes:
            try:
                vm = conf.OVIRTCONN.vms.get(id=self.vmdata[rowid].vmid)
            except ConnectionError:
                QMessageBox.critical(None, _('apptitle') + ': ' + _('error'), _('unexpected_connection_drop'))
                quit()

            if curvmstatus == 'up':
                try:
                    vm.shutdown()
                    QMessageBox.information(None, _('apptitle') + ': ' + _('success'), _('shutting_down_vm'))
                except RequestError:
                    QMessageBox.warning(None, _('apptitle') + ': ' + _('warning'), _('vm_in_unchangeable_status'))
            if curvmstatus == 'down':
                try:
                    vm.start()
                    QMessageBox.information(None, _('apptitle') + ': ' + _('success'), _('powering_up_vm'))
                except RequestError:
                    QMessageBox.warning(None, _('apptitle') + ': ' + _('warning'), _('vm_in_unchangeable_status'))
项目:py301    作者:PFLC    | 项目源码 | 文件源码
def closeEvent(self, event):

        reply = QMessageBox.question(self, 'Message',
            "Are you sure to quit?", QMessageBox.Yes | 
            QMessageBox.No, QMessageBox.No)

        if reply == QMessageBox.Yes:
            event.accept()
        else:
            event.ignore()
项目:DownloaderForReddit    作者:MalloyDelacroix    | 项目源码 | 文件源码
def no_subreddit_list(self):
        reply = message.warning(self, 'No Subreddit List', no_subreddit_list_message, message.Ok)
        return reply == message.Ok
项目:DownloaderForReddit    作者:MalloyDelacroix    | 项目源码 | 文件源码
def no_user_selected(self):
        reply = message.information(self, 'No User Selected', no_user_selected_message, message.Ok)
        return reply == message.Ok
项目:DownloaderForReddit    作者:MalloyDelacroix    | 项目源码 | 文件源码
def no_subreddit_selected(self):
        reply = message.information(self, 'No Subreddit Selected', no_subreddit_selected_message, message.Ok)
        return reply == message.Ok
项目:DownloaderForReddit    作者:MalloyDelacroix    | 项目源码 | 文件源码
def user_not_valid(self, user):
        text = '%s is not a valid user. Would you like to remove this user from the user list?' % user
        reply = message.information(self, 'Invalid User', text, message.Yes, message.No)
        return reply == message.Ok
项目:DownloaderForReddit    作者:MalloyDelacroix    | 项目源码 | 文件源码
def subreddit_not_valid(self, sub):
        text = '%s is not a valid subreddit. Would you like to remove this sub from the subreddit list?' % sub
        reply = message.information(self, 'Invalid Subreddit', text, message.Yes, message.No)
        return reply == message.Ok
项目:DownloaderForReddit    作者:MalloyDelacroix    | 项目源码 | 文件源码
def no_imgur_client(self):
        text = 'No Imgur client is detected. You must have an Imgur client in order to download content from ' \
               'imgur.com. Please see settings menu and click on the "Imgur Client Information" in the top right for ' \
               'instuctions on how to obtain an imgur client and enter its credentials for use with this application'
        reply = message.information(self, 'No Imgur Client', text, message.Ok)
        return reply == message.Ok
项目:DownloaderForReddit    作者:MalloyDelacroix    | 项目源码 | 文件源码
def unsaved_close_message(self):
        text = "Save changes to Downloader For Reddit?"
        reply = message.question(self, "Save Changes?", text, message.Yes | message.No | message.Cancel, message.Cancel)
        if reply == message.Yes:
            return "SAVE"
        elif reply == message.No:
            return "CLOSE"
        else:
            return "CANCEL"
项目:inshack-2017    作者:HugoDelval    | 项目源码 | 文件源码
def sigint_handler(*args):
    """Handler for the SIGINT signal."""
    sys.stderr.write('\r')
    if QMessageBox.question(None, '', "Are you sure you want to quit?",
                            QMessageBox.Yes | QMessageBox.No,
                            QMessageBox.No) == QMessageBox.Yes:
        QApplication.quit()
项目:inshack-2017    作者:HugoDelval    | 项目源码 | 文件源码
def sigint_handler(*args):
    """Handler for the SIGINT signal."""
    sys.stderr.write('\r')
    if QMessageBox.question(None, '', "Are you sure you want to quit?",
                            QMessageBox.Yes | QMessageBox.No,
                            QMessageBox.No) == QMessageBox.Yes:
        QApplication.quit()
项目:UM3NetworkPrintingPlugin    作者:Ultimaker    | 项目源码 | 文件源码
def _onAuthenticationRequired(self, reply, authenticator):
        if self._authentication_id is not None and self._authentication_key is not None:
            Logger.log("d", "Authentication was required. Setting up authenticator.")
            authenticator.setUser(self._authentication_id)
            authenticator.setPassword(self._authentication_key)
        else:
            Logger.log("d", "No authentication was required. The id is: %s", self._authentication_id)
项目:UM3NetworkPrintingPlugin    作者:Ultimaker    | 项目源码 | 文件源码
def materialHotendChangedMessage(self, callback):
        Application.getInstance().messageBox(i18n_catalog.i18nc("@window:title", "Changes on the Printer"),
            i18n_catalog.i18nc("@label",
                "Would you like to update your current printer configuration into Cura?"),
            i18n_catalog.i18nc("@label",
                "The PrintCores and/or materials on your printer were changed. For the best result, always slice for the PrintCores and materials that are inserted in your printer."),
            buttons=QMessageBox.Yes + QMessageBox.No,
            icon=QMessageBox.Question,
            callback=callback
        )
项目:urh    作者:jopohl    | 项目源码 | 文件源码
def save_all(self):
        if self.num_frames == 0:
            return

        settings = constants.SETTINGS
        try:
            not_show = settings.value('not_show_save_dialog', type=bool, defaultValue=False)
        except TypeError:
            not_show = False

        if not not_show:
            cb = QCheckBox("Don't ask me again.")
            msg_box = QMessageBox(QMessageBox.Question, self.tr("Confirm saving all signals"),
                                  self.tr("All changed signal files will be overwritten. OK?"))
            msg_box.addButton(QMessageBox.Yes)
            msg_box.addButton(QMessageBox.No)
            msg_box.setCheckBox(cb)

            reply = msg_box.exec()
            not_show_again = cb.isChecked()
            settings.setValue("not_show_save_dialog", not_show_again)
            self.not_show_again_changed.emit()

            if reply != QMessageBox.Yes:
                return

        for f in self.signal_frames:
            if f.signal is None or f.signal.filename == "":
                continue
            f.signal.save()
项目:urh    作者:jopohl    | 项目源码 | 文件源码
def __set_decoding_error_label(self, message: Message):
        if message:
            errors = message.decoding_errors
            percent = 100 * (errors / len(message))
            state = message.decoding_state if message.decoding_state != message.decoder.ErrorState.SUCCESS else ""
            color = "green" if errors == 0 and state == "" else "red"

            self.ui.lDecodingErrorsValue.setStyleSheet("color: " + color)
            self.ui.lDecodingErrorsValue.setText(locale.format_string("%d (%.02f%%) %s", (errors, percent, state)))
        else:
            self.ui.lDecodingErrorsValue.setText("No message selected")
项目:BigBrotherBot-For-UrT43    作者:ptitbigorneau    | 项目源码 | 文件源码
def __init_storage(self):
        """
        Initialize the connection with the SQLite database.
        :raise DatabaseError: if the database schema is not consistent.
        """
        is_new_database = not os.path.isfile(B3_STORAGE)
        self.storage = sqlite3.connect(B3_STORAGE, check_same_thread=False)
        self.storage.isolation_level = None  # set autocommit mode
        self.storage.row_factory = sqlite3.Row  # allow row index by name
        if is_new_database:
            # create new schema
            self.__build_schema()
        else:
            # check database schema
            LOG.debug('checking database schema')
            cursor = self.storage.cursor()
            cursor.execute("""SELECT * FROM sqlite_master WHERE type='table'""")
            tables = [row[1] for row in cursor.fetchall()]
            cursor.close()

            if 'b3' not in tables:
                LOG.debug('database schema is corrupted: asking the user if he wants to rebuild it')

                msgbox = QMessageBox()
                msgbox.setIcon(QMessageBox.Critical)
                msgbox.setText('The database schema is corrupted and must be rebuilt. Do you want to proceed?')
                msgbox.setInformativeText('NOTE: all the previously saved data will be lost!')
                msgbox.setStandardButtons(QMessageBox.No | QMessageBox.Yes)
                msgbox.setDefaultButton(QMessageBox.No)
                msgbox.exec_()

                if msgbox.result() == QMessageBox.No:
                    # critical will raise an exception which will terminate the QApplication
                    LOG.critical('could not start B3: database schema is corrupted!')

                try:
                    os.remove(B3_STORAGE)
                    self.__build_schema()
                except Exception, err:
                    raise LOG.critical('could initialize SQLite database: %s (%s): make sure B3 has permissions to '
                                       'operate on this file, or remove it manually', B3_STORAGE, err)
项目:Visualization    作者:nwrush    | 项目源码 | 文件源码
def _warn_existing_output_dir(self, path):
        path = os.path.abspath(path)
        reply = QMessageBox.question(self, "Reuse previous data",
                                     "Intermediate files were found at\n{0}\nDo you want to reuse them?".format(path),
                                     QMessageBox.Yes | QMessageBox.No, QMessageBox.No)
        reuse = int(reply) == QMessageBox.Yes
        if not reuse:
            shutil.rmtree(path)