mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
added admin_action attribute defyin if action is added to admin submenu or not
This commit is contained in:
parent
b0e9e3b3ee
commit
a33388d24c
1 changed files with 13 additions and 2 deletions
|
|
@ -184,6 +184,7 @@ class ITrayAction(ITrayModule):
|
||||||
necessary.
|
necessary.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
admin_action = False
|
||||||
_admin_submenu = None
|
_admin_submenu = None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
@ -199,9 +200,19 @@ class ITrayAction(ITrayModule):
|
||||||
|
|
||||||
def tray_menu(self, tray_menu):
|
def tray_menu(self, tray_menu):
|
||||||
from Qt import QtWidgets
|
from Qt import QtWidgets
|
||||||
action = QtWidgets.QAction(self.label, tray_menu)
|
|
||||||
|
if self.admin_action:
|
||||||
|
menu = self.admin_submenu(tray_menu)
|
||||||
|
action = QtWidgets.QAction(self.label, menu)
|
||||||
|
menu.addAction(action)
|
||||||
|
if not menu.menuAction().isVisible():
|
||||||
|
menu.menuAction().setVisible(True)
|
||||||
|
|
||||||
|
else:
|
||||||
|
action = QtWidgets.QAction(self.label, tray_menu)
|
||||||
|
tray_menu.addAction(action)
|
||||||
|
|
||||||
action.triggered.connect(self.on_action_trigger)
|
action.triggered.connect(self.on_action_trigger)
|
||||||
tray_menu.addAction(action)
|
|
||||||
|
|
||||||
def tray_start(self):
|
def tray_start(self):
|
||||||
return
|
return
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue