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


Python TemplateDialog.exec_方法代码示例

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


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

示例1: show_template_editor

# 需要导入模块: from calibre.gui2.dialogs.template_dialog import TemplateDialog [as 别名]
# 或者: from calibre.gui2.dialogs.template_dialog.TemplateDialog import exec_ [as 别名]
    def show_template_editor(self, *args):
        view = self.gui.current_view()
        if view is not self.gui.library_view:
            return error_dialog(self.gui, _('No template tester available'),
                _('Template tester is not available for books '
                  'on the device.')).exec_()

        rows = view.selectionModel().selectedRows()
        if not rows:
            return error_dialog(self.gui, _('No books selected'),
                    _('One book must be selected'), show=True)
        if len(rows) > 1:
            return error_dialog(self.gui, _('Selected multiple books'),
                    _('Only one book can be selected'), show=True)

        index = rows[0]
        if index.isValid():
            db = view.model().db
            t = TemplateDialog(self.gui, self.previous_text,
                   mi=db.get_metadata(index.row(), index_is_id=False, get_cover=False),
                   text_is_placeholder=self.first_time)
            t.setWindowTitle(_('Template tester'))
            if t.exec_() == t.Accepted:
                self.previous_text = t.rule[1]
                self.first_time = False
开发者ID:AtulKumar2,项目名称:calibre,代码行数:27,代码来源:show_template_tester.py

示例2: add_advanced

# 需要导入模块: from calibre.gui2.dialogs.template_dialog import TemplateDialog [as 别名]
# 或者: from calibre.gui2.dialogs.template_dialog.TemplateDialog import exec_ [as 别名]
 def add_advanced(self):
     if self.pref_name == 'column_color_rules':
         td = TemplateDialog(self, '', mi=self.mi, fm=self.fm, color_field='')
         if td.exec_() == td.Accepted:
             col, r = td.rule
             if r and col:
                 idx = self.model.add_rule('color', col, r)
                 self.rules_view.scrollTo(idx)
                 self.changed.emit()
     else:
         td = TemplateDialog(self, '', mi=self.mi, fm=self.fm, icon_field_key='')
         if td.exec_() == td.Accepted:
             print(td.rule)
             typ, col, r = td.rule
             if typ and r and col:
                 idx = self.model.add_rule(typ, col, r)
                 self.rules_view.scrollTo(idx)
                 self.changed.emit()
开发者ID:amorphous1,项目名称:calibre,代码行数:20,代码来源:coloring.py

示例3: createEditor

# 需要导入模块: from calibre.gui2.dialogs.template_dialog import TemplateDialog [as 别名]
# 或者: from calibre.gui2.dialogs.template_dialog.TemplateDialog import exec_ [as 别名]
 def createEditor(self, parent, option, index):
     m = index.model()
     mi = m.db.get_metadata(index.row(), index_is_id=False)
     text = m.custom_columns[m.column_map[index.column()]]['display']['composite_template']
     editor = TemplateDialog(parent, text, mi)
     editor.setWindowTitle(_("Edit template"))
     editor.textbox.setTabChangesFocus(False)
     editor.textbox.setTabStopWidth(20)
     d = editor.exec_()
     if d:
         m.setData(index, (editor.rule[1]), Qt.EditRole)
     return None
开发者ID:Aliminator666,项目名称:calibre,代码行数:14,代码来源:delegates.py

示例4: show_template_editor

# 需要导入模块: from calibre.gui2.dialogs.template_dialog import TemplateDialog [as 别名]
# 或者: from calibre.gui2.dialogs.template_dialog.TemplateDialog import exec_ [as 别名]
    def show_template_editor(self, *args):
        view = self.gui.current_view()
        if view is not self.gui.library_view:
            return error_dialog(self.gui, _('No template tester available'),
                _('Template tester is not available for books '
                  'on the device.')).exec_()

        rows = view.selectionModel().selectedRows()
        if not rows:
            return error_dialog(self.gui, _('No books selected'),
                    _('One book must be selected'), show=True)
        if len(rows) > 1:
            return error_dialog(self.gui, _('Selected multiple books'),
                    _('Only one book can be selected'), show=True)

        index = rows[0]
        if index.isValid():
            db = view.model().db
            t = TemplateDialog(self.gui,
                   _('Enter a template to test using data from the selected book'),
                   mi=db.get_metadata(index.row(), index_is_id=False, get_cover=False))
            t.setWindowTitle(_('Template tester'))
            t.exec_()
