addCommand(self,
name,
command,
shortcut,
icon,
tooltip,
index,
readonly)
|
|
Add a new command to this menu/toolbar. Note that when invoked, the
command is automatically enclosed in an undo group, so that undo/redo
functionality works. Optional arguments can be specified by name. Note
that if the command argument is not specified, then the command will be
auto-created as a "nuke.createNode()" using the name argument
as the node to create.
Example: menubar = nuke.menu('Nuke') fileMenu =
menubar.findItem('File') fileMenu.addCommand('NewCommand', 'print 10',
shortcut='t')
- Parameters:
name - The name for the menu/toolbar item. The name may contain submenu
names delimited by '/' or '', and submenus are created as needed.
command - Optional. The command to add to the menu/toolbar. This can be a
string to evaluate or a Python Callable (function, method, etc)
to run.
shortcut - Optional. The keyboard shortcut for the command, such as 'R',
'F5' or 'Ctrl-H'. Note that this overrides pre-existing other
uses for the shortcut.
icon - Optional. An icon for the command. This should be a path to an
icon in the nuke.pluginPath() directory. If the icon is not
specified, Nuke will automatically try to find an icon with the
name argument and .png appended to it.
tooltip - Optional. The tooltip text, displayed on mouseover for toolbar
buttons.
index - Optional. The position to insert the new item in, in the
menu/toolbar. This defaults to last in the menu/toolbar.
readonly - Optional. True/False for whether the item should be available
when the menu is invoked in a read-only context.
- Returns: The menu/toolbar item that was added to hold the command
- The menu/toolbar item that was added to hold the command.
|