add generate_authors switch in GUI, cli

This commit is contained in:
GRiker 2011-01-14 09:13:41 -07:00
parent 66afdc6812
commit 9a4070d564
2 changed files with 56 additions and 33 deletions

View File

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>650</width> <width>650</width>
<height>582</height> <height>596</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -41,41 +41,54 @@
<string>Included sections</string> <string>Included sections</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout_2"> <layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0"> <item row="0" column="1">
<widget class="QCheckBox" name="generate_titles">
<property name="text">
<string>Books by &amp;Title</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="generate_series">
<property name="text">
<string>Books by &amp;Series</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QCheckBox" name="generate_recently_added">
<property name="text">
<string>Recently &amp;Added</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QCheckBox" name="generate_genres"> <widget class="QCheckBox" name="generate_genres">
<property name="text"> <property name="text">
<string>Books by &amp;Genre</string> <string>Books by &amp;Genre</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="2"> <item row="4" column="1">
<widget class="QCheckBox" name="generate_recently_added">
<property name="text">
<string>Recently &amp;Added</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QCheckBox" name="generate_descriptions"> <widget class="QCheckBox" name="generate_descriptions">
<property name="text"> <property name="text">
<string>&amp;Descriptions</string> <string>&amp;Descriptions</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="0">
<widget class="QCheckBox" name="generate_series">
<property name="text">
<string>Books by &amp;Series</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="generate_titles">
<property name="text">
<string>Books by &amp;Title</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="generate_authors">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Books by Author</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
@ -332,7 +345,7 @@ p, li { white-space: pre-wrap; }
</size> </size>
</property> </property>
<property name="toolTip"> <property name="toolTip">
<string>Matching books will be displayed with </string> <string>Matching books will be displayed with a check mark</string>
</property> </property>
<property name="title"> <property name="title">
<string>Read books</string> <string>Read books</string>
@ -471,7 +484,7 @@ p, li { white-space: pre-wrap; }
<item> <item>
<widget class="QLineEdit" name="wishlist_tag"> <widget class="QLineEdit" name="wishlist_tag">
<property name="toolTip"> <property name="toolTip">
<string>Books tagged as Wishlist items will be displayed with </string> <string>Books tagged as Wishlist items will be displayed with an X</string>
</property> </property>
</widget> </widget>
</item> </item>

View File

@ -603,6 +603,13 @@ class EPUB_MOBI(CatalogPlugin):
"--exclude-tags=skip will match 'skip this book' and 'Skip will like this'.\n" "--exclude-tags=skip will match 'skip this book' and 'Skip will like this'.\n"
"Default: '%default'\n" "Default: '%default'\n"
"Applies to: ePub, MOBI output formats")), "Applies to: ePub, MOBI output formats")),
Option('--generate-authors',
default=True,
dest='generate_authors',
action = 'store_true',
help=_("Include 'Authors' section in catalog.\n"
"Default: '%default'\n"
"Applies to: ePub, MOBI output formats")),
Option('--generate-descriptions', Option('--generate-descriptions',
default=True, default=True,
dest='generate_descriptions', dest='generate_descriptions',
@ -1603,10 +1610,11 @@ class EPUB_MOBI(CatalogPlugin):
# Warn, exit if friendly matches previous, but sort doesn't # Warn, exit if friendly matches previous, but sort doesn't
if author[0] == current_author[0]: if author[0] == current_author[0]:
error_msg = _("\nWarning: inconsistent Author Sort values for Author '%s', ") % author[0] error_msg = _("\nWarning: inconsistent Author Sort values for Author '%s', ") % author[0]
error_msg += _("unable to continue building catalog.\n") "unable to continue building catalog.\n"
error_msg += _("Select all books by '%s', apply same Author Sort value in Edit Metadata dialog, ") % author[0] "Select all books by '%s', " % author[0]
error_msg += _("then rebuild the catalog.\n") "apply same Author Sort value in Edit Metadata dialog, "
error_msg += _("Terminating catalog generation.\n") "then rebuild the catalog.\n"
"Terminating catalog generation.\n")
self.opts.log.warn(error_msg) self.opts.log.warn(error_msg)
return False return False
@ -4970,13 +4978,15 @@ class EPUB_MOBI(CatalogPlugin):
if opts_dict['ids']: if opts_dict['ids']:
build_log.append(" book count: %d" % len(opts_dict['ids'])) build_log.append(" book count: %d" % len(opts_dict['ids']))
sections_list = ['Authors'] sections_list = []
if opts.generate_authors:
sections_list.append('Authors')
if opts.generate_titles: if opts.generate_titles:
sections_list.append('Titles') sections_list.append('Titles')
if opts.generate_recently_added:
sections_list.append('Recently Added')
if opts.generate_genres: if opts.generate_genres:
sections_list.append('Genres') sections_list.append('Genres')
if opts.generate_recently_added:
sections_list.append('Recently Added')
if opts.generate_descriptions: if opts.generate_descriptions:
sections_list.append('Descriptions') sections_list.append('Descriptions')