QNodeEditor.dialog.NodeEditorDialog#

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

Bases: QDialog

Dialog containing a node editor and handling buttons

This dialog houses a node editor and provides an easy way to evaluate scenes. The internal NodeEditor provides all the node editing capabilities, and the dialog handles all errors and calculation results for you. The NodeEditor can be accessed through the editor attribute.

If the scene is evaluated and no error occurs, the dialog is accepted and closes. If the dialog was opened using .exec(), this will return True. The calculation result is stored in the result attribute, such that it can be accessed.

If the scene is evaluated and an error does occur, the dialog remains open. An error message appears below the editor with the name of the error. Besides it is a button that opens a popup with the exact error traceback and further details.

Examples

Create a new dialog and run it using the .exec() method. Once the node scene is successfully evaluated, it will return True (and False otherwise). If the scene was evaluated, the result of the calculation can be found in the result attribute.

dialog = NodeEditorDialog()
if dialog.exec():
    print(dialog.result)
editor#

Node editor widget that shows an interactive node scene

Type:

NodeEditor

result#

Result of the evaluated scene (None if not evaluated). There is an item in the dictionary for each input of the selected output node. The keys are the names of the entries, and the values the input result that they received.

Type:

dict[str, Any] or None

Properties

theme

Get or set the theme of the node editor dialog.

Methods

__init__

Create a new node editor dialog.

keyPressEvent

Prevent dialog from closing if return or enter is pressed.

__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 dialog.

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

  • theme (Type[Theme], optional) – Theme for the dialog (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.

property theme: Type[Theme]#

Get or set the theme of the node editor dialog.

Setting the dialog theme automatically affects all child elements including the node editor itself.