mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Make tag browser filtering work when capital letters are entered.
This commit is contained in:
parent
39fd2fa859
commit
6c505b1242
@ -840,6 +840,15 @@ class TagsModel(QAbstractItemModel): # {{{
|
||||
self.categories[category] = tb_categories[category]['name']
|
||||
return data
|
||||
|
||||
def set_categories_filter(self, txt):
|
||||
if txt:
|
||||
self.filter_categories_by = icu_lower(txt)
|
||||
else:
|
||||
self.filter_categories_by = None
|
||||
|
||||
def get_categories_filter(self):
|
||||
return self.filter_categories_by
|
||||
|
||||
def refresh(self, data=None):
|
||||
'''
|
||||
Here to trap usages of refresh in the old architecture. Can eventually
|
||||
|
@ -443,12 +443,12 @@ class TagBrowserWidget(QWidget): # {{{
|
||||
txt = unicode(self.item_search.currentText()).strip()
|
||||
|
||||
if txt.startswith('*'):
|
||||
model.filter_categories_by = txt[1:]
|
||||
model.set_categories_filter(txt[1:])
|
||||
self.tags_view.recount()
|
||||
self.current_find_position = None
|
||||
return
|
||||
if model.filter_categories_by:
|
||||
model.filter_categories_by = None
|
||||
if model.get_categories_filter():
|
||||
model.set_categories_filter(None)
|
||||
self.tags_view.recount()
|
||||
self.current_find_position = None
|
||||
|
||||
|
@ -302,7 +302,7 @@ class TagsView(QTreeView): # {{{
|
||||
self.hidden_categories.clear()
|
||||
self.db.prefs.set('tag_browser_hidden_categories', list(self.hidden_categories))
|
||||
if reset_filter_categories:
|
||||
self._model.filter_categories_by = None
|
||||
self._model.set_categories_filter(None)
|
||||
self._model.rebuild_node_tree()
|
||||
except:
|
||||
return
|
||||
|
Loading…
x
Reference in New Issue
Block a user