Add options for controlling Anthology book comments on the Standard Columns config tab. (plugin only)

This commit is contained in:
Jim Miller 2016-08-12 21:40:55 -05:00
parent e7941298b6
commit 93712de4b7
4 changed files with 367 additions and 317 deletions

View file

@ -328,6 +328,8 @@ class ConfigWidget(QWidget):
prefs['std_cols_newonly'] = colsnewonly
prefs['set_author_url'] =self.std_columns_tab.set_author_url.isChecked()
prefs['includecomments'] =self.std_columns_tab.includecomments.isChecked()
prefs['anth_comments_newonly'] =self.std_columns_tab.anth_comments_newonly.isChecked()
# Custom Columns tab
# error column
@ -1438,6 +1440,17 @@ class StandardColumnsTab(QWidget):
self.set_author_url.setToolTip(_("Set Calibre Author URL to Author's URL on story site."))
self.set_author_url.setChecked(prefs['set_author_url'])
self.l.addWidget(self.set_author_url)
self.includecomments = QCheckBox(_("Include Books' Comments in Anthology Comments?"),self)
self.includecomments.setToolTip(_('''Include all the merged books' comments in the new book's comments.
Default is a list of included titles only.'''))
self.includecomments.setChecked(prefs['includecomments'])
self.l.addWidget(self.includecomments)
self.anth_comments_newonly = QCheckBox(_("Set Anthology Comments only for new books"),self)
self.anth_comments_newonly.setToolTip(_("Comments will only be set for New Anthologies, not updates.\nThat way comments you set manually are retained."))
self.anth_comments_newonly.setChecked(prefs['anth_comments_newonly'])
self.l.addWidget(self.anth_comments_newonly)
self.l.insertStretch(-1)

View file

@ -2468,18 +2468,33 @@ class FanFicFarePlugin(InterfaceAction):
book['anthology_meta_list'][k]=True
logger.debug("book['url']:%s"%book['url'])
book['comments'] = _("Anthology containing:")+"\n\n"
if len(book['author']) > 1:
mkbooktitle = lambda x : _("%s by %s") % (x['title'],' & '.join(x['author']))
else:
mkbooktitle = lambda x : x['title']
if prefs['includecomments']:
def mkbookcomments(x):
if x['comments']:
return '<b>%s</b>\n\n%s'%(mkbooktitle(x),x['comments'])
else:
return '<b>%s</b>\n'%mkbooktitle(x)
book['comments'] += ('<div class="mergedbook">' +
'<hr></div><div class="mergedbook">'.join([ mkbookcomments(x) for x in book_list]) +
'</div>')
else:
book['comments'] += '\n'.join( [ mkbooktitle(x) for x in book_list ] )
configuration = get_fff_config(book['url'],fileform)
if existingbook:
book['title'] = deftitle = existingbook['title']
book['comments'] = existingbook['comments']
if prefs['anth_comments_newonly']:
book['comments'] = existingbook['comments']
else:
book['title'] = deftitle = book_list[0]['title']
if len(book['author']) > 1:
book['comments'] = _("Anthology containing:")+"\n" + \
"\n".join([ _("%s by %s")%(b['title'],', '.join(b['author'])) for b in book_list ])
else:
book['comments'] = _("Anthology containing:")+"\n" + \
"\n".join([ b['title'] for b in book_list ])
# book['all_metadata']['description']
# if all same series, use series for name. But only if all and not previous named

View file

@ -166,6 +166,8 @@ default_prefs['allow_custcol_from_ini'] = True
default_prefs['std_cols_newonly'] = {}
default_prefs['set_author_url'] = True
default_prefs['includecomments'] = False
default_prefs['anth_comments_newonly'] = True
default_prefs['imapserver'] = ''
default_prefs['imapuser'] = ''

File diff suppressed because it is too large Load diff