本文整理汇总了Python中calibre.gui2.dialogs.tag_editor.TagEditor.exec_方法的典型用法代码示例。如果您正苦于以下问题:Python TagEditor.exec_方法的具体用法?Python TagEditor.exec_怎么用?Python TagEditor.exec_使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类calibre.gui2.dialogs.tag_editor.TagEditor
的用法示例。
在下文中一共展示了TagEditor.exec_方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: tag_editor
# 需要导入模块: from calibre.gui2.dialogs.tag_editor import TagEditor [as 别名]
# 或者: from calibre.gui2.dialogs.tag_editor.TagEditor import exec_ [as 别名]
def tag_editor(self, *args):
d = TagEditor(self, self.db, None)
d.exec_()
if d.result() == QDialog.Accepted:
tag_string = ', '.join(d.tags)
self.tags.setText(tag_string)
self.tags.update_items_cache(self.db.all_tags())
self.remove_tags.update_items_cache(self.db.all_tags())
示例2: createEditor
# 需要导入模块: from calibre.gui2.dialogs.tag_editor import TagEditor [as 别名]
# 或者: from calibre.gui2.dialogs.tag_editor.TagEditor import exec_ [as 别名]
def createEditor(self, parent, option, index):
if self.db and hasattr(self.db, self.items_func_name):
m = index.model()
col = m.column_map[index.column()]
# If shifted, bring up the tag editor instead of the line editor.
if check_key_modifier(Qt.ShiftModifier) and col != 'authors':
key = col if m.is_custom_column(col) else None
d = TagEditor(parent, self.db, m.id(index.row()), key=key)
if d.exec_() == TagEditor.Accepted:
m.setData(index, self.sep.join(d.tags), Qt.EditRole)
return None
editor = EditWithComplete(parent)
editor.set_separator(self.sep)
editor.set_space_before_sep(self.space_before_sep)
if self.sep == '&':
editor.set_add_separator(tweaks['authors_completer_append_separator'])
if not m.is_custom_column(col):
all_items = getattr(self.db, self.items_func_name)()
else:
all_items = list(self.db.all_custom(
label=self.db.field_metadata.key_to_label(col)))
editor.update_items_cache(all_items)
else:
editor = EnLineEdit(parent)
return editor
示例3: edit
# 需要导入模块: from calibre.gui2.dialogs.tag_editor import TagEditor [as 别名]
# 或者: from calibre.gui2.dialogs.tag_editor.TagEditor import exec_ [as 别名]
def edit(self, widget):
if widget.text():
d = _save_dialog(self.parent, _('Values changed'),
_('You have entered values. In order to use this '
'editor you must first discard them. '
'Discard the values?'))
if d == QMessageBox.Cancel or d == QMessageBox.No:
return
widget.setText('')
d = TagEditor(self.parent, self.db, key=('#'+self.col_metadata['label']))
if d.exec_() == TagEditor.Accepted:
val = d.tags
if not val:
val = []
widget.setText(self.col_metadata['multiple_seps']['list_to_ui'].join(val))
示例4: edit
# 需要导入模块: from calibre.gui2.dialogs.tag_editor import TagEditor [as 别名]
# 或者: from calibre.gui2.dialogs.tag_editor.TagEditor import exec_ [as 别名]
def edit(self):
if (self.getter() != self.initial_val and (self.getter() or self.initial_val)):
d = self._save_dialog(self.parent, _('Values changed'),
_('You have changed the values. In order to use this '
'editor, you must either discard or apply these '
'changes. Apply changes?'))
if d == QMessageBox.Cancel:
return
if d == QMessageBox.Yes:
self.commit(self.book_id)
self.db.commit()
self.initial_val = self.current_val
else:
self.setter(self.initial_val)
d = TagEditor(self.parent, self.db, self.book_id, self.key)
if d.exec_() == TagEditor.Accepted:
self.setter(d.tags)
示例5: edit_tags
# 需要导入模块: from calibre.gui2.dialogs.tag_editor import TagEditor [as 别名]
# 或者: from calibre.gui2.dialogs.tag_editor.TagEditor import exec_ [as 别名]
def edit_tags(self):
from calibre.gui2.dialogs.tag_editor import TagEditor
d = TagEditor(self, get_gui().current_db, current_tags=filter(None, [x.strip() for x in self.query.text().split(',')]))
if d.exec_() == d.Accepted:
self.query.setText(', '.join(d.tags))