mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Use case-insensitive matching for user category items
This commit is contained in:
parent
f946570332
commit
68af4f7a1b
@ -73,16 +73,17 @@ class TagCategories(QDialog, Ui_TagCategories):
|
|||||||
if idx == 0:
|
if idx == 0:
|
||||||
continue
|
continue
|
||||||
for n in category_values[idx]():
|
for n in category_values[idx]():
|
||||||
t = Item(name=n, label=label, index=len(self.all_items),icon=category_icons[idx], exists=True)
|
t = Item(name=n, label=label, index=len(self.all_items),
|
||||||
|
icon=category_icons[idx], exists=True)
|
||||||
self.all_items.append(t)
|
self.all_items.append(t)
|
||||||
self.all_items_dict[label+':'+n] = t
|
self.all_items_dict[icu_lower(label+':'+n)] = t
|
||||||
|
|
||||||
self.categories = dict.copy(db.prefs.get('user_categories', {}))
|
self.categories = dict.copy(db.prefs.get('user_categories', {}))
|
||||||
if self.categories is None:
|
if self.categories is None:
|
||||||
self.categories = {}
|
self.categories = {}
|
||||||
for cat in self.categories:
|
for cat in self.categories:
|
||||||
for item,l in enumerate(self.categories[cat]):
|
for item,l in enumerate(self.categories[cat]):
|
||||||
key = ':'.join([l[1], l[0]])
|
key = icu_lower(':'.join([l[1], l[0]]))
|
||||||
t = self.all_items_dict.get(key, None)
|
t = self.all_items_dict.get(key, None)
|
||||||
if l[1] in self.category_labels:
|
if l[1] in self.category_labels:
|
||||||
if t is None:
|
if t is None:
|
||||||
|
@ -1421,7 +1421,7 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns):
|
|||||||
# temporarily duplicating the categories lists.
|
# temporarily duplicating the categories lists.
|
||||||
taglist = {}
|
taglist = {}
|
||||||
for c in categories.keys():
|
for c in categories.keys():
|
||||||
taglist[c] = dict(map(lambda t:(t.name, t), categories[c]))
|
taglist[c] = dict(map(lambda t:(icu_lower(t.name), t), categories[c]))
|
||||||
|
|
||||||
muc = self.prefs.get('grouped_search_make_user_categories', [])
|
muc = self.prefs.get('grouped_search_make_user_categories', [])
|
||||||
gst = self.prefs.get('grouped_search_terms', {})
|
gst = self.prefs.get('grouped_search_terms', {})
|
||||||
@ -1437,8 +1437,9 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns):
|
|||||||
for user_cat in sorted(user_categories.keys(), key=sort_key):
|
for user_cat in sorted(user_categories.keys(), key=sort_key):
|
||||||
items = []
|
items = []
|
||||||
for (name,label,ign) in user_categories[user_cat]:
|
for (name,label,ign) in user_categories[user_cat]:
|
||||||
if label in taglist and name in taglist[label]:
|
n = icu_lower(name)
|
||||||
items.append(taglist[label][name])
|
if label in taglist and n in taglist[label]:
|
||||||
|
items.append(taglist[label][n])
|
||||||
# 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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user