mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Add the ability to control the order of categories in the tag browser
This commit is contained in:
parent
3974ac02d1
commit
1344d5a702
@ -128,6 +128,17 @@ categories_collapsed_name_template = r'{first.sort:shorten(4,,0)} - {last.sort:s
|
|||||||
categories_collapsed_rating_template = r'{first.avg_rating:4.2f:ifempty(0)} - {last.avg_rating:4.2f:ifempty(0)}'
|
categories_collapsed_rating_template = r'{first.avg_rating:4.2f:ifempty(0)} - {last.avg_rating:4.2f:ifempty(0)}'
|
||||||
categories_collapsed_popularity_template = r'{first.count:d} - {last.count:d}'
|
categories_collapsed_popularity_template = r'{first.count:d} - {last.count:d}'
|
||||||
|
|
||||||
|
#: Control order of categories in the tag browser
|
||||||
|
# Change the following dict to change the order that categories are displayed in
|
||||||
|
# the tag browser. Items are named using their lookup name, and will be sorted
|
||||||
|
# using the number supplied. The lookup name '*' stands for all names that
|
||||||
|
# otherwise do not appear. Two names with the same value will be sorted
|
||||||
|
# according the the default order; the one used when the dict is empty.
|
||||||
|
# Example: tag_browser_category_order = {'series':1, 'tags':2, '*':3}
|
||||||
|
# resulting in the order series, tags, then everything else in default order.
|
||||||
|
tag_browser_category_order = {'*':1}
|
||||||
|
|
||||||
|
|
||||||
#: Specify columns to sort the booklist by on startup
|
#: Specify columns to sort the booklist by on startup
|
||||||
# Provide a set of columns to be sorted on when calibre starts
|
# Provide a set of columns to be sorted on when calibre starts
|
||||||
# The argument is None if saved sort history is to be used
|
# The argument is None if saved sort history is to be used
|
||||||
|
@ -831,7 +831,11 @@ class TagsModel(QAbstractItemModel): # {{{
|
|||||||
if lower(t.name).find(self.filter_categories_by) >= 0]
|
if lower(t.name).find(self.filter_categories_by) >= 0]
|
||||||
|
|
||||||
tb_categories = self.db.field_metadata
|
tb_categories = self.db.field_metadata
|
||||||
for category in tb_categories:
|
tb_keys = tb_categories.keys()
|
||||||
|
tb_keys.sort(key=lambda x,
|
||||||
|
y=tweaks['tag_browser_category_order']:
|
||||||
|
y[x] if x in y else y['*'] if '*' in y else 100)
|
||||||
|
for category in tb_keys:
|
||||||
if category in data: # The search category can come and go
|
if category in data: # The search category can come and go
|
||||||
self.row_map.append(category)
|
self.row_map.append(category)
|
||||||
self.categories[category] = tb_categories[category]['name']
|
self.categories[category] = tb_categories[category]['name']
|
||||||
|
Loading…
x
Reference in New Issue
Block a user