nodedge.mdi_widget

Editor widget module containing EditorWidget class.

class nodedge.mdi_widget.MdiWidget

Bases: nodedge.editor_widget.EditorWidget

MdiWidget class.

The mdi widget represents a sub-window of the MdiWindow.

Default constructor.

Parameters

parent (QWidget) – parent widget

Instance Attributes

  • filename - currently graph’s filename or None

initNewNodeActions()

Add all available blocks in the NodeListWidget.

initNodesContextMenu()

Create a context menu containing all the nodes available, so that the user can quickly create a new block by right clicking on the Scene.

static getNodeClassFromData(data)

Get the node class associated with operation present in data.

Parameters

data – serialized Node containing the operation code

Type

dict

Returns

class of the node associated with the operation code in data, node class in case of failure.

Return type

Node class

addCloseEventListener(callback: Callable[[nodedge.editor_widget.EditorWidget, PySide2.QtGui.QCloseEvent], None])

Register callback for Has Been Modified event

Parameters

callback (Callable[[], None]) – callback function

closeEvent(event: PySide2.QtGui.QCloseEvent) → None

Handle Qt’s close event.

Make sure changes have been saved before closing the widget.

Parameters

event (QCloseEvent.py) – Qt’s close event, the user may have clicked on the close button, or pressed CTRL+W

onNodeDragEnter(event: PySide2.QtGui.QDragEnterEvent)

Handle node drag enter event.

When a node is dragged from the NodeListWidget, its logo is displayed above the scene, near the location of the mouse.

Parameters

event – the Qt’s drag event event, containing the mime data of the node being dragged

Returns

QDragEnterEvent

onNodeDrop(event: PySide2.QtGui.QDropEvent)

Handle node drop event.

When the node is dropped, an instance of it is created near at the mouse location, displayed by its GraphicsNode.

Parameters

event (QDropEvent.py) – the Qt’s drop event, containing the mime data of the node being dropped.

contextMenuEvent(event: PySide2.QtGui.QContextMenuEvent)

Handle Qt’s context menu event.

Parameters

event (QContextMenuEvent.py) – the Qt’s context menu event, happening when the user right clicks on the GraphicsScene

handleNodeContextMenu(event: PySide2.QtGui.QContextMenuEvent)

Handle Qt’s context menu event when the user has clicked on a node.

Parameters

event – Qt’s context menu event, happening when the users

Returns

QContextMenuEvent

static determineTargetSocketOfNode(wasDraggedFlag: bool, newNode: nodedge.node.Node) → Optional[nodedge.connector.Socket]
finishNewNodeState(newNode)
handleNewNodeContextMenu(event)

Handle context menu event when the users has right clicked on an empty space.

Show all available nodes available in a list context menu, so that the users can quickly create a new one.

Parameters

event (QContextMenuEvent.py) – the Qt’s context menu event, happening when the user right clicks on the GraphicsScene

handleEdgeContextMenu(event)

Handle Qt’s context menu when the user has right clicked on an GraphicsEdge

Parameters

event (QContextMenuEvent) – the Qt’s context menu event, happening when the user right clicks on the GraphicsScene

mouseReleaseEvent(event: PySide2.QtGui.QMouseEvent)

Handle Qt’s mouse release event.

Parameters

event – Qt’s mouse release event

Returns

QMouseEvent

staticMetaObject = <PySide2.QtCore.QMetaObject object>