Skip to content

Editor widget

The widget you embed in your application. It creates a Scene and the graphics view that shows it.

nodeeditor.node_editor_widget

A module containing NodeEditorWidget class

NodeEditorWidget

Bases: QWidget

Widget hosting a graph :class:~nodeeditor.node_scene.Scene and its graphics view.

The Scene and the GraphicsView classes used by this widget can be replaced by subclasses through the Scene_class and GraphicsView_class attributes.

initUI

initUI()

Set up this NodeEditorWidget with its layout, :class:~nodeeditor.node_scene.Scene and :class:~nodeeditor.node_graphics_view.QDMGraphicsView

isModified

isModified()

Has the Scene been modified?

:return: True if the Scene has been modified :rtype: bool

isFilenameSet

isFilenameSet()

Do we have a graph loaded from file or are we creating a new one?

:return: True if filename is set. False if it is a new graph not yet saved to a file :rtype: ''bool''

getSelectedItems

getSelectedItems()

Shortcut returning Scene's currently selected items

:return: list of QGraphicsItems :rtype: list[QGraphicsItem]

hasSelectedItems

hasSelectedItems()

Is there something selected in the :class:nodeeditor.node_scene.Scene?

:return: True if there is something selected in the Scene :rtype: bool

canUndo

canUndo()

Can Undo be performed right now?

:return: True if we can undo :rtype: bool

canRedo

canRedo()

Can Redo be performed right now?

:return: True if we can redo :rtype: bool

getUserFriendlyFilename

getUserFriendlyFilename()

Get user friendly filename. Used in the window title

:return: just a base name of the file or 'New Graph' :rtype: str

fileNew

fileNew()

Empty the scene (create new file)

fileLoad

fileLoad(filename)

Load serialized graph from JSON file

:param filename: file to load :type filename: str

fileSave

fileSave(filename=None)

Save serialized graph to JSON file. When called with an empty parameter, we won't store/remember the filename.

:param filename: file to store the graph :type filename: str
:return: True if the file was saved successfully, False otherwise

addNodes

addNodes()

Testing method to create 3 Nodes with 3 Edges connecting them

addCustomNode

addCustomNode()

Testing method to create a custom Node with custom content

addDebugContent

addDebugContent()

Testing method to put random QGraphicsItems and elements into QGraphicsScene