mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Bug #2003780: Unexpected behaviour: Marked books & Hide Empty Categories
This commit is contained in:
parent
6829e65034
commit
8467a9f0bd
@ -22,7 +22,7 @@ from calibre.gui2.tag_browser.model import (TagTreeItem, TAG_SEARCH_STATES,
|
|||||||
TagsModel, DRAG_IMAGE_ROLE, COUNT_ROLE, rename_only_in_vl_question)
|
TagsModel, DRAG_IMAGE_ROLE, COUNT_ROLE, rename_only_in_vl_question)
|
||||||
from calibre.gui2.widgets import EnLineEdit
|
from calibre.gui2.widgets import EnLineEdit
|
||||||
from calibre.gui2 import (config, gprefs, choose_files, pixmap_to_data,
|
from calibre.gui2 import (config, gprefs, choose_files, pixmap_to_data,
|
||||||
rating_font, empty_index, question_dialog)
|
rating_font, empty_index, question_dialog, FunctionDispatcher)
|
||||||
from calibre.utils.icu import sort_key
|
from calibre.utils.icu import sort_key
|
||||||
from calibre.utils.serialize import json_loads
|
from calibre.utils.serialize import json_loads
|
||||||
|
|
||||||
@ -217,6 +217,7 @@ class TagsView(QTreeView): # {{{
|
|||||||
self._model.convert_requested.connect(self.convert_requested)
|
self._model.convert_requested.connect(self.convert_requested)
|
||||||
self.set_look_and_feel(first=True)
|
self.set_look_and_feel(first=True)
|
||||||
QApplication.instance().palette_changed.connect(self.set_style_sheet, type=Qt.ConnectionType.QueuedConnection)
|
QApplication.instance().palette_changed.connect(self.set_style_sheet, type=Qt.ConnectionType.QueuedConnection)
|
||||||
|
self.marked_change_listener = FunctionDispatcher(self.recount_on_mark_change)
|
||||||
|
|
||||||
def convert_requested(self, book_ids, to_fmt):
|
def convert_requested(self, book_ids, to_fmt):
|
||||||
from calibre.gui2.ui import get_gui
|
from calibre.gui2.ui import get_gui
|
||||||
@ -330,6 +331,7 @@ class TagsView(QTreeView): # {{{
|
|||||||
db.add_listener(self.database_changed)
|
db.add_listener(self.database_changed)
|
||||||
self.expanded.connect(self.item_expanded)
|
self.expanded.connect(self.item_expanded)
|
||||||
self.collapsed.connect(self.collapse_node_and_children)
|
self.collapsed.connect(self.collapse_node_and_children)
|
||||||
|
db.data.add_marked_listener(self.marked_change_listener)
|
||||||
|
|
||||||
def keyPressEvent(self, event):
|
def keyPressEvent(self, event):
|
||||||
|
|
||||||
@ -1252,6 +1254,10 @@ class TagsView(QTreeView): # {{{
|
|||||||
idx = idx.parent()
|
idx = idx.parent()
|
||||||
return self.isExpanded(idx)
|
return self.isExpanded(idx)
|
||||||
|
|
||||||
|
def recount_on_mark_change(self, *args):
|
||||||
|
# Let other marked listeners run before we do the recount
|
||||||
|
QTimer.singleShot(0, self.recount)
|
||||||
|
|
||||||
def recount_with_position_based_index(self):
|
def recount_with_position_based_index(self):
|
||||||
self._model.use_position_based_index_on_next_recount = True
|
self._model.use_position_based_index_on_next_recount = True
|
||||||
self.recount()
|
self.recount()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user