mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -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
|
# Add expand menu items
|
||||||
self.context_menu.addSeparator()
|
self.context_menu.addSeparator()
|
||||||
m = self.context_menu.addMenu(_('Expand or collapse'))
|
m = self.context_menu.addMenu(_('Expand or collapse'))
|
||||||
node_name = self._model.get_node(index).tag.name
|
try:
|
||||||
if self.has_children(index) and not self.isExpanded(index):
|
node_name = self._model.get_node(index).tag.name
|
||||||
m.addAction(self.plus_icon,
|
except AttributeError:
|
||||||
_('Expand {0}').format(node_name), partial(self.expand, index))
|
pass
|
||||||
if self.has_unexpanded_children(index):
|
else:
|
||||||
m.addAction(self.plus_icon,
|
if self.has_children(index) and not self.isExpanded(index):
|
||||||
_('Expand {0} and its children').format(node_name),
|
m.addAction(self.plus_icon,
|
||||||
partial(self.expand_node_and_children, index))
|
_('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
|
# Add menu items to collapse parent nodes
|
||||||
idx = index
|
idx = index
|
||||||
|
Loading…
x
Reference in New Issue
Block a user