mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
Fix #3276 (Tag search GUI broken)
This commit is contained in:
parent
ab77e05d30
commit
3e2ca84f09
@ -1503,6 +1503,7 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
|
||||
self.search.clear_to_help()
|
||||
self.status_bar.reset_info()
|
||||
self.library_view.sortByColumn(3, Qt.DescendingOrder)
|
||||
self.library_view.model().count_changed()
|
||||
|
||||
############################################################################
|
||||
|
||||
|
@ -93,7 +93,7 @@ class TagsModel(QStandardItemModel):
|
||||
QIcon(':/images/minus.svg')]
|
||||
QStandardItemModel.__init__(self)
|
||||
self.db = db
|
||||
self.ignore_next_search = False
|
||||
self.ignore_next_search = 0
|
||||
self._data = {}
|
||||
self.bold_font = QFont()
|
||||
self.bold_font.setBold(True)
|
||||
@ -129,19 +129,20 @@ class TagsModel(QStandardItemModel):
|
||||
self.refresh()
|
||||
|
||||
def reinit(self, *args, **kwargs):
|
||||
if not self.ignore_next_search:
|
||||
if self.ignore_next_search == 0:
|
||||
for category in self._data.values():
|
||||
for tag in category:
|
||||
tag.state = 0
|
||||
self.reset()
|
||||
self.ignore_next_search = False
|
||||
else:
|
||||
self.ignore_next_search -= 1
|
||||
|
||||
def toggle(self, index):
|
||||
if index.parent().isValid():
|
||||
category = self.row_map[index.parent().row()]
|
||||
tag = self._data[category][index.row()]
|
||||
self.invisibleRootItem().child(index.parent().row()).child(index.row()).toggle()
|
||||
self.ignore_next_search = True
|
||||
self.ignore_next_search = 2
|
||||
self.emit(SIGNAL('dataChanged(QModelIndex,QModelIndex)'), index, index)
|
||||
return True
|
||||
return False
|
||||
|
Loading…
x
Reference in New Issue
Block a user