本文整理汇总了Python中calibre.gui2.metadata.basic_widgets.Cover.pixmap方法的典型用法代码示例。如果您正苦于以下问题:Python Cover.pixmap方法的具体用法?Python Cover.pixmap怎么用?Python Cover.pixmap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类calibre.gui2.metadata.basic_widgets.Cover
的用法示例。
在下文中一共展示了Cover.pixmap方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MetadataSingleDialogBase
# 需要导入模块: from calibre.gui2.metadata.basic_widgets import Cover [as 别名]
# 或者: from calibre.gui2.metadata.basic_widgets.Cover import pixmap [as 别名]
#.........这里部分代码省略.........
tags = mi.tags if mi.tags else []
if old_tags and merge_tags:
ltags, lotags = {t.lower() for t in tags}, {t.lower() for t in
old_tags}
tags = [t for t in tags if t.lower() in ltags-lotags] + old_tags
self.tags.set_value(tags)
if not mi.is_null('identifiers'):
current = self.identifiers.current_val
current.update(mi.identifiers)
self.identifiers.set_value(current)
if not mi.is_null('pubdate'):
self.pubdate.set_value(mi.pubdate)
if not mi.is_null('series') and mi.series.strip():
self.series.set_value(mi.series)
if mi.series_index is not None:
self.series_index.reset_original()
self.series_index.set_value(float(mi.series_index))
if not mi.is_null('languages'):
langs = [canonicalize_lang(x) for x in mi.languages]
langs = [x for x in langs if x is not None]
if langs:
self.languages.set_value(langs)
if mi.comments and mi.comments.strip():
val = mi.comments
if val and merge_comments:
cval = self.comments.current_val
if cval:
val = merge_two_comments(cval, val)
self.comments.set_value(val)
if fw is not None:
fw.setFocus(Qt.OtherFocusReason)
def fetch_metadata(self, *args):
d = FullFetch(self.cover.pixmap(), self)
ret = d.start(title=self.title.current_val, authors=self.authors.current_val,
identifiers=self.identifiers.current_val)
if ret == d.Accepted:
self.metadata_before_fetch = {f:getattr(self, f).current_val for f in fetched_fields}
from calibre.ebooks.metadata.sources.prefs import msprefs
mi = d.book
dummy = Metadata(_('Unknown'))
for f in msprefs['ignore_fields']:
if ':' not in f:
setattr(mi, f, getattr(dummy, f))
if mi is not None:
pd = mi.pubdate
if pd is not None:
# Put the downloaded published date into the local timezone
# as we discard time info and the date is timezone
# invariant. This prevents the as_local_timezone() call in
# update_from_mi from changing the pubdate
mi.pubdate = datetime(pd.year, pd.month, pd.day,
tzinfo=local_tz)
self.update_from_mi(mi, merge_comments=msprefs['append_comments'])
if d.cover_pixmap is not None:
self.metadata_before_fetch['cover'] = self.cover.current_val
self.cover.current_val = pixmap_to_data(d.cover_pixmap)
def undo_fetch_metadata(self):
if self.metadata_before_fetch is None:
return error_dialog(self, _('No downloaded metadata'), _(
'There is no downloaded metadata to undo'), show=True)
for field, val in self.metadata_before_fetch.iteritems():
getattr(self, field).current_val = val
self.metadata_before_fetch = None
示例2: MetadataSingleDialogBase
# 需要导入模块: from calibre.gui2.metadata.basic_widgets import Cover [as 别名]
# 或者: from calibre.gui2.metadata.basic_widgets.Cover import pixmap [as 别名]
#.........这里部分代码省略.........
self.publisher.current_val = mi.publisher
if not mi.is_null("tags"):
old_tags = self.tags.current_val
tags = mi.tags if mi.tags else []
if old_tags and merge_tags:
ltags, lotags = {t.lower() for t in tags}, {t.lower() for t in old_tags}
tags = [t for t in tags if t.lower() in ltags - lotags] + old_tags
self.tags.current_val = tags
if not mi.is_null("identifiers"):
current = self.identifiers.current_val
current.update(mi.identifiers)
self.identifiers.current_val = current
if not mi.is_null("pubdate"):
self.pubdate.current_val = mi.pubdate
if not mi.is_null("series") and mi.series.strip():
self.series.current_val = mi.series
if mi.series_index is not None:
self.series_index.reset_original()
self.series_index.current_val = float(mi.series_index)
if not mi.is_null("languages"):
langs = [canonicalize_lang(x) for x in mi.languages]
langs = [x for x in langs if x is not None]
if langs:
self.languages.current_val = langs
if mi.comments and mi.comments.strip():
val = mi.comments
if val and merge_comments:
cval = self.comments.current_val
if cval:
val = merge_two_comments(cval, val)
self.comments.current_val = val
def fetch_metadata(self, *args):
d = FullFetch(self.cover.pixmap(), self)
ret = d.start(
title=self.title.current_val, authors=self.authors.current_val, identifiers=self.identifiers.current_val
)
if ret == d.Accepted:
from calibre.ebooks.metadata.sources.prefs import msprefs
mi = d.book
dummy = Metadata(_("Unknown"))
for f in msprefs["ignore_fields"]:
if ":" not in f:
setattr(mi, f, getattr(dummy, f))
if mi is not None:
pd = mi.pubdate
if pd is not None:
# Put the downloaded published date into the local timezone
# as we discard time info and the date is timezone
# invariant. This prevents the as_local_timezone() call in
# update_from_mi from changing the pubdate
mi.pubdate = datetime(pd.year, pd.month, pd.day, tzinfo=local_tz)
self.update_from_mi(mi, merge_comments=msprefs["append_comments"])
if d.cover_pixmap is not None:
self.cover.current_val = pixmap_to_data(d.cover_pixmap)
def configure_metadata(self):
from calibre.gui2.preferences import show_config_widget
gui = self.parent()
show_config_widget("Sharing", "Metadata download", parent=self, gui=gui, never_shutdown=True)
def download_cover(self, *args):
from calibre.gui2.metadata.single_download import CoverFetch