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


Python MessageBox.exec_方法代码示例

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


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

示例1: about

# 需要导入模块: from calibre.gui2.dialogs.message_box import MessageBox [as 别名]
# 或者: from calibre.gui2.dialogs.message_box.MessageBox import exec_ [as 别名]
    def about(self):
        '''
        Display a short help message
        '''
        from os.path import join
        from calibre.ptempfile import TemporaryDirectory
        from calibre.gui2.dialogs.message_box import MessageBox
        from calibre_plugins.prince_pdf.help import help_txt, license_txt
        from calibre_plugins.prince_pdf import PrincePDFPlugin
        from calibre_plugins.prince_pdf import __license__

        author = PrincePDFPlugin.author
        version = "%i.%i.%i" % PrincePDFPlugin.version
        license = __license__
        with TemporaryDirectory('xxx') as tdir:
          for x in ('prince_icon.png', 'small_icon.png'):
            with open(join(tdir, x),'w') as f:
              f.write(get_resources('images/' + x))
          help_box = MessageBox(type_ = MessageBox.INFO, \
                                title = _('About the Prince PDF Plugin'), \
                                msg = help_txt % {'author':author, 'version':version, 'license':license, 'dir':tdir, 'code':'style="font-family:monospace ; font-weight:bold"'}, \
                                det_msg = 'Copyright \u00a9 %s\n%s' % (__copyright__, license_txt), \
                                q_icon = self.icon, \
                                show_copy_button = False)
          #help_box.gridLayout.addWidget(help_box.icon_widget,0,0,Qt.AlignTop)
          help_box.gridLayout.setAlignment(help_box.icon_widget,Qt.AlignTop)
          help_box.exec_()
开发者ID:Jellby,项目名称:PrincePDF,代码行数:29,代码来源:main.py

示例2: count_message

# 需要导入模块: from calibre.gui2.dialogs.message_box import MessageBox [as 别名]
# 或者: from calibre.gui2.dialogs.message_box.MessageBox import exec_ [as 别名]
 def count_message(action, count, show_diff=False):
     msg = _('%(action)s %(num)s occurrences of %(query)s' % dict(num=count, query=errfind, action=action))
     if show_diff and count > 0:
         d = MessageBox(MessageBox.INFO, _('Searching done'), prepare_string_for_xml(msg), parent=gui_parent, show_copy_button=False)
         d.diffb = b = d.bb.addButton(_('See what &changed'), d.bb.ActionRole)
         b.setIcon(QIcon(I('diff.png'))), d.set_details(None), b.clicked.connect(d.accept)
         b.clicked.connect(partial(show_current_diff, allow_revert=True))
         d.exec_()
     else:
         info_dialog(gui_parent, _('Searching done'), prepare_string_for_xml(msg), show=True)
开发者ID:GaryMMugford,项目名称:calibre,代码行数:12,代码来源:search.py

示例3: question_dialog

# 需要导入模块: from calibre.gui2.dialogs.message_box import MessageBox [as 别名]
# 或者: from calibre.gui2.dialogs.message_box.MessageBox import exec_ [as 别名]
def question_dialog(parent, title, msg, det_msg='', show_copy_button=False,
        default_yes=True,
        # Skippable dialogs
        # Set skip_dialog_name to a unique name for this dialog
        # Set skip_dialog_msg to a message displayed to the user
        skip_dialog_name=None, skip_dialog_msg=_('Show this confirmation again'),
        skip_dialog_skipped_value=True, skip_dialog_skip_precheck=True,
        # Override icon (QIcon to be used as the icon for this dialog)
        override_icon=None):
    from calibre.gui2.dialogs.message_box import MessageBox

    auto_skip = set(gprefs.get('questions_to_auto_skip', []))
    if (skip_dialog_name is not None and skip_dialog_name in auto_skip):
        return bool(skip_dialog_skipped_value)

    d = MessageBox(MessageBox.QUESTION, title, msg, det_msg, parent=parent,
                    show_copy_button=show_copy_button, default_yes=default_yes,
                    q_icon=override_icon)

    if skip_dialog_name is not None and skip_dialog_msg:
        tc = d.toggle_checkbox
        tc.setVisible(True)
        tc.setText(skip_dialog_msg)
        tc.setChecked(bool(skip_dialog_skip_precheck))

    ret = d.exec_() == d.Accepted

    if skip_dialog_name is not None and not d.toggle_checkbox.isChecked():
        auto_skip.add(skip_dialog_name)
        gprefs.set('questions_to_auto_skip', list(auto_skip))

    return ret
