Skip to content

Commit

Permalink
Merge branch 'fix-icon_rules-only-current-library-filter' of https://…
Browse files Browse the repository at this point in the history
  • Loading branch information
kovidgoyal committed Jan 30, 2025
2 parents 27feac8 + 1237f10 commit e98e5c8
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/calibre/gui2/preferences/look_feel_tabs/tb_icon_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ def lazy_initialize(self):
def populate_content(self):
field_metadata = self.gui.current_db.field_metadata
category_icons = self.gui.tags_view.model().category_custom_icons
is_hierarchical_category = self.gui.tags_view.model().is_key_a_hierarchical_category
only_current_library = self.show_only_current_library.isChecked()
v = gprefs['tags_browser_value_icons']
row = 0
Expand All @@ -366,6 +367,15 @@ def populate_content(self):
if category in field_metadata:
display_name = field_metadata[category]['name']
all_values = self.gui.current_db.new_api.all_field_names(category)
if is_hierarchical_category(category):
rslt = set()
for value in all_values:
idx = 0
while idx >= 0:
rslt.add(value)
idx = value.rfind('.')
value = value[:idx]
all_values = rslt
elif only_current_library:
continue
else:
Expand Down Expand Up @@ -532,7 +542,7 @@ def commit(self):
continue

icon_item = self.rules_table.item(r, ICON_COLUMN)
d = v[cat_item.lookup_name][value_text]
d = list(v[cat_item.lookup_name][value_text])

if icon_item.is_modified:
if value_item.is_template:
Expand Down

0 comments on commit e98e5c8

Please sign in to comment.