Content widgets
Content widgets are the widgets drawn inside a node, and the decorators provide the node title and the collapse/expand button.
nodeeditor.node_content_widget ¶
A module containing the base class for the Node's content graphical representation. It also contains an example of an overridden Text Widget, which can pass a notification to it's parent about being modified.
QDMNodeContentWidget ¶
Bases: QWidget, Serializable
Base class for representation of the Node's graphics content. This class also provides layout
for other widgets inside of a :py:class:~nodeeditor.node_node.Node
initUI ¶
Sets up layouts and widgets to be rendered in :py:class:~nodeeditor.node_graphics_node.QDMGraphicsNode class.
setEditingFlag ¶
.. note::
If you are handling keyPress events by default Qt Window's shortcuts and ``QActions``, you will not
need to use this method.
Helper function which sets editingFlag inside :py:class:~nodeeditor.node_graphics_view.QDMGraphicsView class.
This is a helper function to handle keys inside nodes with QLineEdits or QTextEdits (you can
use overridden :py:class:QDMTextEdit class) and with QGraphicsView class method keyPressEvent.
:param value: new value for editing flag
serialize ¶
Serialization method to serialize this class data into OrderedDict.
The content widget holds no state of its own, so there is nothing to store.
:return: data serialized in OrderedDict
:rtype: OrderedDict
deserialize ¶
Deserialization method which takes data in python dict format.
The content widget holds no state of its own, so there is nothing to restore and the call always succeeds.
:param data: Dictionary containing serialized data
:type data: dict
:param hashmap: Helper dictionary containing references (by id == key) to existing objects
:type hashmap: dict
:param restore_id: True if we are creating new objects. False is useful when loading existing
objects of which we want to keep the existing object's id.
:type restore_id: bool
:return: True if deserialization was successful, otherwise False
:rtype: bool
QDMTextEdit ¶
Bases: QTextEdit
.. note::
This class is an example of a ``QTextEdit`` modification that handles the `Delete` key event with an overridden
Qt's ``keyPressEvent`` (when not using ``QActions`` in menu or toolbar)
Overridden QTextEdit which sends a notification about being edited to its parent's container :py:class:QDMNodeContentWidget
nodeeditor.node_icon_content_widget ¶
A module containing the base class for the Node's content graphical representation. It also contains an example of an overridden Text Widget, which can pass a notification to it's parent about being modified.
QDMNodeIconContentWidget ¶
Bases: QWidget, Serializable
Base class for representation of the Node's graphics content. This class also provides layout
for other widgets inside of a :py:class:~nodeeditor.node_node.Node
initUI ¶
Sets up layouts and widgets to be rendered in :py:class:~nodeeditor.node_graphics_node.QDMGraphicsNode class.
setEditingFlag ¶
.. note::
If you are handling keyPress events by default Qt Window's shortcuts and ``QActions``, you will not
need to use this method.
Helper function which sets editingFlag inside :py:class:~nodeeditor.node_graphics_view.QDMGraphicsView class.
This is a helper function to handle keys inside nodes with QLineEdits or QTextEdits (you can
use overridden :py:class:QDMTextEdit class) and with QGraphicsView class method keyPressEvent.
:param value: new value for editing flag
serialize ¶
Serialization method to serialize this class data into OrderedDict.
:return: data serialized in OrderedDict
:rtype: OrderedDict
deserialize ¶
Deserialization method which takes data in python dict format.
The icon content holds no state of its own, so there is nothing to restore and the call always succeeds.
:param data: Dictionary containing serialized data
:type data: dict
:param hashmap: Helper dictionary containing references (by id == key) to existing objects
:type hashmap: dict
:param restore_id: True if we are creating new objects. False is useful when loading existing
objects of which we want to keep the existing object's id.
:type restore_id: bool
:return: True if deserialization was successful, otherwise False
:rtype: bool
QDMTextEdit ¶
Bases: QTextEdit
.. note::
This class is an example of a ``QTextEdit`` modification that handles the `Delete` key event with an overridden
Qt's ``keyPressEvent`` (when not using ``QActions`` in menu or toolbar)
Overridden QTextEdit which sends a notification about being edited to its parent's container :py:class:QDMNodeContentWidget
nodeeditor.node_icon_graphics_node ¶
A module containing Graphics representation of :class:~nodeeditor.node_node.Node
QDMIconGraphicsNode ¶
Bases: QGraphicsItem
Class describing Graphics representation of :class:~nodeeditor.node_node.Node
title
property
writable
¶
title of this Node
:getter: current Graphics Node title :setter: stores and make visible the new title :type: str
doSelect ¶
Safe version of selecting the Graphics Node. Takes care about the selection state flag used internally
:param new_state: True to select, False to deselect
:type new_state: bool
itemChange ¶
Refresh this node's edges when Qt moves it.
Qt moves the dragged node - and every other node in the selection - itself. Reacting to the position change Qt already reports updates the edges of exactly the nodes that moved, replacing the old per-mouse-move scan of every node in the scene.
mouseReleaseEvent ¶
Overriden event to handle when we moved, selected or deselected this Node
mouseDoubleClickEvent ¶
Overriden event for doubleclick. Resend to Node::onDoubleClicked
setDetailState ¶
Apply a resolved per-element detail state.
The scene resolves its detail policy into a mapping of element key to
"draw it" and hands the whole mapping over, so an application can add
elements of its own to the same broadcast and read them back here.
The zoom state itself rides along under the detail key.
Every child is pushed, not only the ones whose flag changed: a socket or a content proxy built after the last flip has never seen the state.
setDetailVisible ¶
Show or hide this node's fine detail at low zoom.
The legacy entry point, kept for callers outside the scene: it drops
the content widget, the floating label and the socket circles together.
The scene uses :meth:setDetailState instead, which resolves each of
those separately.
syncDetailVisibility ¶
Push the scene's current detail state onto every child item.
The sockets and the content proxy are built during Node.__init__,
after Qt already reported this node joining the scene, so the scene's
one-off broadcast never reached them - and Qt's
ItemChildAddedChange hands over a base-class wrapper for an item
still inside its own constructor, which has no setDetailVisible.
Called from Node.__init__ once the node is fully built.
initContent ¶
Set up the grContent - QGraphicsProxyWidget to have a container for Graphics Content
initLabel ¶
Create the floating single-line label above the node (hidden until text is set).
setLabelText ¶
Set label text (single-line). Empty text hides the label. No history stored.
setLabelVisible ¶
Show/hide the label. Hidden when text is empty regardless.
setLabelOffset ¶
Set the gap in px between node top and label bottom.
:param offset: the new gap in px
:type offset: float
setLabelColor ¶
Set the text color of the label.
:param color: the new text color :type color: QColor
setLabelFont ¶
Set the font of the label and move the label to its new position.
:param font: the new font :type font: QFont
setLabelBackground ¶
Set the background and border colors of the label box.
:param bg: background color of the label box :type bg: QColor :param border: border color of the label box :type border: QColor
nodeeditor.node_decorators ¶
A module containing the decorator which marks classes as automatically serializable
MakeSerializable ¶
Registry for classes that should be automatically serialized