Tag browser: Fix use of the tweak to control order of items in the Tag browser causing unexpected expansion of items after editing metadata. Fixes #1730245 [Tag browser unexpectedly expands after edit](https://bugs.launchpad.net/calibre/+bug/1730245)

This commit is contained in:
Kovid Goyal 2017-11-30 13:35:39 +05:30
parent 10036f66ff
commit cc410ac6da
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -13,7 +13,7 @@ from itertools import izip
from PyQt5.Qt import ( from PyQt5.Qt import (
QStyledItemDelegate, Qt, QTreeView, pyqtSignal, QSize, QIcon, QApplication, QStyledItemDelegate, Qt, QTreeView, pyqtSignal, QSize, QIcon, QApplication,
QMenu, QPoint, QModelIndex, QToolTip, QCursor, QDrag, QRect, QMenu, QPoint, QToolTip, QCursor, QDrag, QRect,
QLinearGradient, QPalette, QColor, QPen, QBrush, QFont QLinearGradient, QPalette, QColor, QPen, QBrush, QFont
) )
@ -220,7 +220,8 @@ class TagsView(QTreeView): # {{{
(hide_empty_categories and len(category.child_tags()) == 0)): (hide_empty_categories and len(category.child_tags()) == 0)):
continue continue
row += 1 row += 1
if self.isExpanded(self._model.index(row, 0, QModelIndex())): index = self._model.index_for_category(category.category_key)
if index is not None and self.isExpanded(index):
expanded_categories.append(category.category_key) expanded_categories.append(category.category_key)
states = [c.tag.state for c in category.child_tags()] states = [c.tag.state for c in category.child_tags()]
names = [(c.tag.name, c.tag.category) for c in category.child_tags()] names = [(c.tag.name, c.tag.category) for c in category.child_tags()]