nodedge.editor_widget¶
Editor widget module containing EditorWidget
class.
-
class
nodedge.editor_widget.
EditorWidget
(parent=None)¶ Bases:
PySide2.QtWidgets.QWidget
EditorWidget
classDefault constructor.
- Parameters
parent (
QWidget
) – parent widget- Instance Attributes
filename - currently graph’s filename or
None
-
SceneClass
¶ alias of
nodedge.scene.Scene
-
GraphicsViewClass
¶ alias of
nodedge.graphics_view.GraphicsView
-
initUI
()¶ Set up this
EditorWidget
with its layout,Scene
andGraphicsView
.
-
property
hasName
¶ - Getter
Return if a file has been loaded in this
EditorWidget
or not.- Return type
bool
-
property
shortName
¶ - Getter
Return the short name of this
EditorWidget
.- Return type
str
-
property
userFriendlyFilename
¶ - Getter
Return the user friendly filename.
Note
This name is displayed as window title.
- Return type
str
-
property
canUndo
¶ - Getter
Return whether previously executed operations are saved in history or not.
- Return type
bool
-
property
canRedo
¶ - Getter
Return whether the history contains cancelled operations or not.
- Return type
bool
-
property
selectedItems
¶ - Getter
Return
Scene
’s currently selected items.- Return type
list[QGraphicsItem]
-
property
hasSelectedItems
¶ - Getter
Return
True
if there is selected items in thenodedge.node_scene.Scene
.- Return type
bool
-
updateTitle
() → None¶ Update the
QMainWindow
’s title with the user friendly filename.
-
newFile
() → None¶ Create a new file. Clear the scene and history, and reset filename.
-
loadFile
(filename: str) → bool¶ Load serialized graph from JSON file.
- Parameters
filename (
str
) – file to load- Returns
Operation success
- Return type
bool
-
saveFile
(filename: Optional[str] = None) → bool¶ Save serialized graph to JSON file. When called with empty parameter, the filename is unchanged.
- Parameters
filename (
str
|None
) – file to store the graph- Returns
Operation success
- Return type
bool
-
evalNodes
() → None¶ Evaluate all the nodes present in the scene.
-
mouseReleaseEvent
(ev: PySide2.QtGui.QMouseEvent) → None¶ Handle Qt’s mouse’s button release event.
- Parameters
ev (
QMouseEvent
) – Mouse release event
-
mousePressEvent
(ev: PySide2.QtGui.QMouseEvent) → None¶ Handle Qt’s mouse’s button press event.
- Parameters
ev (
QMouseEvent
) – Mouse press event
-
addDebugContent
() → None¶ Testing method to put random QGraphicsItems and elements into QGraphicsScene
-
addCustomNode
()¶ Testing method to create a custom Node with custom content
-
staticMetaObject
= <PySide2.QtCore.QMetaObject object>¶