Bug(s) #1997137: Tag browser error.

There are two independent problems here.

1) The exception is caused by right-clicking in the white space of the tag browser. I can't make it happen right-clicking anywhere else. It has nothing to do with grouped searches.

2) The "creation of grouped search terms" problem has been there since forever. The search preferences didn't tell the tag browser to completely rebuild the tree. Restarting calibre fixed it.
This commit is contained in:
Charles Haley 2022-11-19 10:06:57 +00:00
parent 176171a116
commit 301cd03cd4
2 changed files with 6 additions and 4 deletions

View File

@ -229,6 +229,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
self.gst_value.blockSignals(False) self.gst_value.blockSignals(False)
def commit(self): def commit(self):
restart = ConfigWidgetBase.commit(self)
if self.opt_case_sensitive.isChecked() and self.opt_use_primary_find_in_search.isChecked(): if self.opt_case_sensitive.isChecked() and self.opt_use_primary_find_in_search.isChecked():
error_dialog(self, _('Incompatible options'), _( error_dialog(self, _('Incompatible options'), _(
'The option to have un-accented characters match accented characters has no effect' 'The option to have un-accented characters match accented characters has no effect'
@ -252,7 +253,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
else: else:
cats.discard('search') cats.discard('search')
self.db.new_api.set_pref('categories_using_hierarchy', list(cats)) self.db.new_api.set_pref('categories_using_hierarchy', list(cats))
return ConfigWidgetBase.commit(self) return restart
def refresh_gui(self, gui): def refresh_gui(self, gui):
gui.refresh_search_bar_widgets() gui.refresh_search_bar_widgets()
@ -260,8 +261,8 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
gui.current_db.new_api.clear_caches() gui.current_db.new_api.clear_caches()
set_use_primary_find_in_search(prefs['use_primary_find_in_search']) set_use_primary_find_in_search(prefs['use_primary_find_in_search'])
gui.set_highlight_only_button_icon() gui.set_highlight_only_button_icon()
if self.muc_changed: if self.gst_changed or self.muc_changed:
gui.tags_view.recount() gui.tags_view.model().reset_tag_browser()
gui.search.search_as_you_type(config['search_as_you_type']) gui.search.search_as_you_type(config['search_as_you_type'])
gui.search.do_search() gui.search.do_search()

View File

@ -715,6 +715,7 @@ class TagsView(QTreeView): # {{{
index = self.indexAt(point) index = self.indexAt(point)
self.context_menu = QMenu(self) self.context_menu = QMenu(self)
added_show_hidden_categories = False added_show_hidden_categories = False
key = None
def add_show_hidden_categories(): def add_show_hidden_categories():
nonlocal added_show_hidden_categories nonlocal added_show_hidden_categories
@ -1046,7 +1047,7 @@ class TagsView(QTreeView): # {{{
# partioning. If partitioning is active, provide a way to turn it on or # partioning. If partitioning is active, provide a way to turn it on or
# off for this category. # off for this category.
if gprefs['tags_browser_partition_method'] != 'disable': if gprefs['tags_browser_partition_method'] != 'disable' and key is not None:
m = self.context_menu m = self.context_menu
p = self.db.prefs.get('tag_browser_dont_collapse', gprefs['tag_browser_dont_collapse']) p = self.db.prefs.get('tag_browser_dont_collapse', gprefs['tag_browser_dont_collapse'])
if key in p: if key in p: