mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 02:34:06 -04:00
Merge branch 'master' of https://github.com/cbhaley/calibre
This commit is contained in:
commit
c824c23a38
@ -1204,10 +1204,13 @@ class TagsModel(QAbstractItemModel): # {{{
|
|||||||
data[category] = [t for t in data[category]
|
data[category] = [t for t in data[category]
|
||||||
if lower(t.name).find(filter_by) >= 0]
|
if lower(t.name).find(filter_by) >= 0]
|
||||||
|
|
||||||
# Build a dict of the keys that have data
|
# Build a dict of the keys that have data.
|
||||||
|
# Always add user categories so that the constructed hierarchy works.
|
||||||
|
# This means that empty categories will be displayed unless the 'hide
|
||||||
|
# empty categories' box is checked.
|
||||||
tb_categories = self.db.field_metadata
|
tb_categories = self.db.field_metadata
|
||||||
for category in tb_categories:
|
for category in tb_categories:
|
||||||
if category in data: # The search category can come and go
|
if category in data or category.startswith('@'):
|
||||||
self.categories[category] = tb_categories[category]['name']
|
self.categories[category] = tb_categories[category]['name']
|
||||||
|
|
||||||
# Now build the list of fields in display order. A lot of this is to
|
# Now build the list of fields in display order. A lot of this is to
|
||||||
|
@ -976,6 +976,10 @@ class TagsView(QTreeView): # {{{
|
|||||||
|
|
||||||
# Hide/Show/Restore categories
|
# Hide/Show/Restore categories
|
||||||
self.context_menu.addSeparator()
|
self.context_menu.addSeparator()
|
||||||
|
# Because of the strange way hierarchy works in user categories
|
||||||
|
# where child nodes actually exist we must limit hiding to top-
|
||||||
|
# level categories, which will hide that category and children
|
||||||
|
if not key.startswith('@') or '.' not in key:
|
||||||
self.context_menu.addAction(_('Hide category %s') % category.replace('&', '&&'),
|
self.context_menu.addAction(_('Hide category %s') % category.replace('&', '&&'),
|
||||||
partial(self.context_menu_handler, action='hide',
|
partial(self.context_menu_handler, action='hide',
|
||||||
category=key)).setIcon(QIcon.ic('minus.png'))
|
category=key)).setIcon(QIcon.ic('minus.png'))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user