mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 18:24:30 -04:00
Tag browser: Allow expanding all children of a node by right clicking and choosing Expand All. Fixes #1414315 [[Enhancement] Auto Expanding All Categories/Subcat Option](https://bugs.launchpad.net/calibre/+bug/1414315)
This commit is contained in:
parent
f0ca2c0cc3
commit
40714d02c5
@ -616,10 +616,21 @@ class TagsView(QTreeView): # {{{
|
||||
da.setToolTip('*')
|
||||
pa.setToolTip('*')
|
||||
|
||||
if index.isValid() and self.model().rowCount(index) > 0:
|
||||
self.context_menu.addSeparator()
|
||||
self.context_menu.addAction(_('E&xpand all children'), partial(self.expand_node_and_descendants, index))
|
||||
|
||||
if not self.context_menu.isEmpty():
|
||||
self.context_menu.popup(self.mapToGlobal(point))
|
||||
return True
|
||||
|
||||
def expand_node_and_descendants(self, index):
|
||||
if not index.isValid():
|
||||
return
|
||||
self.expand(index)
|
||||
for r in xrange(self.model().rowCount(index)):
|
||||
self.expand_node_and_descendants(index.child(r, 0))
|
||||
|
||||
def collapse_menu_hovered(self, action):
|
||||
tip = action.toolTip()
|
||||
if tip == '*':
|
||||
|
Loading…
x
Reference in New Issue
Block a user