mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Change user category indicator from ':' to '@'
This commit is contained in:
parent
3c541274dd
commit
26cd80fe1a
@ -515,8 +515,8 @@ class TagsModel(QAbstractItemModel): # {{{
|
|||||||
QAbstractItemModel.__init__(self, parent)
|
QAbstractItemModel.__init__(self, parent)
|
||||||
|
|
||||||
# must do this here because 'QPixmap: Must construct a QApplication
|
# must do this here because 'QPixmap: Must construct a QApplication
|
||||||
# before a QPaintDevice'. The ':' at the end avoids polluting either the
|
# before a QPaintDevice'. The ':' at the end avoids polluting either of
|
||||||
# user-defined categories (':' at front) or columns namespaces (no ':').
|
# the other namespaces (alpha, '#', or '@')
|
||||||
iconmap = {}
|
iconmap = {}
|
||||||
for key in category_icon_map:
|
for key in category_icon_map:
|
||||||
iconmap[key] = QIcon(I(category_icon_map[key]))
|
iconmap[key] = QIcon(I(category_icon_map[key]))
|
||||||
@ -690,7 +690,7 @@ class TagsModel(QAbstractItemModel): # {{{
|
|||||||
tb_cats = self.db.field_metadata
|
tb_cats = self.db.field_metadata
|
||||||
for user_cat in sorted(self.db.prefs.get('user_categories', {}).keys(),
|
for user_cat in sorted(self.db.prefs.get('user_categories', {}).keys(),
|
||||||
key=sort_key):
|
key=sort_key):
|
||||||
cat_name = ':' + user_cat # add the ':' to avoid name collision
|
cat_name = '@' + user_cat # add the '@' to avoid name collision
|
||||||
tb_cats.add_user_category(label=cat_name, name=user_cat)
|
tb_cats.add_user_category(label=cat_name, name=user_cat)
|
||||||
if len(saved_searches().names()):
|
if len(saved_searches().names()):
|
||||||
tb_cats.add_search_category(label='search', name=_('Searches'))
|
tb_cats.add_search_category(label='search', name=_('Searches'))
|
||||||
@ -997,7 +997,7 @@ class TagsModel(QAbstractItemModel): # {{{
|
|||||||
if self.hidden_categories and self.categories[i] in self.hidden_categories:
|
if self.hidden_categories and self.categories[i] in self.hidden_categories:
|
||||||
continue
|
continue
|
||||||
row_index += 1
|
row_index += 1
|
||||||
if key.startswith(':'):
|
if key.startswith('@'):
|
||||||
# User category, so skip it. The tag will be marked in its real category
|
# User category, so skip it. The tag will be marked in its real category
|
||||||
continue
|
continue
|
||||||
category_item = self.root_item.children[row_index]
|
category_item = self.root_item.children[row_index]
|
||||||
|
@ -319,7 +319,7 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns):
|
|||||||
self.field_metadata.remove_dynamic_categories()
|
self.field_metadata.remove_dynamic_categories()
|
||||||
tb_cats = self.field_metadata
|
tb_cats = self.field_metadata
|
||||||
for user_cat in sorted(self.prefs.get('user_categories', {}).keys(), key=sort_key):
|
for user_cat in sorted(self.prefs.get('user_categories', {}).keys(), key=sort_key):
|
||||||
cat_name = ':' + user_cat # add the ':' to avoid name collision
|
cat_name = '@' + user_cat # add the '@' to avoid name collision
|
||||||
tb_cats.add_user_category(label=cat_name, name=user_cat)
|
tb_cats.add_user_category(label=cat_name, name=user_cat)
|
||||||
if len(saved_searches().names()):
|
if len(saved_searches().names()):
|
||||||
tb_cats.add_search_category(label='search', name=_('Searches'))
|
tb_cats.add_search_category(label='search', name=_('Searches'))
|
||||||
@ -1339,7 +1339,7 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns):
|
|||||||
if label in taglist and name in taglist[label]:
|
if label in taglist and name in taglist[label]:
|
||||||
items.append(taglist[label][name])
|
items.append(taglist[label][name])
|
||||||
# else: do nothing, to not include nodes w zero counts
|
# else: do nothing, to not include nodes w zero counts
|
||||||
cat_name = ':' + user_cat # add the ':' to avoid name collision
|
cat_name = '@' + user_cat # add the '@' to avoid name collision
|
||||||
# Not a problem if we accumulate entries in the icon map
|
# Not a problem if we accumulate entries in the icon map
|
||||||
if icon_map is not None:
|
if icon_map is not None:
|
||||||
icon_map[cat_name] = icon_map['user:']
|
icon_map[cat_name] = icon_map['user:']
|
||||||
|
Loading…
x
Reference in New Issue
Block a user