Skip to content
Logo LogoNodeGraphQt
🔍︎
Logo LogoNodeGraphQt

Examples

  • General Overview
  • Node Overview
  • Port Overview
  • Pipe Overview
  • Menu Overview
  • Host Application Examples

API Reference

  • Constants
  • Graphs
    • NodeGraph
    • SubGraph
  • Nodes
    • NodeObject
    • BackdropNode
    • BaseNode
    • BaseNode (Circle)
    • GroupNode
    • Port Nodes
  • Port
  • Menus

Widgets

  • Embedded Node Widgets
  • PropertiesBinWidget
  • NodesPaletteWidget
  • NodesTreeWidget

NodeGraphQt - v0.6.38
NodeGraphQt
/
Menus

Menus

See Menu Overview from the overview section.

Classes:

NodeGraphMenu(graph, qmenu)

The NodeGraphMenu is the main context menu triggered from the node graph.

NodesMenu(graph, qmenu)

The NodesMenu is the context menu triggered from a node.

NodeGraphCommand(graph, qaction[, func])

Node graph menu command.


GraphMenu

The context menu triggered from the node graph.
class NodeGraphQt.NodeGraphMenu(graph, qmenu)

The NodeGraphMenu is the main context menu triggered from the node graph.

Inheritance diagram of NodeGraphQt.NodeGraphMenu

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.

get_items()

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.

add_separator()

Adds a separator to the menu.

name()

Returns the name for the menu.

Returns:

label name.

Return type:

str

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:

NodeGraphQt.NodeGraphMenu

get_command(name)

Returns the child menu command by name.

Parameters:

name (str) – name of the command.

Returns:

context menu command.

Return type:

NodeGraphQt.NodeGraphCommand

add_menu(name)

Adds a child menu to the current menu.

Parameters:

name (str) – menu name.

Returns:

the appended menu item.

Return type:

NodeGraphQt.NodeGraphMenu

add_command(name, func=None, shortcut=None)

Adds a command to the menu.

Parameters:
  • name (str) – command name.

  • func (function) – command function eg. “func(graph)”.

  • shortcut (str) – shortcut key.

Returns:

the appended command.

Return type:

NodeGraphQt.NodeGraphCommand

add_separator()

Adds a separator to the menu.


NodesMenu

The context menu triggered from a node.
class NodeGraphQt.NodesMenu(graph, qmenu)

The NodesMenu is the context menu triggered from a node.

Inheritance diagram of NodeGraphQt.NodesMenu

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:

NodeGraphQt.NodeGraphCommand


NodeGraphCommand

class NodeGraphQt.NodeGraphCommand(graph, qaction, func=None)

Node graph menu command.

Inheritance diagram of NodeGraphQt.NodeGraphCommand

Attributes:

slot_function

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.

run_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

name()

Returns the name for the menu command.

Returns:

label name.

Return type:

str

set_shortcut(shortcut=None)

Sets the shortcut key combination for the menu command.

Parameters:

shortcut (str) – shortcut key.

run_command()

execute the menu command.

set_enabled(state)

Sets the command to either be enabled or disabled.

Parameters:

state (bool) – true to enable.

set_hidden(hidden)

Sets then command item visibility in the context menu.

Parameters:

hidden (bool) – true to hide the command item.

show()

Set the command to be visible in the context menu.

hide()

Set the command to be hidden in the context menu.

Port
Embedded Node Widgets

© 2024, Johnny ChanÂ