本文整理汇总了Python中calibre.gui2.metadata.basic_widgets.SeriesIndexEdit.reset_original方法的典型用法代码示例。如果您正苦于以下问题:Python SeriesIndexEdit.reset_original方法的具体用法?Python SeriesIndexEdit.reset_original怎么用?Python SeriesIndexEdit.reset_original使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类calibre.gui2.metadata.basic_widgets.SeriesIndexEdit
的用法示例。
在下文中一共展示了SeriesIndexEdit.reset_original方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MetadataSingleDialogBase
# 需要导入模块: from calibre.gui2.metadata.basic_widgets import SeriesIndexEdit [as 别名]
# 或者: from calibre.gui2.metadata.basic_widgets.SeriesIndexEdit import reset_original [as 别名]
#.........这里部分代码省略.........
self.title.set_value(mi.title)
if update_sorts:
self.title_sort.auto_generate()
if not mi.is_null('authors'):
self.authors.set_value(mi.authors)
if not mi.is_null('author_sort'):
self.author_sort.set_value(mi.author_sort)
elif update_sorts and not mi.is_null('authors'):
self.author_sort.auto_generate()
if not mi.is_null('rating'):
try:
self.rating.set_value(mi.rating)
except:
pass
if not mi.is_null('publisher'):
self.publisher.set_value(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.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
示例2: MetadataSingleDialogBase
# 需要导入模块: from calibre.gui2.metadata.basic_widgets import SeriesIndexEdit [as 别名]
# 或者: from calibre.gui2.metadata.basic_widgets.SeriesIndexEdit import reset_original [as 别名]
#.........这里部分代码省略.........
if not mi.is_null("title"):
self.title.current_val = mi.title
if update_sorts:
self.title_sort.auto_generate()
if not mi.is_null("authors"):
self.authors.current_val = mi.authors
if not mi.is_null("author_sort"):
self.author_sort.current_val = mi.author_sort
elif update_sorts:
self.author_sort.auto_generate()
if not mi.is_null("rating"):
try:
self.rating.current_val = mi.rating
except:
pass
if not mi.is_null("publisher"):
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