mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-08-11 09:13:57 -04:00
Allow plugins to add more than one action to the context menu
Fixes #1936472 [Enhacement Request: plugins in context menu of tag browser](https://bugs.launchpad.net/calibre/+bug/1936472)
This commit is contained in:
parent
5f78eaaea5
commit
5e9798fe9e
@ -353,10 +353,12 @@ class InterfaceAction(QObject):
|
||||
'''
|
||||
Called when displaying the context menu in the Tag browser. ``index`` is
|
||||
the QModelIndex that points to the Tag browser item that was right clicked.
|
||||
Test it for validitiy with index.valid() and get the underlying TagTreeItem
|
||||
object with index.data(Qt.ItemDataRole.UserRole)
|
||||
Test it for validity with index.valid() and get the underlying TagTreeItem
|
||||
object with index.data(Qt.ItemDataRole.UserRole). This method must yield one
|
||||
or more action objects that will be added to the context menu.
|
||||
'''
|
||||
pass
|
||||
if False:
|
||||
yield QAction()
|
||||
|
||||
def shutting_down(self):
|
||||
'''
|
||||
|
@ -1004,8 +1004,7 @@ class TagsView(QTreeView): # {{{
|
||||
first = True
|
||||
for ac in get_gui().iactions.values():
|
||||
try:
|
||||
context_action = ac.tag_browser_context_action(index)
|
||||
if context_action is not None:
|
||||
for context_action in ac.tag_browser_context_action(index):
|
||||
if first:
|
||||
self.context_menu.addSeparator()
|
||||
first = False
|
||||
|
Loading…
x
Reference in New Issue
Block a user