node_editor_widget Module¶
A module containing NodeEditorWidget class
-
class
nodeeditor.node_editor_widget.NodeEditorWidget(parent: Optional[PyQt5.QtWidgets.QWidget] = None)¶ Bases:
PyQt5.QtWidgets.QWidget- Parameters
parent (
QWidget) – parent widget- Instance Attributes
filename - currently graph’s filename or
None
-
Scene_class¶ alias of
nodeeditor.node_scene.Scene
-
GraphicsView_class¶
-
initUI()¶ Set up this
NodeEditorWidgetwith its layout,SceneandQDMGraphicsView
-
isModified() → bool¶ Has the Scene been modified?
- Returns
Trueif the Scene has been modified- Return type
bool
-
isFilenameSet() → bool¶ Do we have a graph loaded from file or are we creating a new one?
- Returns
Trueif filename is set.Falseif it is a new graph not yet saved to a file- Return type
‘’bool’’
-
getSelectedItems() → list¶ Shortcut returning Scene’s currently selected items
- Returns
list of
QGraphicsItems- Return type
list[QGraphicsItem]
-
hasSelectedItems() → bool¶ Is there something selected in the
nodeeditor.node_scene.Scene?- Returns
Trueif there is something selected in the Scene- Return type
bool
-
canUndo() → bool¶ Can Undo be performed right now?
- Returns
Trueif we can undo- Return type
bool
-
canRedo() → bool¶ Can Redo be performed right now?
- Returns
Trueif we can redo- Return type
bool
-
getUserFriendlyFilename() → str¶ Get user friendly filename. Used in the window title
- Returns
just a base name of the file or ‘New Graph’
- Return type
str
-
fileNew()¶ Empty the scene (create new file)
-
fileLoad(filename: str)¶ Load serialized graph from JSON file
- Parameters
filename (
str) – file to load
-
fileSave(filename: Optional[str] = None)¶ Save serialized graph to JSON file. When called with an empty parameter, we won’t store/remember the filename.
- Parameters
filename (
str) – file to store the graph
-
addNodes()¶ Testing method to create 3 Nodes with 3 Edges connecting them
-
addCustomNode()¶ Testing method to create a custom Node with custom content
-
addDebugContent()¶ Testing method to put random QGraphicsItems and elements into QGraphicsScene