Avoid doing tag_view.recount() when the tags pane is not visible

This commit is contained in:
Charles Haley 2010-12-13 15:12:53 +00:00
parent a110eb19dd
commit 881bfef0f2
2 changed files with 14 additions and 1 deletions

View File

@ -123,6 +123,8 @@ class Stack(QStackedWidget): # {{{
_('Tag Browser'), I('tags.png'), _('Tag Browser'), I('tags.png'),
parent=parent, side_index=0, initial_side_size=200, parent=parent, side_index=0, initial_side_size=200,
shortcut=_('Shift+Alt+T')) shortcut=_('Shift+Alt+T'))
parent.tb_splitter.state_changed.connect(
self.tb_widget.set_pane_is_visible, Qt.QueuedConnection)
parent.tb_splitter.addWidget(self.tb_widget) parent.tb_splitter.addWidget(self.tb_widget)
parent.tb_splitter.addWidget(parent.cb_splitter) parent.tb_splitter.addWidget(parent.cb_splitter)
parent.tb_splitter.setCollapsible(parent.tb_splitter.other_index, False) parent.tb_splitter.setCollapsible(parent.tb_splitter.other_index, False)

View File

@ -87,6 +87,13 @@ class TagsView(QTreeView): # {{{
self.setDragDropMode(self.DropOnly) self.setDragDropMode(self.DropOnly)
self.setDropIndicatorShown(True) self.setDropIndicatorShown(True)
self.setAutoExpandDelay(500) self.setAutoExpandDelay(500)
self.pane_is_visible = False
def set_pane_is_visible(self, to_what):
pv = self.pane_is_visible
self.pane_is_visible = to_what
if to_what and not pv:
self.recount()
def set_database(self, db, tag_match, sort_by): def set_database(self, db, tag_match, sort_by):
self.hidden_categories = config['tag_browser_hidden_categories'] self.hidden_categories = config['tag_browser_hidden_categories']
@ -300,7 +307,7 @@ class TagsView(QTreeView): # {{{
return self.isExpanded(idx) return self.isExpanded(idx)
def recount(self, *args): def recount(self, *args):
if self.disable_recounting: if self.disable_recounting or not self.pane_is_visible:
return return
self.refresh_signal_processed = True self.refresh_signal_processed = True
ci = self.currentIndex() ci = self.currentIndex()
@ -969,6 +976,7 @@ class TagBrowserWidget(QWidget): # {{{
self._layout.setContentsMargins(0,0,0,0) self._layout.setContentsMargins(0,0,0,0)
parent.tags_view = TagsView(parent) parent.tags_view = TagsView(parent)
self.tags_view = parent.tags_view
self._layout.addWidget(parent.tags_view) self._layout.addWidget(parent.tags_view)
parent.sort_by = QComboBox(parent) parent.sort_by = QComboBox(parent)
@ -998,6 +1006,9 @@ class TagBrowserWidget(QWidget): # {{{
_('Add your own categories to the Tag Browser')) _('Add your own categories to the Tag Browser'))
parent.edit_categories.setStatusTip(parent.edit_categories.toolTip()) parent.edit_categories.setStatusTip(parent.edit_categories.toolTip())
def set_pane_is_visible(self, to_what):
self.tags_view.set_pane_is_visible(to_what)
# }}} # }}}