mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 18:54:09 -04:00
Fix #1901250 [TagTreeItem error in beta](https://bugs.launchpad.net/calibre/+bug/1901250)
This commit is contained in:
parent
cef46ad59f
commit
c930bbcf7d
@ -858,14 +858,18 @@ class TagsView(QTreeView): # {{{
|
||||
# Add expand menu items
|
||||
self.context_menu.addSeparator()
|
||||
m = self.context_menu.addMenu(_('Expand or collapse'))
|
||||
node_name = self._model.get_node(index).tag.name
|
||||
if self.has_children(index) and not self.isExpanded(index):
|
||||
m.addAction(self.plus_icon,
|
||||
_('Expand {0}').format(node_name), partial(self.expand, index))
|
||||
if self.has_unexpanded_children(index):
|
||||
m.addAction(self.plus_icon,
|
||||
_('Expand {0} and its children').format(node_name),
|
||||
partial(self.expand_node_and_children, index))
|
||||
try:
|
||||
node_name = self._model.get_node(index).tag.name
|
||||
except AttributeError:
|
||||
pass
|
||||
else:
|
||||
if self.has_children(index) and not self.isExpanded(index):
|
||||
m.addAction(self.plus_icon,
|
||||
_('Expand {0}').format(node_name), partial(self.expand, index))
|
||||
if self.has_unexpanded_children(index):
|
||||
m.addAction(self.plus_icon,
|
||||
_('Expand {0} and its children').format(node_name),
|
||||
partial(self.expand_node_and_children, index))
|
||||
|
||||
# Add menu items to collapse parent nodes
|
||||
idx = index
|
||||
|
Loading…
x
Reference in New Issue
Block a user