开发者ID:alfaniel,项目名称:calibre,代码行数:34,代码来源:__init__.py

示例4: info_dialog

# 需要导入模块: from calibre.gui2.dialogs.message_box import MessageBox [as 别名]
# 或者: from calibre.gui2.dialogs.message_box.MessageBox import exec_ [as 别名]
def info_dialog(parent, title, msg, det_msg="", show=False, show_copy_button=True):
    from calibre.gui2.dialogs.message_box import MessageBox

    d = MessageBox(MessageBox.INFO, title, msg, det_msg, parent=parent, show_copy_button=show_copy_button)

    if show:
        return d.exec_()
    return d
开发者ID:Kielek,项目名称:calibre,代码行数:10,代码来源:__init__.py

示例5: import_opml

# 需要导入模块: from calibre.gui2.dialogs.message_box import MessageBox [as 别名]
# 或者: from calibre.gui2.dialogs.message_box.MessageBox import exec_ [as 别名]
    def import_opml(self):
        opml_files = choose_files(self, 'OPML chooser dialog',
                _('Select OPML file'), filters=[(_('OPML'), ['opml'])] )

        if not opml_files:
            return
        
        opml = OPML(self.oldest_article.oldest_article, self.max_articles.max_articles);
        for opml_file in opml_files:
            opml.load(opml_file)
            outlines = opml.parse()
            opml.import_recipes(outlines)

        # show a messagebox statingthat import finished
        msg_box = MessageBox(MessageBox.INFO, "Finished", "OPML to Recipe conversion complete", parent=self,
                    show_copy_button=False)
        msg_box.exec_()
开发者ID:ingkebil,项目名称:OPML2Recipe,代码行数:19,代码来源:main.py

示例6: error_dialog

# 需要导入模块: from calibre.gui2.dialogs.message_box import MessageBox [as 别名]
# 或者: from calibre.gui2.dialogs.message_box.MessageBox import exec_ [as 别名]
def error_dialog(parent, title, msg, det_msg='', show=False,
        show_copy_button=True):
    from calibre.gui2.dialogs.message_box import MessageBox
    d = MessageBox(MessageBox.ERROR, _('ERROR:')+ ' ' +
            title, msg, det_msg, parent=parent,
                    show_copy_button=show_copy_button)
    if show:
        return d.exec_()
    return d
开发者ID:piewsook,项目名称:calibre,代码行数:11,代码来源:__init__.py

示例7: warning_dialog

# 需要导入模块: from calibre.gui2.dialogs.message_box import MessageBox [as 别名]
# 或者: from calibre.gui2.dialogs.message_box.MessageBox import exec_ [as 别名]
def warning_dialog(parent, title, msg, det_msg='', show=False,
        show_copy_button=True):
    from calibre.gui2.dialogs.message_box import MessageBox
    d = MessageBox(MessageBox.WARNING, _('WARNING:')+ ' ' +
            title, msg, det_msg, parent=parent,
            show_copy_button=show_copy_button)
    if show:
        return d.exec_()
    return d
开发者ID:piewsook,项目名称:calibre,代码行数:11,代码来源:__init__.py

示例8: do_one

