New option to hide empty categories in Tag Browser (Preferences->Look & Feel->Tag Browser)

Merge branch 'master' of https://github.com/cbhaley/calibre
This commit is contained in:
Kovid Goyal 2015-12-21 17:29:03 +05:30
commit 6dbf05e76b
4 changed files with 17 additions and 0 deletions

View File

@ -115,6 +115,7 @@ defs['auto_add_auto_convert'] = True
defs['auto_add_everything'] = False
defs['ui_style'] = 'calibre' if iswindows or isosx else 'system'
defs['tag_browser_old_look'] = False
defs['tag_browser_hide_empty_categories'] = False
defs['book_list_tooltips'] = True
defs['bd_show_cover'] = True
defs['bd_overlay_cover_size'] = False

View File

@ -159,6 +159,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
'calibre')])
r('book_list_tooltips', gprefs)
r('tag_browser_old_look', gprefs, restart_required=True)
r('tag_browser_hide_empty_categories', gprefs)
r('bd_show_cover', gprefs)
r('bd_overlay_cover_size', gprefs)
r('cover_grid_width', gprefs)

View File

@ -898,6 +898,19 @@ then the tags will be displayed each on their own line.</string>
</property>
</widget>
</item>
<item row="8" column="0" colspan="2">
<widget class="QCheckBox" name="opt_tag_browser_hide_empty_categories">
<property name="text">
<string>Hi&amp;de empty categories (columns) in the tag browser</string>
</property>
<property name="toolTip">
<string>When checked, calibre will automatically hide any category
(a column, custom or standard) that has no items to show. For example, some
categories might not have values when using virtual libraries. Checking this
box will cause these empty categories to be hidden.</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="opt_tags_browser_partition_method">
<property name="toolTip">

View File

@ -665,6 +665,8 @@ class TagsModel(QAbstractItemModel): # {{{
for node in self.root_item.children:
key = node.category_key
if key in self.row_map:
if self.prefs['tag_browser_hide_empty_categories'] and len(node.child_tags()) == 0:
continue;
if self.hidden_categories:
if key in self.hidden_categories:
continue