nodedge.graphics_node_content

Graphics node content module containing the GraphicsNodeContent class.

class nodedge.graphics_node_content.GraphicsNodeContent(node: Node, parent: Optional[PySide2.QtWidgets.QWidget] = None)

Bases: PySide2.QtWidgets.QWidget, nodedge.serializable.Serializable

GraphicsNodeContent class.

Base class for representation of the Node’s graphics content. This class also provides layout for other widgets inside of a Node.

Parameters
  • node (Node) – reference to the Node

  • parent (QWidget) – parent widget

Instance Attributes
  • node - reference to the Node

  • layout - QLayout container

initUI()

Sets up layouts and widgets to be rendered in QDMGraphicsNode class.

setEditingFlag(value: bool) → None

Note

If you are handling keyPress events by default Qt Window’s shortcuts and QActions, you will not probably need to use this method

Helper function which sets editingFlag inside GraphicsView class.

This is a helper function to handle keys inside nodes with QLineEdits or QTextEdits (you can use overridden TextEdit class) and with QGraphicsView class method keyPressEvent.

Parameters

value (bool) – new value for editing flag

serialize() → collections.OrderedDict

Default serialization method.

It needs to be overridden for each node implementation.

Return OrderedDict

Serialized data as ordered dictionary

deserialize(data: dict, hashmap: Optional[dict] = None, restoreId: bool = False, *args, **kwargs) → bool

Default deserialize method.

It needs to be overridden for each node implementation.

Parameters
  • data (dict) – serialized data dictionary

  • hashmap (dict) –

  • restoreId (bool) – whether or not the id of the objects are restored

Return bool

success status

staticMetaObject = <PySide2.QtCore.QMetaObject object>
class nodedge.graphics_node_content.TextEdit

Bases: PySide2.QtWidgets.QTextEdit

Note

This class is example of QTextEdit modification to be able to handle Delete key with overridden Qt’s keyPressEvent (when not using QActions in menu or toolbar)

overridden QTextEdit which sends notification about being edited to parent’s container GraphicsNodeContent

focusInEvent(event: PySide2.QtGui.QFocusEvent) → None

Example of overridden focusInEvent to mark start of editing.

Parameters

event (QFocusEvent) – Qt’s focus event

focusOutEvent(event: PySide2.QtGui.QFocusEvent) → None

Example of overridden focusOutEvent to mark end of editing

Parameters

event (QFocusEvent) – Qt’s focus event

staticMetaObject = <PySide2.QtCore.QMetaObject object>
class nodedge.graphics_node_content.GraphicsNodeContentProxy(graphicsNodeParent: GraphicsNode)

Bases: PySide2.QtWidgets.QGraphicsProxyWidget

GraphicsNodeContentProxy class.

It is a QGraphicsProxyWidget around the GraphicsNodeContent.

staticMetaObject = <PySide2.QtCore.QMetaObject object>