Menus
Classes:
|
The |
|
The |
|
Node graph menu command. |
GraphMenu
- class NodeGraphQt.NodeGraphMenu(graph, qmenu)
The
NodeGraphMenuis the main context menu triggered from the node graph.
example for accessing the node graph context menu.
1from NodeGraphQt import NodeGraph 2 3node_graph = NodeGraph() 4 5# get the context menu for the node graph. 6context_menu = node_graph.get_context_menu('graph')
Methods:
name()Returns the name for the menu.
Return the menu items in the order they were added.
get_menu(name)Returns the child menu by name.
get_command(name)Returns the child menu command by name.
add_menu(name)Adds a child menu to the current menu.
add_command(name[, func, shortcut])Adds a command to the menu.
Adds a separator to the menu.
- get_items()
Return the menu items in the order they were added.
- Returns:
current menu items.
- Return type:
list
- get_menu(name)
Returns the child menu by name.
- Parameters:
name (str) – name of the menu.
- Returns:
menu item.
- Return type:
- get_command(name)
Returns the child menu command by name.
- Parameters:
name (str) – name of the command.
- Returns:
context menu command.
- Return type:
- add_menu(name)
Adds a child menu to the current menu.
- Parameters:
name (str) – menu name.
- Returns:
the appended menu item.
- Return type:
NodesMenu
- class NodeGraphQt.NodesMenu(graph, qmenu)
The
NodesMenuis the context menu triggered from a node.
example for accessing the nodes context menu.
1from NodeGraphQt import NodeGraph 2 3node_graph = NodeGraph() 4 5# get the nodes context menu. 6nodes_menu = node_graph.get_context_menu('nodes')
Methods:
add_command(name[, func, node_type, ...])Re-implemented to add a command to the specified node type menu.
- add_command(name, func=None, node_type=None, node_class=None, shortcut=None)
Re-implemented to add a command to the specified node type menu.
- Parameters:
name (str) – command name.
func (function) – command function eg. “func(
graph,node)”.node_type (str) – specified node type for the command.
node_class (class) – specified node class for the command.
shortcut (str) – shortcut key.
- Returns:
the appended command.
- Return type:
NodeGraphCommand
- class NodeGraphQt.NodeGraphCommand(graph, qaction, func=None)
Node graph menu command.

Attributes:
The function executed by this command.
Methods:
name()Returns the name for the menu command.
set_shortcut([shortcut])Sets the shortcut key combination for the menu command.
execute the menu command.
set_enabled(state)Sets the command to either be enabled or disabled.
set_hidden(hidden)Sets then command item visibility in the context menu.
show()Set the command to be visible in the context menu.
hide()Set the command to be hidden in the context menu.
- property slot_function
The function executed by this command.
- Returns:
command function.
- Return type:
function
- set_shortcut(shortcut=None)
Sets the shortcut key combination for the menu command.
- Parameters:
shortcut (str) – shortcut key.
- set_enabled(state)
Sets the command to either be enabled or disabled.
- Parameters:
state (bool) – true to enable.