Fix #1900220 [Expand category in context menu of the Tag browser when the category is already expanded](https://bugs.launchpad.net/calibre/+bug/1900220)

This commit is contained in:
Kovid Goyal 2020-10-17 12:40:45 +05:30
parent bcac649b05
commit b0b3effc40
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -851,11 +851,12 @@ class TagsView(QTreeView): # {{{
self.context_menu.addSeparator()
if index.isValid() and self.model().rowCount(index) > 0:
self.context_menu.addAction(_('Expand {0}').format(node_name),
partial(self.expand_node_and_descendants, index))
if self.isExpanded(index):
self.context_menu.addAction(_("Collapse {0}").format(node_name),
partial(self.collapse_node, index))
else:
self.context_menu.addAction(_('Expand {0}').format(node_name),
partial(self.expand_node_and_descendants, index))
if parent_index is not None and parent_index != index:
if self.isExpanded(parent_index):
# Don't bother to collapse if it isn't expanded