mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 12:54:40 +01:00
add shortcut to action if in configuration (#4927)
Co-authored-by: Thomas Fricard <tfricard@ws114.prs.vfx.int>
This commit is contained in:
parent
592d0ac908
commit
6968c7c8ba
1 changed files with 10 additions and 5 deletions
|
|
@ -19,9 +19,9 @@ class ScriptsMenu(QtWidgets.QMenu):
|
|||
|
||||
Args:
|
||||
title (str): the name of the root menu which will be created
|
||||
|
||||
|
||||
parent (QtWidgets.QObject) : the QObject to parent the menu to
|
||||
|
||||
|
||||
Returns:
|
||||
None
|
||||
|
||||
|
|
@ -94,7 +94,7 @@ class ScriptsMenu(QtWidgets.QMenu):
|
|||
parent(QtWidgets.QWidget): the object to parent the menu to
|
||||
|
||||
title(str): the title of the menu
|
||||
|
||||
|
||||
Returns:
|
||||
QtWidget.QMenu instance
|
||||
"""
|
||||
|
|
@ -111,7 +111,7 @@ class ScriptsMenu(QtWidgets.QMenu):
|
|||
return menu
|
||||
|
||||
def add_script(self, parent, title, command, sourcetype, icon=None,
|
||||
tags=None, label=None, tooltip=None):
|
||||
tags=None, label=None, tooltip=None, shortcut=None):
|
||||
"""Create an action item which runs a script when clicked
|
||||
|
||||
Args:
|
||||
|
|
@ -134,6 +134,8 @@ class ScriptsMenu(QtWidgets.QMenu):
|
|||
|
||||
tooltip (str): A tip for the user about the usage fo the tool
|
||||
|
||||
shortcut (str): A shortcut to run the command
|
||||
|
||||
Returns:
|
||||
QtWidget.QAction instance
|
||||
|
||||
|
|
@ -166,6 +168,9 @@ class ScriptsMenu(QtWidgets.QMenu):
|
|||
raise RuntimeError("Script action can't be "
|
||||
"processed: {}".format(e))
|
||||
|
||||
if shortcut:
|
||||
script_action.setShortcut(shortcut)
|
||||
|
||||
if icon:
|
||||
iconfile = os.path.expandvars(icon)
|
||||
script_action.iconfile = iconfile
|
||||
|
|
@ -253,7 +258,7 @@ class ScriptsMenu(QtWidgets.QMenu):
|
|||
|
||||
def _update_search(self, search):
|
||||
"""Hide all the samples which do not match the user's import
|
||||
|
||||
|
||||
Returns:
|
||||
None
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue