Package nuke :: Class MenuBar
[hide private]
[frames] | no frames]

Class MenuBar

object --+
         |
        nuke.MenuBar

MenuBar

Instance Methods [hide private]
bool
addAction(self, action)
Adds the QAction to the menu.
The menu/toolbar item that was added to hold the command
addCommand(self, name, command, shortcut, icon, tooltip, index, readonly)
Add a new command to this menu/toolbar.
The submenu that was added
addMenu(self, **kwargs)
Add a new submenu.
The separator that was created
addSeparator(self, **kwargs)
Add a separator to this menu/toolbar.
 
clearMenu(self)
Clears a menu.
Menu or None
findItem(self, name)
Finds a submenu or command with a particular name.
None
items(self)
Returns a list of sub menu items.
Menu or None
menu(self, name)
Finds a submenu or command with a particular name.
String
name(self)
Returns the name of the menu item.
None
removeItem(self, name)
Removes a submenu or command with a particular name.
None
updateMenuItems()
Updates menu items' states.

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __init__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

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.
  • shortcutContext - Optional. Sets the shortcut context (0==Window, 1=Application, 2=DAG).
Returns: The menu/toolbar item that was added to hold the command
The menu/toolbar item that was added to hold the command.

addMenu(self, **kwargs)

 

Add a new submenu.

Parameters:
  • **kwargs, The, following, keyword, arguments, are, accepted - name The name for the menu/toolbar item icon An icon for the menu. Loaded from the nuke search path. tooltip The tooltip text. index The position to insert the menu in. Use -1 to add to the end of the menu.
Returns: The submenu that was added
The submenu that was added.

addSeparator(self, **kwargs)

 

Add a separator to this menu/toolbar.

Parameters:
  • **kwargs, The, following, keyword, arguments, are, accepted - index The position to insert the new separator in, in the menu/toolbar.
Returns: The separator that was created
The separator that was created.

clearMenu(self)

 

Clears a menu.

Parameters:
  • **kwargs, The, following, keyword, arguments, are, accepted - name The name for the menu/toolbar item
Returns:
true if cleared, false if menu not found

findItem(self, name)

 

Finds a submenu or command with a particular name.

Parameters:
  • name - The name to search for.
Returns: Menu or None
The submenu or command we found, or None if we could not find anything.

menu(self, name)

 

Finds a submenu or command with a particular name.

Parameters:
  • name - The name to search for.
Returns: Menu or None
The submenu or command we found, or None if we could not find anything.

removeItem(self, name)

 

Removes a submenu or command with a particular name. If the containing menu becomes empty, it will be removed too.

Parameters:
  • name - The name to remove for.
Returns: None
true if removed, false if menu not found

updateMenuItems()

 

Updates menu items' states. Call on about to show menu.

Returns: None