From b6ace842b1e0aea7cc8162e5ffa7a107eb4e285b Mon Sep 17 00:00:00 2001 From: Brandon Peterman Date: Sat, 7 Mar 2026 10:33:17 -0600 Subject: [PATCH] Annots browser: fix decoration-style highlight filters --- src/calibre/db/backend.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/calibre/db/backend.py b/src/calibre/db/backend.py index 0c9d7221e0..5fea619811 100644 --- a/src/calibre/db/backend.py +++ b/src/calibre/db/backend.py @@ -2604,18 +2604,12 @@ class DB: yield x[0] def all_annotation_styles(self): - all_styles = builtin_colors_light | builtin_decorations - styles = {} - for style_name, style in all_styles.items(): - if isinstance(style, str): - style = {'kind': 'color', 'which': style_name} - else: - style['kind'] = 'decoration' - styles[style_name] = style + all_styles = [{'kind': 'color', 'which': style} for style in builtin_colors_light.keys()] + \ + [{'kind': 'decoration', 'which': style} for style in builtin_decorations.keys()] # In the future, we could merge in custom styles from the DB. # Under the current schema, this would require scanning all annotations, # so it's excluded for performance at this time. - return styles + return {style['which']: style for style in all_styles} def set_annotations_for_book(self, book_id, fmt, annots_list, user_type='local', user='viewer'): try: