Fix #1623 (Filter stats update)

This commit is contained in:
Kovid Goyal 2009-01-18 18:04:11 -08:00
parent a83de9ce2d
commit a0e9483e92
2 changed files with 12 additions and 1 deletions

View File

@ -340,6 +340,8 @@ class Main(MainWindow, Ui_MainWindow):
self.connect(self.search, SIGNAL('search(PyQt_PyObject, PyQt_PyObject)'),
self.tags_view.model().reinit)
self.connect(self.library_view.model(), SIGNAL('count_changed(int)'), self.location_view.count_changed)
self.connect(self.library_view.model(), SIGNAL('count_changed(int)'),
self.tags_view.recount)
self.library_view.model().count_changed()
########################### Cover Flow ################################
self.cover_flow = None
@ -1129,6 +1131,7 @@ class Main(MainWindow, Ui_MainWindow):
os.remove(f.name)
except:
pass
self.tags_view.recount()
if self.current_view() is self.library_view:
current = self.library_view.currentIndex()
self.library_view.model().current_changed(current, QModelIndex())

View File

@ -7,7 +7,7 @@ __docformat__ = 'restructuredtext en'
Browsing book collection by tags.
'''
from PyQt4.Qt import QAbstractItemModel, Qt, QVariant, QTreeView, QModelIndex, \
QFont, SIGNAL, QSize, QColor, QIcon
QFont, SIGNAL, QSize, QColor, QIcon, QPoint
from calibre.gui2 import config
NONE = QVariant()
@ -36,6 +36,14 @@ class TagsView(QTreeView):
if self._model.toggle(index):
self.emit(SIGNAL('tags_marked(PyQt_PyObject, PyQt_PyObject)'),
self._model.tokens(), self.match_all.isChecked())
def recount(self, *args):
ci = self.currentIndex()
if not ci.isValid():
ci = self.indexAt(QPoint(10, 10))
self.model().refresh()
if ci.isValid():
self.scrollTo(ci, QTreeView.PositionAtTop)
class TagsModel(QAbstractItemModel):