python类No()的实例源码

global_access.py 文件源码 项目:pysport 作者: sportorg 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
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'))
uamodeler.py 文件源码 项目:opcua-modeler 作者: FreeOpcUa 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
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
credentials.py 文件源码 项目:ovirt-desktop-client 作者: nkovacne 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
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()
ovirtclient.py 文件源码 项目:ovirt-desktop-client 作者: nkovacne 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
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'))
prac5.py 文件源码 项目:py301 作者: PFLC 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
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()
Messages.py 文件源码 项目:DownloaderForReddit 作者: MalloyDelacroix 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def no_subreddit_list(self):
        reply = message.warning(self, 'No Subreddit List', no_subreddit_list_message, message.Ok)
        return reply == message.Ok
Messages.py 文件源码 项目:DownloaderForReddit 作者: MalloyDelacroix 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def no_user_selected(self):
        reply = message.information(self, 'No User Selected', no_user_selected_message, message.Ok)
        return reply == message.Ok
Messages.py 文件源码 项目:DownloaderForReddit 作者: MalloyDelacroix 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def no_subreddit_selected(self):
        reply = message.information(self, 'No Subreddit Selected', no_subreddit_selected_message, message.Ok)
        return reply == message.Ok
Messages.py 文件源码 项目:DownloaderForReddit 作者: MalloyDelacroix 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
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
Messages.py 文件源码 项目:DownloaderForReddit 作者: MalloyDelacroix 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
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
Messages.py 文件源码 项目:DownloaderForReddit 作者: MalloyDelacroix 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
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
Messages.py 文件源码 项目:DownloaderForReddit 作者: MalloyDelacroix 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
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"
cctv_manager_standalone.py 文件源码 项目:inshack-2017 作者: HugoDelval 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
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()
cctv_manager.py 文件源码 项目:inshack-2017 作者: HugoDelval 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
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()
NetworkPrinterOutputDevice.py 文件源码 项目:UM3NetworkPrintingPlugin 作者: Ultimaker 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
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)
NetworkPrinterOutputDevice.py 文件源码 项目:UM3NetworkPrintingPlugin 作者: Ultimaker 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
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
        )
SignalTabController.py 文件源码 项目:urh 作者: jopohl 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
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()
CompareFrameController.py 文件源码 项目:urh 作者: jopohl 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
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")
__init__.py 文件源码 项目:BigBrotherBot-For-UrT43 作者: ptitbigorneau 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
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)
preprocessor_controller.py 文件源码 项目:Visualization 作者: nwrush 项目源码 文件源码 阅读 14 收藏 0 点赞 0 评论 0
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)


问题


面经


文章

微信
公众号

扫码关注公众号