# 需要导入模块: from calibre.gui2.dialogs.message_box import MessageBox [as 别名]
# 或者: from calibre.gui2.dialogs.message_box.MessageBox import exec_ [as 别名]
    def do_one(self):
        try:
            i, book_ids, pd, only_fmts, errors = self.job_data
        except (TypeError, AttributeError):
            return
        if i >= len(book_ids) or pd.wasCanceled():
            pd.setValue(pd.maximum())
            pd.hide()
            self.pd_timer.stop()
            self.job_data = None
            self.gui.library_view.model().refresh_ids(book_ids)
            if i > 0:
                self.gui.status_bar.show_message(ngettext(
                    'Embedded metadata in one book', 'Embedded metadata in {} books', i).format(i), 5000)
            if errors:
                det_msg = '\n\n'.join([_('The {0} format of {1}:\n\n{2}\n').format(
                    (fmt or '').upper(), force_unicode(mi.title), force_unicode(tb)) for mi, fmt, tb in errors])
                from calibre.gui2.dialogs.message_box import MessageBox
                title, msg = _('Failed for some files'), _(
                    'Failed to embed metadata into some book files. Click "Show details" for details.')
                d = MessageBox(MessageBox.WARNING, _('WARNING:')+ ' ' + title, msg, det_msg, parent=self.gui, show_copy_button=True)
                tc = d.toggle_checkbox
                tc.setVisible(True), tc.setText(_('Show the &failed books in the main book list'))
                tc.setChecked(gprefs.get('show-embed-failed-books', False))
                d.resize_needed.emit()
                d.exec_()
                gprefs['show-embed-failed-books'] = tc.isChecked()
                if tc.isChecked():
                    failed_ids = {mi.book_id for mi, fmt, tb in errors}
                    db = self.gui.current_db
                    db.data.set_marked_ids(failed_ids)
                    self.gui.search.set_search_string('marked:true')
            return
        pd.setValue(i)
        db = self.gui.current_db.new_api
        book_id = book_ids[i]

        def report_error(mi, fmt, tb):
            mi.book_id = book_id
            errors.append((mi, fmt, tb))
        db.embed_metadata((book_id,), only_fmts=only_fmts, report_error=report_error)
        self.job_data = (i + 1, book_ids, pd, only_fmts, errors)
开发者ID:j-howell,项目名称:calibre,代码行数:44,代码来源:embed.py

示例9: configure_appearance

# 需要导入模块: from calibre.gui2.dialogs.message_box import MessageBox [as 别名]
# 或者: from calibre.gui2.dialogs.message_box.MessageBox import exec_ [as 别名]
    def configure_appearance(self):
        '''
        '''
        self._log_location()
        appearance_settings = {
                                'appearance_css': default_elements,
                                'appearance_hr_checkbox': False,
                                'appearance_timestamp_format': default_timestamp
                              }

        # Save, hash the original settings
        original_settings = {}
        osh = hashlib.md5()
        for setting in appearance_settings:
            original_settings[setting] = plugin_prefs.get(setting, appearance_settings[setting])
            osh.update(repr(plugin_prefs.get(setting, appearance_settings[setting])))

        # Display the Annotations appearance dialog
        aa = AnnotationsAppearance(self, self.annotations_icon, plugin_prefs)
        cancelled = False
        if aa.exec_():
            # appearance_hr_checkbox and appearance_timestamp_format changed live to prefs during previews
            plugin_prefs.set('appearance_css', aa.elements_table.get_data())
            # Generate a new hash
            nsh = hashlib.md5()
            for setting in appearance_settings:
                nsh.update(repr(plugin_prefs.get(setting, appearance_settings[setting])))
        else:
            for setting in appearance_settings:
                plugin_prefs.set(setting, original_settings[setting])
            nsh = osh

        # If there were changes, and there are existing annotations,
        # and there is an active Annotations field, offer to re-render
        field = get_cc_mapping('annotations', 'field', None)
        if osh.digest() != nsh.digest() and existing_annotations(self.parent, field):
            title = 'Update annotations?'
            msg = '<p>Update existing annotations to new appearance settings?</p>'
            d = MessageBox(MessageBox.QUESTION,
                           title, msg,
                           show_copy_button=False)
            self._log_location("QUESTION: %s" % msg)
            if d.exec_():
                self._log_location("Updating existing annotations to modified appearance")

                # Wait for indexing to complete
                while not self.annotated_books_scanner.isFinished():
                    Application.processEvents()

                move_annotations(self, self.annotated_books_scanner.annotation_map,
                    field, field, window_title="Updating appearance")
