mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-04-24 20:53:23 +02:00
Tag Browser: Show format specific icons for the format entries in the Tag Browser
This commit is contained in:
parent
fb2bb90d3a
commit
33878116ff
1 changed files with 13 additions and 3 deletions
|
|
@ -14,7 +14,7 @@
|
|||
QMimeData, QModelIndex, pyqtSignal, QObject)
|
||||
|
||||
from calibre.constants import config_dir
|
||||
from calibre.gui2 import gprefs, config, error_dialog
|
||||
from calibre.gui2 import gprefs, config, error_dialog, file_icon_provider
|
||||
from calibre.db.categories import Tag
|
||||
from calibre.utils.config import tweaks
|
||||
from calibre.utils.icu import sort_key, lower, strcmp, collation_order
|
||||
|
|
@ -67,7 +67,7 @@ def __init__(self, data=None, category_icon=None, icon_map=None,
|
|||
['news', 'search', 'identifiers', 'languages'],
|
||||
is_searchable=category_key not in ['search'])
|
||||
elif self.type == self.TAG:
|
||||
self.icon_state_map[0] = (data.icon)
|
||||
self.icon_state_map[0] = data.icon
|
||||
self.tag = data
|
||||
|
||||
self.tooltip = (tooltip + ' ') if tooltip else ''
|
||||
|
|
@ -451,6 +451,10 @@ def process_one_node(category, collapse_model, state_map): # {{{
|
|||
key not in self.db.prefs.get('categories_using_hierarchy', []) or
|
||||
config['sort_tags_by'] != 'name')
|
||||
|
||||
is_formats = key == 'formats'
|
||||
if is_formats:
|
||||
fip = file_icon_provider()
|
||||
|
||||
for idx,tag in enumerate(data[key]):
|
||||
components = None
|
||||
if clear_rating:
|
||||
|
|
@ -526,7 +530,13 @@ def process_one_node(category, collapse_model, state_map): # {{{
|
|||
if (not tag.is_hierarchical) and (in_uc or
|
||||
(fm['is_custom'] and fm['display'].get('is_names', False)) or
|
||||
not category_is_hierarchical or len(components) == 1):
|
||||
tag.icon = self.category_custom_icons[key]
|
||||
if is_formats:
|
||||
try:
|
||||
tag.icon = fip.icon_from_ext(tag.name.replace('ORIGINAL_', ''))
|
||||
except Exception:
|
||||
tag.icon = self.category_custom_icons[key]
|
||||
else:
|
||||
tag.icon = self.category_custom_icons[key]
|
||||
n = self.create_node(parent=node_parent, data=tag, tooltip=tt,
|
||||
icon_map=self.icon_state_map)
|
||||
if tag.id_set is not None:
|
||||
|
|
|
|||
Loading…
Reference in a new issue