开发者ID:GaryMMugford,项目名称:calibre,代码行数:25,代码来源:show_template_tester.py

示例5: change_template

# 需要导入模块: from calibre.gui2.dialogs.template_dialog import TemplateDialog [as 别名]
# 或者: from calibre.gui2.dialogs.template_dialog.TemplateDialog import exec_ [as 别名]
 def change_template(self, which):
     from calibre.gui2.dialogs.template_dialog import TemplateDialog
     from calibre.gui2.ui import get_gui
     gui = get_gui()
     if gui is None:
         from calibre.ebooks.metadata.book.base import field_metadata
     else:
         field_metadata = gui.current_db.new_api.field_metadata
     attr = which + '_template'
     templ = getattr(self, attr).text()
     d = TemplateDialog(self, templ, mi=self.mi, fm=field_metadata)
     if d.exec_() == d.Accepted:
         templ = d.rule[1]
         getattr(self, attr).setText(templ)
         self.emit_changed()
开发者ID:GRiker,项目名称:calibre,代码行数:17,代码来源:covers.py

示例6: edit_template

# 需要导入模块: from calibre.gui2.dialogs.template_dialog import TemplateDialog [as 别名]
# 或者: from calibre.gui2.dialogs.template_dialog.TemplateDialog import exec_ [as 别名]
 def edit_template(self):
     t = TemplateDialog(self, self.template)
     t.setWindowTitle(_("Edit template"))
     if t.exec_():
         self.t.setText(t.rule[1])
开发者ID:hashken,项目名称:calibre,代码行数:7,代码来源:mtp_config.py

示例7: open_editor

# 需要导入模块: from calibre.gui2.dialogs.template_dialog import TemplateDialog [as 别名]
# 或者: from calibre.gui2.dialogs.template_dialog.TemplateDialog import exec_ [as 别名]
 def open_editor(self):
     t = TemplateDialog(self, self.text(), mi=self.mi)
     t.setWindowTitle(_('Edit template'))
     if t.exec_():
         self.setText(t.rule[1])
开发者ID:AtulKumar2,项目名称:calibre,代码行数:7,代码来源:template_line_editor.py

示例8: edit_cb_title_template

# 需要导入模块: from calibre.gui2.dialogs.template_dialog import TemplateDialog [as 别名]
# 或者: from calibre.gui2.dialogs.template_dialog.TemplateDialog import exec_ [as 别名]
 def edit_cb_title_template(self):
     t = TemplateDialog(self, self.opt_cover_browser_title_template.text(), fm=self.gui.current_db.field_metadata)
     t.setWindowTitle(_('Edit template for caption'))
     if t.exec_():
         self.opt_cover_browser_title_template.setText(t.rule[1])
开发者ID:davidfor,项目名称:calibre,代码行数:7,代码来源:look_feel.py

示例9: do_open_editor

# 需要导入模块: from calibre.gui2.dialogs.template_dialog import TemplateDialog [as 别名]
# 或者: from calibre.gui2.dialogs.template_dialog.TemplateDialog import exec_ [as 别名]
 def do_open_editor(self):
     t = TemplateDialog(self, self.opt_template.text(), fm=self.field_metadata)
     t.setWindowTitle(_('Edit template'))
     if t.exec_():
         self.opt_template.set_value(t.rule[1])
开发者ID:artbycrunk,项目名称:calibre,代码行数:7,代码来源:save_template.py


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