开发者ID:DuskyRose,项目名称:calibre-marvin-manager,代码行数:53,代码来源:config.py

示例10: _remove_all_assignments

# 需要导入模块: from calibre.gui2.dialogs.message_box import MessageBox [as 别名]
# 或者: from calibre.gui2.dialogs.message_box.MessageBox import exec_ [as 别名]
    def _remove_all_assignments(self):
        '''
        '''
        self._log_location()
        self.stored_command = 'clear_all_collections'

        # Confirm
        title = "Are you sure?"
        msg = ("<p>Delete all collection assignments from calibre and Marvin?</p>")
        d = MessageBox(MessageBox.QUESTION, title, msg,
                       show_copy_button=False)
        if d.exec_():
            self.calibre_lw.clear()
            self.marvin_lw.clear()
开发者ID:kbw1,项目名称:calibre-marvin-manager,代码行数:16,代码来源:view_collections.py

示例11: forget_service

# 需要导入模块: from calibre.gui2.dialogs.message_box import MessageBox [as 别名]
# 或者: from calibre.gui2.dialogs.message_box.MessageBox import exec_ [as 别名]
    def forget_service(self):
        '''
        Remove the currently selected sync app
        '''
        self._log_location()

        key = str(self.sync_apps.currentText())

        title = "Forget syncing application".format(key)
        msg = ("<p>Forget '{}' syncing application?".format(key))
        dlg = MessageBox(MessageBox.QUESTION, title, msg,
                         parent=self.gui, show_copy_button=False)
        if dlg.exec_():
            # Delete key from prefs
            sync_apps = self.prefs.get('sync_apps', {})
            del sync_apps[key]
            self.prefs.set('sync_apps', sync_apps)

            # Remove from combobox
            index = self.sync_apps.currentIndex()
            self.sync_apps.removeItem(index)
开发者ID:GRiker,项目名称:calibre-syncman,代码行数:23,代码来源:config.py

示例12: add_pdf

# 需要导入模块: from calibre.gui2.dialogs.message_box import MessageBox [as 别名]
# 或者: from calibre.gui2.dialogs.message_box.MessageBox import exec_ [as 别名]
    def add_pdf(self, book_id, pdf_file, exists):
        '''
        Add the PDF file to the book record, asking for replacement
        :param book_id: The book identifier
        :param pdf_file: The path to the PDF file
        :param exists: True if there is already a PDF in the book
        '''
        from calibre.constants import DEBUG
        from calibre.gui2.dialogs.message_box import MessageBox

        add_it = True
        if (exists):
            msg = MessageBox(MessageBox.QUESTION, _('Existing format'),
                             _('The selected book already contains a PDF format. Are you sure you want to replace it?'),
                             _("The temporary file can be found in:\n%s") % pdf_file)
            msg.toggle_det_msg()
            add_it = (msg.exec_())
        if (add_it):
            if DEBUG: print(_('Adding PDF...'))
            self.db.new_api.add_format(book_id, 'pdf', pdf_file)
            self.gui.library_view.model().refresh_ids([book_id])
            self.gui.library_view.refresh_book_details()
            self.gui.tags_view.recount()
开发者ID:Jellby,项目名称:PrincePDF,代码行数:25,代码来源:main.py


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