QNodeEditor.editor.NodeEditor#

class QNodeEditor.editor.NodeEditor(parent: ~PyQt5.QtWidgets.QWidget = None, theme: ~typing.Type[~QNodeEditor.themes.theme.Theme] = <class 'QNodeEditor.themes.dark.DarkTheme'>, allow_multiple_inputs: bool = False)#

Bases: QWidget

Node editor widget containing a node scene and view

Widget that contains a NodeScene and a NodeView of that scene. To change the node editor, access the scene attribute to modify the node scene.

scene#

Node scene

Type:

NodeScene

view#

View of the node scene

Type:

NodeView

Properties

available_nodes

Get or set the available nodes in the scene.

errored(PyQt_PyObject)

Signal that emits the error if evaluation failed

evaluated(PyQt_PyObject)

Signal that emits the evaluation result if successful

output_node

Get or set the node that should be used as the output node.

theme

Get or set the theme of the node editor.

Methods

__init__

Create a new node editor widget.

load

Load a node scene state from a file

save

Save the node scene state to a file.

__init__(parent: ~PyQt5.QtWidgets.QWidget = None, theme: ~typing.Type[~QNodeEditor.themes.theme.Theme] = <class 'QNodeEditor.themes.dark.DarkTheme'>, allow_multiple_inputs: bool = False)#

Create a new node editor widget.

Parameters:
  • parent (QWidget, optional) – Parent widget for this node editor (if any)

  • theme (Type[Theme], optional) – Theme for the node editor (default: DarkTheme)

  • allow_multiple_inputs (bool) – If set to True, multiple edges can be connected to the same node input. Otherwise, only a single edge can be connected to any input.

load(filepath: str) None#

Load a node scene state from a file

Parameters:

filepath (str) – Path to file to load node scene state from

Return type:

None

save(filepath: str) None#

Save the node scene state to a file.

Parameters:

filepath (str) – Path to file to save node scene state in

Return type:

None

property available_nodes: dict[str, Type[Node]]#

Get or set the available nodes in the scene.

This is a (nested) dictionary with pairs of (name, Type[Node]). These names are displayed in the context menu in the node editor when adding new nodes. The added node is then of the type provided in the pair with it. Use a nested dictionary to create sub-menus in the context menu.

See also

available_nodes

more detailed explanation

errored(PyQt_PyObject): Signal#

Signal that emits the error if evaluation failed

Type:

Signal

evaluated(PyQt_PyObject): Signal#

Signal that emits the evaluation result if successful

Type:

Signal

property output_node: Type[Node]#

Get or set the node that should be used as the output node.

This node will not be evaluated, but is used to create the evaluation result. The preceding nodes are evaluated, and the resulting value(s) wired to the output node are recorded and emitted through the evaluated signal.

property theme: Type[Theme]#

Get or set the theme of the node editor.

Setting the theme of the node editor widget affects all child elements.