node_editor package

Submodules

node_editor.node_content_widget module

node_editor.node_edge module

A module containing NodeEditor’s class for representing Edge and Edge Type Constants.

node_editor.node_edge.EDGE_TYPE_BEZIER = 2
node_editor.node_edge.EDGE_TYPE_DIRECT = 1
node_editor.node_edge.EDGE_TYPE_SQUARE = 3
class node_editor.node_edge.Edge(scene: Scene, start_socket: Socket = None, end_socket: Socket = None, edge_type=1)[source]

Bases: Serializable

Class for representing Edge in NodeEditor.

Attributes
edge_type

Edge type

end_socket

End socket

start_socket

Start socket

Methods

createEdgeClassInstance()

Create instance of grEdge class :return: Instance of grEdge class representing the Graphics Edge in the grScene

deserialize(data[, hashmap, restore_id])

Deserialization method which take data in python dict format with helping hashmap containing references to existing entities.

doSelect([new_state])

Provide the safe selecting/deselecting operation.

getEdgeValidators()

Return the list of Edge Validator Callbacks

getGraphicsEdgeClass()

Returns the class representing Graphics Edge

getOtherSocket(known_socket)

Returns the opposite socket on this Edge

reconnect(from_socket, to_socket)

Helper function which reconnects edge from_socket to to_socket

registerEdgeValidator(validator_callback)

Register Edge Validator Callback

remove([silent_for_socket, silent])

Safely remove this Edge.

remove_from_sockets()

Helper function which sets start and end Socket to None

serialize()

Serialization method to serialize this class data into OrderedDict which can be easily stored in memory or file.

updatePositions()

Updates the internal Graphics Edge positions according to the start and end Socket.

validateEdge(start_socket, end_socket)

Validate Edge agains all registered Edge Validator Callbacks

createEdgeClassInstance()[source]

Create instance of grEdge class :return: Instance of grEdge class representing the Graphics Edge in the grScene

deserialize(data: dict, hashmap: dict = {}, restore_id: bool = True, *args, **kwargs) bool[source]

Deserialization method which take data in python dict format with helping hashmap containing references to existing entities.

Parameters
  • data (dict) – Dictionary containing serialized data

  • hashmap (dict) – Helper dictionary containing references (by id == key) to existing objects

  • restore_id (bool) – True if we are creating new Sockets. False is useful when loading existing Sockets of which we want to keep the existing object’s id.

Returns

True if deserialization was successful, otherwise False

Return type

bool

doSelect(new_state: bool = True)[source]

Provide the safe selecting/deselecting operation. In the background it takes care about the flags, notifications and storing history for undo/redo.

Parameters

new_state (bool) – True if you want to select the Edge, False if you want to deselect the Edge

property edge_type

Edge type

Getter

get edge type constant for current Edge. See edge-type-constants

Setter

sets new edge type. On background, creates new QDMGraphicsEdge child class if necessary, adds this QGraphicsPathItem to the QGraphicsScene and updates edge sockets positions.

edge_validators = []

class variable containing list of registered edge validators

property end_socket

End socket

Getter

Returns end Socket or None if not set

Setter

Sets end Socket safely

Type

Socket or None

classmethod getEdgeValidators()[source]

Return the list of Edge Validator Callbacks

getGraphicsEdgeClass()[source]

Returns the class representing Graphics Edge

getOtherSocket(known_socket: Socket)[source]

Returns the opposite socket on this Edge

Parameters

known_socket (Socket) – Provide known Socket to be able to determine the opposite one.

Returns

The oposite socket on this Edge or None

Return type

Socket or None

reconnect(from_socket: Socket, to_socket: Socket)[source]

Helper function which reconnects edge from_socket to to_socket

classmethod registerEdgeValidator(validator_callback: function)[source]

Register Edge Validator Callback

Parameters

validator_callback (function) – A function handle to validate Edge

remove(silent_for_socket: Socket = None, silent=False)[source]

Safely remove this Edge.

Removes Graphics Edge from the QGraphicsScene and it’s reference to all GC to clean it up. Notifies nodes previously connected Node (s) about this event.

Triggers Nodes’:

  • onEdgeConnectionChanged()

  • onInputChanged()

Parameters
  • silent_for_socket (Socket) – Socket of a Node which won’t be notified, when this Edge is going to be removed

  • silent (bool) – True if no events should be triggered during removing

remove_from_sockets()[source]

Helper function which sets start and end Socket to None

serialize() OrderedDict[source]

Serialization method to serialize this class data into OrderedDict which can be easily stored in memory or file.

Returns

data serialized in OrderedDict

Return type

OrderedDict

property start_socket

Start socket

Getter

Returns start Socket

Setter

Sets start Socket safely

Type

Socket

updatePositions()[source]

Updates the internal Graphics Edge positions according to the start and end Socket. This should be called if you update Edge positions.

classmethod validateEdge(start_socket: Socket, end_socket: Socket) bool[source]

Validate Edge agains all registered Edge Validator Callbacks

Parameters
  • start_socket (Socket) – Starting Socket of Edge to check

  • end_socket (Socket) – Target/End Socket of Edge to check

Returns

True if the Edge is valid or False if not

Return type

bool

node_editor.node_edge_dragging module

A module containing the Edge Dragging functionality

class node_editor.node_edge_dragging.EdgeDragging(grView: QGraphicsView)[source]

Bases: object

Methods

edgeDragEnd(item)

Code handling the end of the dragging an Edge operation.

edgeDragStart(item)

Code handling the start of a dragging an Edge operation

getEdgeClass()

Helper function to get the Edge class.

updateDestination(x, y)

Update the end point of our dragging edge

edgeDragEnd(item: QGraphicsItem)[source]

Code handling the end of the dragging an Edge operation. If this code returns True then skip the rest of the mouse event processing. Can be called with None to cancel the edge dragging mode

Parameters

item (QGraphicsItem) – Item in the Graphics Scene where we ended dragging an Edge

edgeDragStart(item: QGraphicsItem)[source]

Code handling the start of a dragging an Edge operation

getEdgeClass()[source]

Helper function to get the Edge class. Using what Scene class provides

updateDestination(x: float, y: float)[source]

Update the end point of our dragging edge

Parameters
  • x – new X scene position

  • y – new Y scene position

node_editor.node_edge_intersect module

A module containing the intersecting nodes functionality. If a node gets dragged and dropped on an existing edge it will intersect that edge.

class node_editor.node_edge_intersect.EdgeIntersect(grView: QGraphicsView)[source]

Bases: object

Methods

dropNode(node, scene_pos_x, scene_pos_y)

Code handling the dropping of a node on an existing edge.

enterState(node)

Initialize when we enter the state

hotZoneRect(node)

Returns A QRectF of creating a box around a node

intersect(node_box)

Checking for intersection of a rectangle (usually a Node) with edges in the scene

isConnected(node)

Return True if node got any connections

leaveState(scene_pos_x, scene_pos_y)

Deinit when we leave this state

update(scene_pos_x, scene_pos_y)

Updating during mouse move when grView is in this state

dropNode(node: Node, scene_pos_x: float, scene_pos_y: float)[source]

Code handling the dropping of a node on an existing edge.

Parameters
  • scene_pos_x (float) – scene position x

  • scene_pos_y (float) – scene position y

enterState(node: Node)[source]

Initialize when we enter the state

Parameters

node (Node) – Node which we started to drag

hotZoneRect(node: Node) QRectF[source]

Returns A QRectF of creating a box around a node

Parameters

node (Node) – Node for which we want to get QRectF describing its position and area

Returns

QRectF describing node’s position and area

Return type

QRectF

intersect(node_box: QRectF) Edge[source]

Checking for intersection of a rectangle (usually a Node) with edges in the scene

Parameters

node_box (QRectF) – QRectF for which we want find intersecting Edges

Returns

Edge or None if the node is being cut by an Edge

Return type

Edge

isConnected(node: Node)[source]

Return True if node got any connections

Parameters

node (Node) – Node which connections to check

Returns

leaveState(scene_pos_x: float, scene_pos_y: float)[source]

Deinit when we leave this state

Parameters
  • scene_pos_x (float) – scene position x

  • scene_pos_y (float) – scene position y

update(scene_pos_x: float, scene_pos_y: float)[source]

Updating during mouse move when grView is in this state

Parameters
  • scene_pos_x (float) – scene position x

  • scene_pos_y (float) – scene position y

node_editor.node_edge_rerouting module

A module containing the Edge Rerouting functionality

class node_editor.node_edge_rerouting.EdgeRerouting(grView: QGraphicsView)[source]

Bases: object

Methods

clearReroutingEdges()

Remove the helping dashed edges from the Scene

getAffectedEdges()

Get a list of all edges connected to the self.start_socket where we started the re-routing

getEdgeClass()

Helper function to get the Edge class.

print(*args)

Helper function to better control debug printing to console for this feature

resetRerouting()

Reset to default state.

setAffectedEdgesVisible([visibility])

Show/Hide all edges connected to the self.start_socket where we started the re-routing

startRerouting(socket)

Method to start the re-routing.

stopRerouting([target])

Method for stopping the re-routing

updateScenePos(x, y)

Update position of all the rerouting edges (dashed ones).

clearReroutingEdges()[source]

Remove the helping dashed edges from the Scene

getAffectedEdges() list[source]

Get a list of all edges connected to the self.start_socket where we started the re-routing

Returns

List of all edges affected by the rerouting started from this self.start_socket Socket

Return type

list

getEdgeClass()[source]

Helper function to get the Edge class. Using what the Scene class provides

print(*args)[source]

Helper function to better control debug printing to console for this feature

resetRerouting()[source]

Reset to default state. Init this feature internal variables

setAffectedEdgesVisible(visibility: bool = True)[source]

Show/Hide all edges connected to the self.start_socket where we started the re-routing

Parameters

visibility (bool) – True if all the affected Edge (s) should be shown or hidden

startRerouting(socket: Socket)[source]

Method to start the re-routing. Called from the grView’s state machine.

Parameters

socket (Socket) – Socket where we started the re-routing

stopRerouting(target: Socket = None)[source]

Method for stopping the re-routing

Parameters

target (Socket or None) – Target where we ended the rerouting (usually released mouse button). Provide Socket or None to cancel

updateScenePos(x: float, y: float)[source]

Update position of all the rerouting edges (dashed ones). Called from mouseMove event to update to new mouse position

Parameters
  • x (float) – new X position

  • y (float) – new Y position

node_editor.node_edge_snapping module

A module containing the Edge Snapping functions which are used in QDMGraphicsView class.

class node_editor.node_edge_snapping.EdgeSnapping(grView: QGraphicsView, snapping_radius: float = 24)[source]

Bases: object

Methods

getSnappedSocketItem(event)

Returns QDMGraphicsSocket which we should snap to

getSnappedToSocketPosition(scenepos)

Returns grSocket and Scene position to nearest Socket or original position if no nearby Socket found

getSnappedSocketItem(event: QMouseEvent) QDMGraphicsSocket[source]

Returns QDMGraphicsSocket which we should snap to

getSnappedToSocketPosition(scenepos: ~PyQt5.QtCore.QPointF) -> ('QDMGraphicsSocket', <class 'PyQt5.QtCore.QPointF'>)[source]

Returns grSocket and Scene position to nearest Socket or original position if no nearby Socket found

Parameters

scenepos (QPointF) – From which point should I snap?

Returns

grSocket and Scene postion to nearest socket

node_editor.node_edge_validators module

A module containing the Edge Validator functions which can be registered as callbacks to Edge class.

Example of registering Edge Validator callbacks:

You can register validation callbacks once for example on the bottom of node_edge.py file or on the application start with calling this:

from node_editor.node_edge_validators import *

Edge.registerEdgeValidator(edge_validator_debug)
Edge.registerEdgeValidator(edge_cannot_connect_two_outputs_or_two_inputs)
Edge.registerEdgeValidator(edge_cannot_connect_input_and_output_of_same_node)
Edge.registerEdgeValidator(edge_cannot_connect_input_and_output_of_different_type)
node_editor.node_edge_validators.edge_cannot_connect_input_and_output_of_different_type(input: Socket, output: Socket) bool[source]

Edge is invalid if it connects sockets with different colors

node_editor.node_edge_validators.edge_cannot_connect_input_and_output_of_same_node(input: Socket, output: Socket) bool[source]

Edge is invalid if it connects the same node

node_editor.node_edge_validators.edge_cannot_connect_two_outputs_or_two_inputs(input: Socket, output: Socket) bool[source]

Edge is invalid if it connects 2 output sockets or 2 input sockets

node_editor.node_edge_validators.edge_validator_debug(input: Socket, output: Socket) bool[source]

This will consider edge always valid, however writes bunch of debug stuff into console

node_editor.node_edge_validators.print_error(*args)[source]

Helper method which prints to console if DEBUG is set to True

node_editor.node_editor_widget module

node_editor.node_editor_window module

node_editor.node_graphics_cutline module

A module containing the class for Cutting Line

class node_editor.node_graphics_cutline.QDMCutLine(parent: Optional[QWidget] = None)[source]

Bases: QGraphicsItem

Class representing Cutting Line used for cutting multiple Edges with one stroke

Methods

CacheMode

GraphicsItemChange

GraphicsItemFlag

GraphicsItemFlags(...)

PanelModality

acceptDrops(self)

acceptHoverEvents(self)

acceptTouchEvents(self)

acceptedMouseButtons(self)

advance(self, int)

boundingRect()

Defining Qt' bounding rectangle

boundingRegion(self, QTransform)

boundingRegionGranularity(self)

cacheMode(self)

childItems(self)

childrenBoundingRect(self)

clearFocus(self)

clipPath(self)

collidesWithItem(self, QGraphicsItem[, mode])

collidesWithPath(self, QPainterPath[, mode])

collidingItems(self[, mode])

commonAncestorItem(self, QGraphicsItem)

contains(self, Union[QPointF, QPoint])

contextMenuEvent(self, ...)

cursor(self)

data(self, int)

deviceTransform(self, QTransform)

dragEnterEvent(self, QGraphicsSceneDragDropEvent)

dragLeaveEvent(self, QGraphicsSceneDragDropEvent)

dragMoveEvent(self, QGraphicsSceneDragDropEvent)

dropEvent(self, QGraphicsSceneDragDropEvent)

effectiveOpacity(self)

ensureVisible(, xMargin, yMargin)

filtersChildEvents(self)

flags(self)

focusInEvent(self, QFocusEvent)

focusItem(self)

focusOutEvent(self, QFocusEvent)

focusProxy(self)

grabKeyboard(self)

grabMouse(self)

graphicsEffect(self)

group(self)

hasCursor(self)

hasFocus(self)

hide(self)

hoverEnterEvent(self, QGraphicsSceneHoverEvent)

hoverLeaveEvent(self, QGraphicsSceneHoverEvent)

hoverMoveEvent(self, QGraphicsSceneHoverEvent)

inputMethodEvent(self, QInputMethodEvent)

inputMethodHints(self)

inputMethodQuery(self, Qt.InputMethodQuery)

installSceneEventFilter(self, QGraphicsItem)

isActive(self)

isAncestorOf(self, QGraphicsItem)

isBlockedByModalPanel(self)

isClipped(self)

isEnabled(self)

isObscured() -> bool)

isObscuredBy(self, QGraphicsItem)

isPanel(self)

isSelected(self)

isUnderMouse(self)

isVisible(self)

isVisibleTo(self, QGraphicsItem)

isWidget(self)

isWindow(self)

itemChange(self, ...)

itemTransform(self, QGraphicsItem)

keyPressEvent(self, QKeyEvent)

keyReleaseEvent(self, QKeyEvent)

mapFromItem(...)

mapFromParent(...)

mapFromScene(...)

mapRectFromItem(-> QRectF)

mapRectFromParent(-> QRectF)

mapRectFromScene(-> QRectF)

mapRectToItem(-> QRectF)

mapRectToParent(-> QRectF)

mapRectToScene(-> QRectF)

mapToItem(...)

mapToParent(...)

mapToScene(...)

mouseDoubleClickEvent(self, ...)

mouseMoveEvent(self, QGraphicsSceneMouseEvent)

mousePressEvent(self, QGraphicsSceneMouseEvent)

mouseReleaseEvent(self, QGraphicsSceneMouseEvent)

moveBy(self, float, float)

opacity(self)

opaqueArea(self)

paint(painter, QStyleOptionGraphicsItem[, ...])

Paint the Cutting Line

panel(self)

panelModality(self)

parentItem(self)

parentObject(self)

parentWidget(self)

pos(self)

prepareGeometryChange(self)

removeSceneEventFilter(self, QGraphicsItem)

resetTransform(self)

rotation(self)

scale(self)

scene(self)

sceneBoundingRect(self)

sceneEvent(self, QEvent)

sceneEventFilter(self, QGraphicsItem, QEvent)

scenePos(self)

sceneTransform(self)

scroll(self, float, float, rect)

setAcceptDrops(self, bool)

setAcceptHoverEvents(self, bool)

setAcceptTouchEvents(self, bool)

setAcceptedMouseButtons(self, ...)

setActive(self, bool)

setBoundingRegionGranularity(self, float)

setCacheMode(self, QGraphicsItem.CacheMode, ...)

setCursor(self, Union[QCursor, Qt.CursorShape])

setData(self, int, Any)

setEnabled(self, bool)

setFiltersChildEvents(self, bool)

setFlag(self, ...)

setFlags(self, ...)

setFocus(self[, focusReason])

setFocusProxy(self, QGraphicsItem)

setGraphicsEffect(self, QGraphicsEffect)

setGroup(self, QGraphicsItemGroup)

setInputMethodHints(self, ...)

setOpacity(self, float)

setPanelModality(self, ...)

setParentItem(self, QGraphicsItem)

setPos(setPos)

setRotation(self, float)

setScale(self, float)

setSelected(self, bool)

setToolTip(self, str)

setTransform(self, QTransform[, combine])

setTransformOriginPoint(setTransformOriginPoint)

setTransformations(self, ...)

setVisible(self, bool)

setX(self, float)

setY(self, float)

setZValue(self, float)

shape()

Calculate the QPainterPath object from list of line points

show(self)

stackBefore(self, QGraphicsItem)

toGraphicsObject(self)

toolTip(self)

topLevelItem(self)

topLevelWidget(self)

transform(self)

transformOriginPoint(self)

transformations(self)

type(self)

ungrabKeyboard(self)

ungrabMouse(self)

unsetCursor(self)

update() update)

updateMicroFocus(self)

wheelEvent(self, QGraphicsSceneWheelEvent)

window(self)

x(self)

y(self)

zValue(self)

boundingRect() QRectF[source]

Defining Qt’ bounding rectangle

paint(painter, QStyleOptionGraphicsItem, widget=None)[source]

Paint the Cutting Line

shape() QPainterPath[source]

Calculate the QPainterPath object from list of line points

Returns

shape function returning QPainterPath representation of Cutting Line

Return type

QPainterPath

node_editor.node_graphics_edge module

A module containing the Graphics representation of an Edge

class node_editor.node_graphics_edge.QDMGraphicsEdge(edge: Edge, parent: QWidget = None)[source]

Bases: QGraphicsPathItem

Base class for Graphics Edge

Methods

CacheMode

GraphicsItemChange

GraphicsItemFlag

GraphicsItemFlags(...)

PanelModality

acceptDrops(self)

acceptHoverEvents(self)

acceptTouchEvents(self)

acceptedMouseButtons(self)

advance(self, int)

boundingRect()

Defining Qt' bounding rectangle

boundingRegion(self, QTransform)

boundingRegionGranularity(self)

brush(self)

cacheMode(self)

calcPath()

Will handle drawing QPainterPath from Point A to B.

changeColor(color)

Change color of the edge from string hex value '#00ff00'

childItems(self)

childrenBoundingRect(self)

clearFocus(self)

clipPath(self)

collidesWithItem(self, QGraphicsItem[, mode])

collidesWithPath(self, QPainterPath[, mode])

collidingItems(self[, mode])

commonAncestorItem(self, QGraphicsItem)

contains(self, Union[QPointF, QPoint])

contextMenuEvent(self, ...)

createEdgePathCalculator()

Create instance of GraphicsEdgePathBase

cursor(self)

data(self, int)

determineEdgePathClass()

Decide which GraphicsEdgePath class should be used to calculate path according to edge.edge_type value

deviceTransform(self, QTransform)

doSelect([new_state])

Safe version of selecting the Graphics Node.

dragEnterEvent(self, QGraphicsSceneDragDropEvent)

dragLeaveEvent(self, QGraphicsSceneDragDropEvent)

dragMoveEvent(self, QGraphicsSceneDragDropEvent)

dropEvent(self, QGraphicsSceneDragDropEvent)

effectiveOpacity(self)

ensureVisible(, xMargin, yMargin)

filtersChildEvents(self)

flags(self)

focusInEvent(self, QFocusEvent)

focusItem(self)

focusOutEvent(self, QFocusEvent)

focusProxy(self)

grabKeyboard(self)

grabMouse(self)

graphicsEffect(self)

group(self)

hasCursor(self)

hasFocus(self)

hide(self)

hoverEnterEvent(event)

Handle hover effect

hoverLeaveEvent(event)

Handle hover effect

hoverMoveEvent(self, QGraphicsSceneHoverEvent)

initAssets()

Initialize QObjects like QColor, QPen and QBrush

initUI()

Set up this QGraphicsPathItem

inputMethodEvent(self, QInputMethodEvent)

inputMethodHints(self)

inputMethodQuery(self, Qt.InputMethodQuery)

installSceneEventFilter(self, QGraphicsItem)

intersectsWith(p1, p2)

Does this Graphics Edge intersect with the line between point A and point B ?

isActive(self)

isAncestorOf(self, QGraphicsItem)

isBlockedByModalPanel(self)

isClipped(self)

isEnabled(self)

isObscured() -> bool)

isObscuredBy(self, QGraphicsItem)

isPanel(self)

isSelected(self)

isUnderMouse(self)

isVisible(self)

isVisibleTo(self, QGraphicsItem)

isWidget(self)

isWindow(self)

itemChange(self, ...)

itemTransform(self, QGraphicsItem)

keyPressEvent(self, QKeyEvent)

keyReleaseEvent(self, QKeyEvent)

makeUnselectable()

Used for drag edge to disable click detection over this graphics item

mapFromItem(...)

mapFromParent(...)

mapFromScene(...)

mapRectFromItem(-> QRectF)

mapRectFromParent(-> QRectF)

mapRectFromScene(-> QRectF)

mapRectToItem(-> QRectF)

mapRectToParent(-> QRectF)

mapRectToScene(-> QRectF)

mapToItem(...)

mapToParent(...)

mapToScene(...)

mouseDoubleClickEvent(self, ...)

mouseMoveEvent(self, QGraphicsSceneMouseEvent)

mousePressEvent(self, QGraphicsSceneMouseEvent)

mouseReleaseEvent(event)

Overridden Qt's method to handle selecting and deselecting this Graphics Edge

moveBy(self, float, float)

onSelected()

Our event handling when the edge was selected

opacity(self)

opaqueArea(self)

paint(painter, QStyleOptionGraphicsItem[, ...])

Qt's overridden method to paint this Graphics Edge.

panel(self)

panelModality(self)

parentItem(self)

parentObject(self)

parentWidget(self)

path(self)

pen(self)

pos(self)

prepareGeometryChange(self)

removeSceneEventFilter(self, QGraphicsItem)

resetTransform(self)

rotation(self)

scale(self)

scene(self)

sceneBoundingRect(self)

sceneEvent(self, QEvent)

sceneEventFilter(self, QGraphicsItem, QEvent)

scenePos(self)

sceneTransform(self)

scroll(self, float, float, rect)

setAcceptDrops(self, bool)

setAcceptHoverEvents(self, bool)

setAcceptTouchEvents(self, bool)

setAcceptedMouseButtons(self, ...)

setActive(self, bool)

setBoundingRegionGranularity(self, float)

setBrush(self, Union[QBrush, QColor, ...)

setCacheMode(self, QGraphicsItem.CacheMode, ...)

setColorFromSockets()

Change color according to connected sockets.

setCursor(self, Union[QCursor, Qt.CursorShape])

setData(self, int, Any)

setDestination(x, y)

Set destination point

setEnabled(self, bool)

setFiltersChildEvents(self, bool)

setFlag(self, ...)

setFlags(self, ...)

setFocus(self[, focusReason])

setFocusProxy(self, QGraphicsItem)

setGraphicsEffect(self, QGraphicsEffect)

setGroup(self, QGraphicsItemGroup)

setInputMethodHints(self, ...)

setOpacity(self, float)

setPanelModality(self, ...)

setParentItem(self, QGraphicsItem)

setPath(self, QPainterPath)

setPen(self, Union[QPen, QColor, ...)

setPos(setPos)

setRotation(self, float)

setScale(self, float)

setSelected(self, bool)

setSource(x, y)

Set source point

setToolTip(self, str)

setTransform(self, QTransform[, combine])

setTransformOriginPoint(setTransformOriginPoint)

setTransformations(self, ...)

setVisible(self, bool)

setX(self, float)

setY(self, float)

setZValue(self, float)

shape()

Returns QPainterPath representation of this Edge

show(self)

stackBefore(self, QGraphicsItem)

toGraphicsObject(self)

toolTip(self)

topLevelItem(self)

topLevelWidget(self)

transform(self)

transformOriginPoint(self)

transformations(self)

type(self)

ungrabKeyboard(self)

ungrabMouse(self)

unsetCursor(self)

update() update)

updateMicroFocus(self)

wheelEvent(self, QGraphicsSceneWheelEvent)

window(self)

x(self)

y(self)

zValue(self)

boundingRect() QRectF[source]

Defining Qt’ bounding rectangle

calcPath() QPainterPath[source]

Will handle drawing QPainterPath from Point A to B. Internally there exist self.pathCalculator which is an instance of derived GraphicsEdgePathBase class containing the actual calcPath() function - computing how the edge should look like.

Returns

QPainterPath of the edge connecting source and destination

Return type

QPainterPath

changeColor(color)[source]

Change color of the edge from string hex value ‘#00ff00’

createEdgePathCalculator()[source]

Create instance of GraphicsEdgePathBase

determineEdgePathClass()[source]

Decide which GraphicsEdgePath class should be used to calculate path according to edge.edge_type value

doSelect(new_state: bool = True)[source]

Safe version of selecting the Graphics Node. Takes care about the selection state flag used internally

Parameters

new_state (bool) – True to select, False to deselect

hoverEnterEvent(event: QGraphicsSceneHoverEvent) None[source]

Handle hover effect

hoverLeaveEvent(event: QGraphicsSceneHoverEvent) None[source]

Handle hover effect

initAssets()[source]

Initialize QObjects like QColor, QPen and QBrush

initUI()[source]

Set up this QGraphicsPathItem

intersectsWith(p1: QPointF, p2: QPointF) bool[source]

Does this Graphics Edge intersect with the line between point A and point B ?

Parameters
  • p1 (QPointF) – point A

  • p2 (QPointF) – point B

Returns

True if this Graphics Edge intersects

Return type

bool

makeUnselectable()[source]

Used for drag edge to disable click detection over this graphics item

mouseReleaseEvent(event)[source]

Overridden Qt’s method to handle selecting and deselecting this Graphics Edge

onSelected()[source]

Our event handling when the edge was selected

paint(painter, QStyleOptionGraphicsItem, widget=None)[source]

Qt’s overridden method to paint this Graphics Edge. Path calculated in calcPath() method

setColorFromSockets() bool[source]

Change color according to connected sockets. Returns True if color can be determined

setDestination(x: float, y: float)[source]

Set destination point

Parameters
  • x (float) – x position

  • y (float) – y position

setSource(x: float, y: float)[source]

Set source point

Parameters
  • x (float) – x position

  • y (float) – y position

shape() QPainterPath[source]

Returns QPainterPath representation of this Edge

Returns

path representation

Return type

QPainterPath

node_editor.node_graphics_edge_path module

node_editor.node_graphics_edge_path.EDGE_CP_ROUNDNESS = 100

Bezier control point distance on the line

class node_editor.node_graphics_edge_path.GraphicsEdgePathBase(owner: QDMGraphicsEdge)[source]

Bases: object

Base Class for calculating the graphics path to draw for an graphics Edge

Methods

calcPath()

Calculate the Direct line connection

calcPath()[source]

Calculate the Direct line connection

Returns

QPainterPath of the graphics path to draw

Return type

QPainterPath or None

class node_editor.node_graphics_edge_path.GraphicsEdgePathBezier(owner: QDMGraphicsEdge)[source]

Bases: GraphicsEdgePathBase

Cubic line connection Graphics Edge

Methods

calcPath()

Calculate the cubic Bezier line connection with 2 control points

calcPath() QPainterPath[source]

Calculate the cubic Bezier line connection with 2 control points

Returns

QPainterPath of the cubic Bezier line

Return type

QPainterPath

class node_editor.node_graphics_edge_path.GraphicsEdgePathDirect(owner: QDMGraphicsEdge)[source]

Bases: GraphicsEdgePathBase

Direct line connection Graphics Edge

Methods

calcPath()

Calculate the Direct line connection

calcPath() QPainterPath[source]

Calculate the Direct line connection

Returns

QPainterPath of the direct line

Return type

QPainterPath

class node_editor.node_graphics_edge_path.GraphicsEdgePathSquare(*args, handle_weight=0.5, **kwargs)[source]

Bases: GraphicsEdgePathBase

Square line connection Graphics Edge

Methods

calcPath()

Calculate the square edge line connection

calcPath()[source]

Calculate the square edge line connection

Returns

QPainterPath of the edge square line

Return type

QPainterPath

node_editor.node_graphics_edge_path.WEIGHT_SOURCE = 0.2

factor for square edge to change the midpoint between start and end socket

node_editor.node_graphics_node module

A module containing Graphics representation of Node

class node_editor.node_graphics_node.QDMGraphicsNode(node: Node, parent: QWidget = None)[source]

Bases: QGraphicsItem

Class describing Graphics representation of Node

Attributes
content

Reference to Node Content

title

title of this Node

Methods

CacheMode

GraphicsItemChange

GraphicsItemFlag

GraphicsItemFlags(...)

PanelModality

acceptDrops(self)

acceptHoverEvents(self)

acceptTouchEvents(self)

acceptedMouseButtons(self)

advance(self, int)

boundingRect()

Defining Qt' bounding rectangle

boundingRegion(self, QTransform)

boundingRegionGranularity(self)

cacheMode(self)

childItems(self)

childrenBoundingRect(self)

clearFocus(self)

clipPath(self)

collidesWithItem(self, QGraphicsItem[, mode])

collidesWithPath(self, QPainterPath[, mode])

collidingItems(self[, mode])

commonAncestorItem(self, QGraphicsItem)

contains(self, Union[QPointF, QPoint])

contextMenuEvent(self, ...)

cursor(self)

data(self, int)

deviceTransform(self, QTransform)

doSelect([new_state])

Safe version of selecting the Graphics Node.

dragEnterEvent(self, QGraphicsSceneDragDropEvent)

dragLeaveEvent(self, QGraphicsSceneDragDropEvent)

dragMoveEvent(self, QGraphicsSceneDragDropEvent)

dropEvent(self, QGraphicsSceneDragDropEvent)

effectiveOpacity(self)

ensureVisible(, xMargin, yMargin)

filtersChildEvents(self)

flags(self)

focusInEvent(self, QFocusEvent)

focusItem(self)

focusOutEvent(self, QFocusEvent)

focusProxy(self)

grabKeyboard(self)

grabMouse(self)

graphicsEffect(self)

group(self)

hasCursor(self)

hasFocus(self)

hide(self)

hoverEnterEvent(event)

Handle hover effect

hoverLeaveEvent(event)

Handle hover effect

hoverMoveEvent(self, QGraphicsSceneHoverEvent)

initAssets()

Initialize QObjects like QColor, QPen and QBrush

initContent()

Set up the grContent - QGraphicsProxyWidget to have a container for Graphics Content

initSizes()

Set up internal attributes like width, height, etc.

initTitle()

Set up the title Graphics representation: font, color, position, etc.

initUI()

Set up this QGraphicsItem

inputMethodEvent(self, QInputMethodEvent)

inputMethodHints(self)

inputMethodQuery(self, Qt.InputMethodQuery)

installSceneEventFilter(self, QGraphicsItem)

isActive(self)

isAncestorOf(self, QGraphicsItem)

isBlockedByModalPanel(self)

isClipped(self)

isEnabled(self)

isObscured() -> bool)

isObscuredBy(self, QGraphicsItem)

isPanel(self)

isSelected(self)

isUnderMouse(self)

isVisible(self)

isVisibleTo(self, QGraphicsItem)

isWidget(self)

isWindow(self)

itemChange(self, ...)

itemTransform(self, QGraphicsItem)

keyPressEvent(self, QKeyEvent)

keyReleaseEvent(self, QKeyEvent)

mapFromItem(...)

mapFromParent(...)

mapFromScene(...)

mapRectFromItem(-> QRectF)

mapRectFromParent(-> QRectF)

mapRectFromScene(-> QRectF)

mapRectToItem(-> QRectF)

mapRectToParent(-> QRectF)

mapRectToScene(-> QRectF)

mapToItem(...)

mapToParent(...)

mapToScene(...)

mouseDoubleClickEvent(event)

Overriden event for doubleclick.

mouseMoveEvent(event)

Overridden event to detect that we moved with this Node

mousePressEvent(self, QGraphicsSceneMouseEvent)

mouseReleaseEvent(event)

Overriden event to handle when we moved, selected or deselected this Node

moveBy(self, float, float)

onSelected()

Our event handling when the node was selected

opacity(self)

opaqueArea(self)

paint(painter, QStyleOptionGraphicsItem[, ...])

Painting the rounded rectanglar Node

panel(self)

panelModality(self)

parentItem(self)

parentObject(self)

parentWidget(self)

pos(self)

prepareGeometryChange(self)

removeSceneEventFilter(self, QGraphicsItem)

resetTransform(self)

rotation(self)

scale(self)

scene(self)

sceneBoundingRect(self)

sceneEvent(self, QEvent)

sceneEventFilter(self, QGraphicsItem, QEvent)

scenePos(self)

sceneTransform(self)

scroll(self, float, float, rect)

setAcceptDrops(self, bool)

setAcceptHoverEvents(self, bool)

setAcceptTouchEvents(self, bool)

setAcceptedMouseButtons(self, ...)

setActive(self, bool)

setBoundingRegionGranularity(self, float)

setCacheMode(self, QGraphicsItem.CacheMode, ...)

setCursor(self, Union[QCursor, Qt.CursorShape])

setData(self, int, Any)

setEnabled(self, bool)

setFiltersChildEvents(self, bool)

setFlag(self, ...)

setFlags(self, ...)

setFocus(self[, focusReason])

setFocusProxy(self, QGraphicsItem)

setGraphicsEffect(self, QGraphicsEffect)

setGroup(self, QGraphicsItemGroup)

setInputMethodHints(self, ...)

setOpacity(self, float)

setPanelModality(self, ...)

setParentItem(self, QGraphicsItem)

setPos(setPos)

setRotation(self, float)

setScale(self, float)

setSelected(self, bool)

setToolTip(self, str)

setTransform(self, QTransform[, combine])

setTransformOriginPoint(setTransformOriginPoint)

setTransformations(self, ...)

setVisible(self, bool)

setX(self, float)

setY(self, float)

setZValue(self, float)

shape(self)

show(self)

stackBefore(self, QGraphicsItem)

toGraphicsObject(self)

toolTip(self)

topLevelItem(self)

topLevelWidget(self)

transform(self)

transformOriginPoint(self)

transformations(self)

type(self)

ungrabKeyboard(self)

ungrabMouse(self)

unsetCursor(self)

update() update)

updateMicroFocus(self)

wheelEvent(self, QGraphicsSceneWheelEvent)

window(self)

x(self)

y(self)

zValue(self)

boundingRect() QRectF[source]

Defining Qt’ bounding rectangle

property content

Reference to Node Content

doSelect(new_state=True)[source]

Safe version of selecting the Graphics Node. Takes care about the selection state flag used internally

Parameters

new_state (bool) – True to select, False to deselect

hoverEnterEvent(event: QGraphicsSceneHoverEvent) None[source]

Handle hover effect

hoverLeaveEvent(event: QGraphicsSceneHoverEvent) None[source]

Handle hover effect

initAssets()[source]

Initialize QObjects like QColor, QPen and QBrush

initContent()[source]

Set up the grContent - QGraphicsProxyWidget to have a container for Graphics Content

initSizes()[source]

Set up internal attributes like width, height, etc.

initTitle()[source]

Set up the title Graphics representation: font, color, position, etc.

initUI()[source]

Set up this QGraphicsItem

mouseDoubleClickEvent(event)[source]

Overriden event for doubleclick. Resend to Node::onDoubleClicked

mouseMoveEvent(event)[source]

Overridden event to detect that we moved with this Node

mouseReleaseEvent(event)[source]

Overriden event to handle when we moved, selected or deselected this Node

onSelected()[source]

Our event handling when the node was selected

paint(painter, QStyleOptionGraphicsItem, widget=None)[source]

Painting the rounded rectanglar Node

property title

title of this Node

Getter

current Graphics Node title

Setter

stores and make visible the new title

Type

str

node_editor.node_graphics_scene module

A module containing Graphic representation of Scene

class node_editor.node_graphics_scene.QDMGraphicsScene(scene: Scene, parent: QWidget = None)[source]

Bases: QGraphicsScene

Class representing Graphic of Scene

Methods

ItemIndexMethod

SceneLayer

SceneLayers(...)

activePanel(self)

activeWindow(self)

addEllipse(, brush, QColor, Qt.GlobalColor, ...)

addItem(self, QGraphicsItem)

addLine() -> QGraphicsLineItem ))

addPath(self, QPainterPath[, pen, brush])

addPixmap(self, QPixmap)

addPolygon(self, QPolygonF[, pen, brush])

addRect(, brush, QColor, Qt.GlobalColor, ...)

addSimpleText(self, str[, font])

addText(self, str[, font])

addWidget(self, QWidget[, flags])

advance(self)

backgroundBrush(self)

blockSignals(self, bool)

bspTreeDepth(self)

changed

changed(self, Iterable[QRectF]) [signal]

childEvent(self, QChildEvent)

children(self)

clear(self)

clearFocus(self)

clearSelection(self)

collidingItems(self, QGraphicsItem[, mode])

connectNotify(self, QMetaMethod)

contextMenuEvent(self, ...)

createItemGroup(self, Iterable[QGraphicsItem])

customEvent(self, QEvent)

deleteLater(self)

destroyItemGroup(self, QGraphicsItemGroup)

destroyed

QObject = None) [signal]

disconnect(-> bool disconnect)

disconnectNotify(self, QMetaMethod)

dragEnterEvent(self, QGraphicsSceneDragDropEvent)

dragLeaveEvent(self, QGraphicsSceneDragDropEvent)

dragMoveEvent(event)

Overriden Qt's dragMoveEvent to enable Qt's Drag Events

drawBackground(painter, rect)

Draw background scene grid

drawForeground(self, QPainter, QRectF)

dropEvent(self, QGraphicsSceneDragDropEvent)

dumpObjectInfo(self)

dumpObjectTree(self)

dynamicPropertyNames(self)

event(self, QEvent)

eventFilter(self, QObject, QEvent)

findChild(-> QObject)

findChildren(...)

focusInEvent(self, QFocusEvent)

focusItem(self)

focusItemChanged

focusItemChanged(self, QGraphicsItem, QGraphicsItem, Qt.FocusReason) [signal]

focusNextPrevChild(self, bool)

focusOnTouch(self)

focusOutEvent(self, QFocusEvent)

font(self)

foregroundBrush(self)

hasFocus(self)

height(self)

helpEvent(self, QGraphicsSceneHelpEvent)

inherits(self, str)

initAssets()

Initialize QObjects like QColor, QPen and QBrush

inputMethodEvent(self, QInputMethodEvent)

inputMethodQuery(self, Qt.InputMethodQuery)

installEventFilter(self, QObject)

invalidate(, layers, ...)

isActive(self)

isSignalConnected(self, QMetaMethod)

isWidgetType(self)

isWindowType(self)

itemAt(-> QGraphicsItem)

itemIndexMethod(self)

items(...)

itemsBoundingRect(self)

keyPressEvent(self, QKeyEvent)

keyReleaseEvent(self, QKeyEvent)

killTimer(self, int)

metaObject(self)

minimumRenderSize(self)

mouseDoubleClickEvent(self, ...)

mouseGrabberItem(self)

mouseMoveEvent(self, QGraphicsSceneMouseEvent)

mousePressEvent(self, QGraphicsSceneMouseEvent)

mouseReleaseEvent(self, QGraphicsSceneMouseEvent)

moveToThread(self, QThread)

objectName(self)

objectNameChanged

objectNameChanged(self, str) [signal]

palette(self)

parent(self)

property(self, str)

pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal.

receivers(self, PYQT_SIGNAL)

removeEventFilter(self, QObject)

removeItem(self, QGraphicsItem)

render(self, QPainter[, target, source, mode])

sceneRect(self)

sceneRectChanged

sceneRectChanged(self, QRectF) [signal]

selectedItems(self)

selectionArea(self)

selectionChanged

selectionChanged(self) [signal]

sendEvent(self, QGraphicsItem, QEvent)

sender(self)

senderSignalIndex(self)

setActivePanel(self, QGraphicsItem)

setActiveWindow(self, QGraphicsWidget)

setBackgroundBrush(self, Union[QBrush, ...)

setBspTreeDepth(self, int)

setFocus(self[, focusReason])

setFocusItem(self, QGraphicsItem[, focusReason])

setFocusOnTouch(self, bool)

setFont(self, QFont)

setForegroundBrush(self, Union[QBrush, ...)

setGrScene(width, height)

Set width and height of the Graphics Scene

setItemIndexMethod(self, ...)

setMinimumRenderSize(self, float)

setObjectName(self, str)

setPalette(self, QPalette)

setParent(self, QObject)

setProperty(self, str, Any)

setSceneRect(setSceneRect)

setSelectionArea(...)

setStickyFocus(self, bool)

setStyle(self, QStyle)

signalsBlocked(self)

startTimer(self, int[, timerType])

stickyFocus(self)

style(self)

thread(self)

timerEvent(self, QTimerEvent)

tr(self, str[, disambiguation, n])

update() update)

views(self)

wheelEvent(self, QGraphicsSceneWheelEvent)

width(self)

itemSelected

itemsDeselected

dragMoveEvent(event)[source]

Overriden Qt’s dragMoveEvent to enable Qt’s Drag Events

drawBackground(painter: QPainter, rect: QRect)[source]

Draw background scene grid

initAssets()[source]

Initialize QObjects like QColor, QPen and QBrush

itemSelected

pyqtSignal emitted when some item is selected in the Scene

itemsDeselected

pyqtSignal emitted when items are deselected in the Scene

setGrScene(width: int, height: int)[source]

Set width and height of the Graphics Scene

node_editor.node_graphics_socket module

A module containing Graphics representation of a Socket

class node_editor.node_graphics_socket.QDMGraphicsSocket(socket: Socket)[source]

Bases: QGraphicsItem

Class representing Graphic Socket in QGraphicsScene

Attributes
socket_type

Methods

CacheMode

GraphicsItemChange

GraphicsItemFlag

GraphicsItemFlags(...)

PanelModality

acceptDrops(self)

acceptHoverEvents(self)

acceptTouchEvents(self)

acceptedMouseButtons(self)

advance(self, int)

boundingRect()

Defining Qt' bounding rectangle

boundingRegion(self, QTransform)

boundingRegionGranularity(self)

cacheMode(self)

changeSocketType()

Change the Socket Type

childItems(self)

childrenBoundingRect(self)

clearFocus(self)

clipPath(self)

collidesWithItem(self, QGraphicsItem[, mode])

collidesWithPath(self, QPainterPath[, mode])

collidingItems(self[, mode])

commonAncestorItem(self, QGraphicsItem)

contains(self, Union[QPointF, QPoint])

contextMenuEvent(self, ...)

cursor(self)

data(self, int)

deviceTransform(self, QTransform)

dragEnterEvent(self, QGraphicsSceneDragDropEvent)

dragLeaveEvent(self, QGraphicsSceneDragDropEvent)

dragMoveEvent(self, QGraphicsSceneDragDropEvent)

dropEvent(self, QGraphicsSceneDragDropEvent)

effectiveOpacity(self)

ensureVisible(, xMargin, yMargin)

filtersChildEvents(self)

flags(self)

focusInEvent(self, QFocusEvent)

focusItem(self)

focusOutEvent(self, QFocusEvent)

focusProxy(self)

getSocketColor(key)

Returns the QColor for this key

grabKeyboard(self)

grabMouse(self)

graphicsEffect(self)

group(self)

hasCursor(self)

hasFocus(self)

hide(self)

hoverEnterEvent(self, QGraphicsSceneHoverEvent)

hoverLeaveEvent(self, QGraphicsSceneHoverEvent)

hoverMoveEvent(self, QGraphicsSceneHoverEvent)

initAssets()

Initialize QObjects like QColor, QPen and QBrush

inputMethodEvent(self, QInputMethodEvent)

inputMethodHints(self)

inputMethodQuery(self, Qt.InputMethodQuery)

installSceneEventFilter(self, QGraphicsItem)

isActive(self)

isAncestorOf(self, QGraphicsItem)

isBlockedByModalPanel(self)

isClipped(self)

isEnabled(self)

isObscured() -> bool)

isObscuredBy(self, QGraphicsItem)

isPanel(self)

isSelected(self)

isUnderMouse(self)

isVisible(self)

isVisibleTo(self, QGraphicsItem)

isWidget(self)

isWindow(self)

itemChange(self, ...)

itemTransform(self, QGraphicsItem)

keyPressEvent(self, QKeyEvent)

keyReleaseEvent(self, QKeyEvent)

mapFromItem(...)

mapFromParent(...)

mapFromScene(...)

mapRectFromItem(-> QRectF)

mapRectFromParent(-> QRectF)

mapRectFromScene(-> QRectF)

mapRectToItem(-> QRectF)

mapRectToParent(-> QRectF)

mapRectToScene(-> QRectF)

mapToItem(...)

mapToParent(...)

mapToScene(...)

mouseDoubleClickEvent(self, ...)

mouseMoveEvent(self, QGraphicsSceneMouseEvent)

mousePressEvent(self, QGraphicsSceneMouseEvent)

mouseReleaseEvent(self, QGraphicsSceneMouseEvent)

moveBy(self, float, float)

opacity(self)

opaqueArea(self)

paint(painter, QStyleOptionGraphicsItem[, ...])

Painting a circle

panel(self)

panelModality(self)

parentItem(self)

parentObject(self)

parentWidget(self)

pos(self)

prepareGeometryChange(self)

removeSceneEventFilter(self, QGraphicsItem)

resetTransform(self)

rotation(self)

scale(self)

scene(self)

sceneBoundingRect(self)

sceneEvent(self, QEvent)

sceneEventFilter(self, QGraphicsItem, QEvent)

scenePos(self)

sceneTransform(self)

scroll(self, float, float, rect)

setAcceptDrops(self, bool)

setAcceptHoverEvents(self, bool)

setAcceptTouchEvents(self, bool)

setAcceptedMouseButtons(self, ...)

setActive(self, bool)

setBoundingRegionGranularity(self, float)

setCacheMode(self, QGraphicsItem.CacheMode, ...)

setCursor(self, Union[QCursor, Qt.CursorShape])

setData(self, int, Any)

setEnabled(self, bool)

setFiltersChildEvents(self, bool)

setFlag(self, ...)

setFlags(self, ...)

setFocus(self[, focusReason])

setFocusProxy(self, QGraphicsItem)

setGraphicsEffect(self, QGraphicsEffect)

setGroup(self, QGraphicsItemGroup)

setInputMethodHints(self, ...)

setOpacity(self, float)

setPanelModality(self, ...)

setParentItem(self, QGraphicsItem)

setPos(setPos)

setRotation(self, float)

setScale(self, float)

setSelected(self, bool)

setToolTip(self, str)

setTransform(self, QTransform[, combine])

setTransformOriginPoint(setTransformOriginPoint)

setTransformations(self, ...)

setVisible(self, bool)

setX(self, float)

setY(self, float)

setZValue(self, float)

shape(self)

show(self)

stackBefore(self, QGraphicsItem)

toGraphicsObject(self)

toolTip(self)

topLevelItem(self)

topLevelWidget(self)

transform(self)

transformOriginPoint(self)

transformations(self)

type(self)

ungrabKeyboard(self)

ungrabMouse(self)

unsetCursor(self)

update() update)

updateMicroFocus(self)

wheelEvent(self, QGraphicsSceneWheelEvent)

window(self)

x(self)

y(self)

zValue(self)

boundingRect() QRectF[source]

Defining Qt’ bounding rectangle

changeSocketType()[source]

Change the Socket Type

getSocketColor(key)[source]

Returns the QColor for this key

initAssets()[source]

Initialize QObjects like QColor, QPen and QBrush

paint(painter, QStyleOptionGraphicsItem, widget=None)[source]

Painting a circle

property socket_type

node_editor.node_graphics_view module

A module containing Graphics View for NodeEditor

node_editor.node_graphics_view.EDGE_DRAG_START_THRESHOLD = 50

Distance when click on socket to enable Drag Edge

node_editor.node_graphics_view.EDGE_REROUTING_UE = True

Enable UnrealEngine style rerouting

node_editor.node_graphics_view.EDGE_SNAPPING = True

Enable socket snapping feature

node_editor.node_graphics_view.EDGE_SNAPPING_RADIUS = 24

Socket snapping distance

node_editor.node_graphics_view.MODE_EDGES_REROUTING = 4

Mode representing when we re-route existing edges

node_editor.node_graphics_view.MODE_EDGE_CUT = 3

Mode representing when we draw a cutting edge

node_editor.node_graphics_view.MODE_EDGE_DRAG = 2

Mode representing when we drag edge state

node_editor.node_graphics_view.MODE_NODE_DRAG = 5

Mode representing when we drag a node to calculate dropping on intersecting edge

node_editor.node_graphics_view.MODE_NOOP = 1

Mode representing ready state

class node_editor.node_graphics_view.QDMGraphicsView(grScene: QDMGraphicsScene, parent: QWidget = None)[source]

Bases: QGraphicsView

Class representing NodeEditor’s Graphics View

Methods

CacheMode(...)

CacheModeFlag

DragMode

OptimizationFlag

OptimizationFlags(...)

PaintDeviceMetric

RenderFlag

RenderFlags(...)

Shadow

Shape

SizeAdjustPolicy

StyleMask

ViewportAnchor

ViewportUpdateMode

acceptDrops(self)

accessibleDescription(self)

accessibleName(self)

actionEvent(self, QActionEvent)

actions(self)

activateWindow(self)

addAction(self, QAction)

addActions(self, Iterable[QAction])

addDragEnterListener(callback)

Register callback for Drag Enter event

addDropListener(callback)

Register callback for Drop event

addScrollBarWidget(self, QWidget, ...)

adjustSize(self)

alignment(self)

autoFillBackground(self)

backgroundBrush(self)

backgroundRole(self)

baseSize(self)

blockSignals(self, bool)

cacheMode(self)

centerOn(centerOn centerOn  -> None)

changeEvent(self, QEvent)

childAt(-> QWidget)

childEvent(self, QChildEvent)

children(self)

childrenRect(self)

childrenRegion(self)

clearFocus(self)

clearMask(self)

close(self)

closeEvent(self, QCloseEvent)

colorCount(self)

connectNotify(self, QMetaMethod)

contentsMargins(self)

contentsRect(self)

contextMenuEvent(self, QContextMenuEvent)

contextMenuPolicy(self)

cornerWidget(self)

create(self[, window, initializeWindow, ...])

createWindowContainer(QWindow[, parent, flags])

cursor(self)

customContextMenuRequested

customContextMenuRequested(self, QPoint) [signal]

customEvent(self, QEvent)

cutIntersectingEdges()

Compare which Edges intersect with current Cut line and delete them safely

debug_modifiers(event)

Helper function get string if we hold Ctrl, Shift or Alt modifier keys

deleteLater(self)

deleteSelected()

Shortcut for safe deleting every object selected in the Scene.

depth(self)

destroy(self[, destroyWindow, destroySubWindows])

destroyed

QObject = None) [signal]

devType(self)

devicePixelRatio(self)

devicePixelRatioF(self)

devicePixelRatioFScale()

disconnect(-> bool disconnect)

disconnectNotify(self, QMetaMethod)

distanceBetweenClickAndReleaseIsOff(event)

Measures if we are too far from the last Mouse button click scene position.

dragEnterEvent(event)

Trigger our registered Drag Enter events

dragLeaveEvent(self, QDragLeaveEvent)

dragMode(self)

dragMoveEvent(self, QDragMoveEvent)

drawBackground(self, QPainter, QRectF)

drawForeground(self, QPainter, QRectF)

drawFrame(self, QPainter)

dropEvent(event)

Trigger our registered Drop events

dumpObjectInfo(self)

dumpObjectTree(self)

dynamicPropertyNames(self)

effectiveWinId(self)

ensurePolished(self)

ensureVisible(...)

enterEvent(self, QEvent)

event(self, QEvent)

eventFilter(self, QObject, QEvent)

find(PyQt5.sip.voidptr)

findChild(-> QObject)

findChildren(...)

fitInView(fitInView fitInView  -> None)

focusInEvent(self, QFocusEvent)

focusNextChild(self)

focusNextPrevChild(self, bool)

focusOutEvent(self, QFocusEvent)

focusPolicy(self)

focusPreviousChild(self)

focusProxy(self)

focusWidget(self)

font(self)

fontInfo(self)

fontMetrics(self)

foregroundBrush(self)

foregroundRole(self)

frameGeometry(self)

frameRect(self)

frameShadow(self)

frameShape(self)

frameSize(self)

frameStyle(self)

frameWidth(self)

geometry(self)

getContentsMargins(self)

getItemAtClick(event)

Return the object on which we've clicked/release mouse button

grab(self[, rectangle])

grabGesture(self, Qt.GestureType, flags, ...)

grabKeyboard(self)

grabMouse(grabMouse)

grabShortcut(self, Union[QKeySequence, ...)

graphicsEffect(self)

graphicsProxyWidget(self)

hasFocus(self)

hasHeightForWidth(self)

hasMouseTracking(self)

hasTabletTracking(self)

height(self)

heightForWidth(self, int)

heightMM(self)

hide(self)

hideEvent(self, QHideEvent)

horizontalScrollBar(self)

horizontalScrollBarPolicy(self)

inherits(self, str)

initPainter(self, QPainter)

initStyleOption(self, QStyleOptionFrame)

initUI()

Set up this QGraphicsView

inputMethodEvent(self, QInputMethodEvent)

inputMethodHints(self)

inputMethodQuery(self, Qt.InputMethodQuery)

insertAction(self, QAction, QAction)

insertActions(self, QAction, Iterable[QAction])

installEventFilter(self, QObject)

invalidateScene(self[, rect, layers])

isActiveWindow(self)

isAncestorOf(self, QWidget)

isEnabled(self)

isEnabledTo(self, QWidget)

isFullScreen(self)

isHidden(self)

isInteractive(self)

isLeftToRight(self)

isMaximized(self)

isMinimized(self)

isModal(self)

isRightToLeft(self)

isSignalConnected(self, QMetaMethod)

isSnappingEnabled([event])

Returns True if snapping is currently enabled

isTransformed(self)

isVisible(self)

isVisibleTo(self, QWidget)

isWidgetType(self)

isWindow(self)

isWindowModified(self)

isWindowType(self)

itemAt(-> QGraphicsItem)

items(...)

keyPressEvent(event)

keyReleaseEvent(self, QKeyEvent)

keyboardGrabber()

killTimer(self, int)

layout(self)

layoutDirection(self)

leaveEvent(self, QEvent)

leftMouseButtonPress(event)

When Left mouse button was pressed

leftMouseButtonRelease(event)

When Left mouse button was released

lineWidth(self)

locale(self)

logicalDpiX(self)

logicalDpiY(self)

lower(self)

mapFrom(self, QWidget, QPoint)

mapFromGlobal(self, QPoint)

mapFromParent(self, QPoint)

mapFromScene(...)

mapTo(self, QWidget, QPoint)

mapToGlobal(self, QPoint)

mapToParent(self, QPoint)

mapToScene(...)

mask(self)

maximumHeight(self)

maximumSize(self)

maximumViewportSize(self)

maximumWidth(self)

metaObject(self)

metric(self, QPaintDevice.PaintDeviceMetric)

midLineWidth(self)

middleMouseButtonPress(event)

When Middle mouse button was pressed

middleMouseButtonRelease(event)

When Middle mouse button was released

minimumHeight(self)

minimumSize(self)

minimumSizeHint(self)

minimumWidth(self)

mouseDoubleClickEvent(self, QMouseEvent)

mouseGrabber()

mouseMoveEvent(event)

Overriden Qt's mouseMoveEvent handling Scene/View logic

mousePressEvent(event)

Dispatch Qt's mousePress event to corresponding function below

mouseReleaseEvent(event)

Dispatch Qt's mouseRelease event to corresponding function below

move(move)

moveEvent(self, QMoveEvent)

moveToThread(self, QThread)

nativeEvent(self, Union[QByteArray, bytes, ...)

nativeParentWidget(self)

nextInFocusChain(self)

normalGeometry(self)

objectName(self)

objectNameChanged

objectNameChanged(self, str) [signal]

optimizationFlags(self)

overrideWindowFlags(self, ...)

overrideWindowState(self, ...)

paintEngine(self)

paintEvent(self, QPaintEvent)

paintingActive(self)

palette(self)

parent(self)

parentWidget(self)

physicalDpiX(self)

physicalDpiY(self)

pos(self)

previousInFocusChain(self)

property(self, str)

pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal.

raise_(self)

receivers(self, PYQT_SIGNAL)

rect(self)

releaseKeyboard(self)

releaseMouse(self)

releaseShortcut(self, int)

removeAction(self, QAction)

removeEventFilter(self, QObject)

render(self, QPainter[, target, source, mode])

renderHints(self)

repaint(...)

resetCachedContent(self)

resetMode()

Helper function to re-set the grView's State Machine state to the default

resetTransform(self)

resize(resize)

resizeAnchor(self)

resizeEvent(self, QResizeEvent)

restoreGeometry(self, Union[QByteArray, ...)

rightMouseButtonPress(event)

When Right mouse button was pressed

rightMouseButtonRelease(event)

When Right mouse button was release

rotate(self, float)

rubberBandChanged

rubberBandChanged(self, QRect, Union[QPointF, QPoint], Union[QPointF, QPoint]) [signal]

rubberBandRect(self)

rubberBandSelectionMode(self)

saveGeometry(self)

scale(self, float, float)

scene(self)

sceneRect(self)

screen(self)

scroll(scroll)

scrollBarWidgets(self, Union[Qt.Alignment, ...)

scrollContentsBy(self, int, int)

sender(self)

senderSignalIndex(self)

setAcceptDrops(self, bool)

setAccessibleDescription(self, str)

setAccessibleName(self, str)

setAlignment(self, Union[Qt.Alignment, ...)

setAttribute(self, Qt.WidgetAttribute, on)

setAutoFillBackground(self, bool)

setBackgroundBrush(self, Union[QBrush, ...)

setBackgroundRole(self, QPalette.ColorRole)

setBaseSize(setBaseSize)

setCacheMode(self, ...)

setContentsMargins(setContentsMargins)

setContextMenuPolicy(self, Qt.ContextMenuPolicy)

setCornerWidget(self, QWidget)

setCursor(self, Union[QCursor, Qt.CursorShape])

setDisabled(self, bool)

setDragMode(self, QGraphicsView.DragMode)

setEnabled(self, bool)

setFixedHeight(self, int)

setFixedSize(setFixedSize)

setFixedWidth(self, int)

setFocus(setFocus)

setFocusPolicy(self, Qt.FocusPolicy)

setFocusProxy(self, QWidget)

setFont(self, QFont)

setForegroundBrush(self, Union[QBrush, ...)

setForegroundRole(self, QPalette.ColorRole)

setFrameRect(self, QRect)

setFrameShadow(self, QFrame.Shadow)

setFrameShape(self, QFrame.Shape)

setFrameStyle(self, int)

setGeometry(setGeometry)

setGraphicsEffect(self, QGraphicsEffect)

setHidden(self, bool)

setHorizontalScrollBar(self, QScrollBar)

setHorizontalScrollBarPolicy(self, ...)

setInputMethodHints(self, ...)

setInteractive(self, bool)

setLayout(self, QLayout)

setLayoutDirection(self, Qt.LayoutDirection)

setLineWidth(self, int)

setLocale(self, QLocale)

setMask(setMask)

setMaximumHeight(self, int)

setMaximumSize(setMaximumSize)

setMaximumWidth(self, int)

setMidLineWidth(self, int)

setMinimumHeight(self, int)

setMinimumSize(setMinimumSize)

setMinimumWidth(self, int)

setMouseTracking(self, bool)

setObjectName(self, str)

setOptimizationFlag(self, ...)

setOptimizationFlags(self, ...)

setPalette(self, QPalette)

setParent(setParent)

setProperty(self, str, Any)

setRenderHint(self, QPainter.RenderHint, on)

setRenderHints(self, ...)

setResizeAnchor(self, ...)

setRubberBandSelectionMode(self, ...)

setScene(self, QGraphicsScene)

setSceneRect(setSceneRect)

setShortcutAutoRepeat(self, int[, enabled])

setShortcutEnabled(self, int[, enabled])

setSizeAdjustPolicy(self, ...)

setSizeIncrement(setSizeIncrement)

setSizePolicy(setSizePolicy)

setSocketHighlights(scenepos[, highlighted, ...])

Set/disable socket highlights in Scene area defined by scenepos and radius

setStatusTip(self, str)

setStyle(self, QStyle)

setStyleSheet(self, str)

setTabOrder(QWidget, QWidget)

setTabletTracking(self, bool)

setToolTip(self, str)

setToolTipDuration(self, int)

setTransform(self, QTransform[, combine])

setTransformationAnchor(self, ...)

setUpdatesEnabled(self, bool)

setVerticalScrollBar(self, QScrollBar)

setVerticalScrollBarPolicy(self, ...)

setViewport(self, QWidget)

setViewportMargins(setViewportMargins)

setViewportUpdateMode(self, ...)

setVisible(self, bool)

setWhatsThis(self, str)

setWindowFilePath(self, str)

setWindowFlag(self, Qt.WindowType, on)

setWindowFlags(self, Union[Qt.WindowFlags, ...)

setWindowIcon(self, QIcon)

setWindowIconText(self, str)

setWindowModality(self, Qt.WindowModality)

setWindowModified(self, bool)

setWindowOpacity(self, float)

setWindowRole(self, str)

setWindowState(self, Union[Qt.WindowStates, ...)

setWindowTitle(self, str)

setupViewport(self, QWidget)

sharedPainter(self)

shear(self, float, float)

show(self)

showEvent(self, QShowEvent)

showFullScreen(self)

showMaximized(self)

showMinimized(self)

showNormal(self)

signalsBlocked(self)

size(self)

sizeAdjustPolicy(self)

sizeHint(self)

sizeIncrement(self)

sizePolicy(self)

stackUnder(self, QWidget)

startTimer(self, int[, timerType])

statusTip(self)

style(self)

styleSheet(self)

tabletEvent(self, QTabletEvent)

testAttribute(self, Qt.WidgetAttribute)

thread(self)

timerEvent(self, QTimerEvent)

toolTip(self)

toolTipDuration(self)

tr(self, str[, disambiguation, n])

transform(self)

transformationAnchor(self)

translate(self, float, float)

underMouse(self)

ungrabGesture(self, Qt.GestureType)

unsetCursor(self)

unsetLayoutDirection(self)

unsetLocale(self)

update(update update update  -> None  -> None)

updateGeometry(self)

updateMicroFocus(self)

updateScene(self, Iterable[QRectF])

updateSceneRect(self, QRectF)

updatesEnabled(self)

verticalScrollBar(self)

verticalScrollBarPolicy(self)

viewport(self)

viewportEvent(self, QEvent)

viewportMargins(self)

viewportSizeHint(self)

viewportTransform(self)

viewportUpdateMode(self)

visibleRegion(self)

whatsThis(self)

wheelEvent(event)

overridden Qt's wheelEvent.

width(self)

widthMM(self)

winId(self)

window(self)

windowFilePath(self)

windowFlags(self)

windowHandle(self)

windowIcon(self)

windowIconChanged

windowIconChanged(self, QIcon) [signal]

windowIconText(self)

windowIconTextChanged

windowIconTextChanged(self, str) [signal]

windowModality(self)

windowOpacity(self)

windowRole(self)

windowState(self)

windowTitle(self)

windowTitleChanged

windowTitleChanged(self, str) [signal]

windowType(self)

x(self)

y(self)

scenePosChanged

addDragEnterListener(callback: function)[source]

Register callback for Drag Enter event

Parameters

callback – callback function

addDropListener(callback: function)[source]

Register callback for Drop event

Parameters

callback – callback function

cutIntersectingEdges()[source]

Compare which Edges intersect with current Cut line and delete them safely

debug_modifiers(event)[source]

Helper function get string if we hold Ctrl, Shift or Alt modifier keys

deleteSelected()[source]

Shortcut for safe deleting every object selected in the Scene.

distanceBetweenClickAndReleaseIsOff(event: QMouseEvent) bool[source]

Measures if we are too far from the last Mouse button click scene position. This is used for detection if we release too far after we clicked on a Socket

Parameters

event (QMouseEvent) – Qt’s mouse event

Returns

True if we released too far from where we clicked before

dragEnterEvent(event: QDragEnterEvent)[source]

Trigger our registered Drag Enter events

dropEvent(event: QDropEvent)[source]

Trigger our registered Drop events

getItemAtClick(event: QEvent) QGraphicsItem[source]

Return the object on which we’ve clicked/release mouse button

Parameters

event (QEvent) – Qt’s mouse or key event

Returns

QGraphicsItem which the mouse event happened or None

initUI()[source]

Set up this QGraphicsView

isSnappingEnabled(event: QInputEvent = None) bool[source]

Returns True if snapping is currently enabled

keyPressEvent(event: QKeyEvent)[source]

Note

This overridden Qt’s method was used for handling key shortcuts, before we implemented proper QWindow with Actions and Menu. Still the commented code serves as an example on how to handle key presses without Qt’s framework for Actions and shortcuts. There is also an example on how to solve the problem when a Node contains Text/LineEdit and we press the Delete key (also serving to delete Node)

Parameters

event (QKeyEvent) – Qt’s Key event

Returns

leftMouseButtonPress(event: QMouseEvent)[source]

When Left mouse button was pressed

leftMouseButtonRelease(event: QMouseEvent)[source]

When Left mouse button was released

middleMouseButtonPress(event: QMouseEvent)[source]

When Middle mouse button was pressed

middleMouseButtonRelease(event: QMouseEvent)[source]

When Middle mouse button was released

mouseMoveEvent(event: QMouseEvent)[source]

Overriden Qt’s mouseMoveEvent handling Scene/View logic

mousePressEvent(event: QMouseEvent)[source]

Dispatch Qt’s mousePress event to corresponding function below

mouseReleaseEvent(event: QMouseEvent)[source]

Dispatch Qt’s mouseRelease event to corresponding function below

resetMode()[source]

Helper function to re-set the grView’s State Machine state to the default

rightMouseButtonPress(event: QMouseEvent)[source]

When Right mouse button was pressed

rightMouseButtonRelease(event: QMouseEvent)[source]

When Right mouse button was release

scenePosChanged

pyqtSignal emitted when cursor position on the Scene has changed

setSocketHighlights(scenepos: QPointF, highlighted: bool = True, radius: float = 50)[source]

Set/disable socket highlights in Scene area defined by scenepos and radius

wheelEvent(event: QWheelEvent)[source]

overridden Qt’s wheelEvent. This handles zooming

node_editor.node_node module

node_editor.node_scene module

node_editor.node_scene_clipboard module

A module containing all code for working with Clipboard

class node_editor.node_scene_clipboard.SceneClipboard(scene: Scene)[source]

Bases: object

Class contains all the code for serialization/deserialization from Clipboard

Methods

deserializeFromClipboard(data, *args, **kwargs)

Deserializes data from Clipboard.

serializeSelected([delete])

Serializes selected items in the Scene into OrderedDict

deserializeFromClipboard(data: dict, *args, **kwargs)[source]

Deserializes data from Clipboard.

Parameters

data (dict) – dict data for deserialization to the node_editor.node_scene.Scene.

serializeSelected(delete: bool = False) OrderedDict[source]

Serializes selected items in the Scene into OrderedDict

Parameters

delete (bool) – True if you want to delete selected items after serialization. Useful for Cut operation

Returns

Serialized data of current selection in NodeEditor Scene

node_editor.node_scene_history module

A module containing all code for working with History (Undo/Redo)

class node_editor.node_scene_history.SceneHistory(scene: Scene)[source]

Bases: object

Class contains all the code for undo/redo operations

Methods

addHistoryModifiedListener(callback)

Register callback for HistoryModified event

addHistoryRestoredListener(callback)

Register callback for HistoryRestored event

addHistoryStoredListener(callback)

Register callback for HistoryStored event

canRedo()

Return True if Redo is available for current History Stack

canUndo()

Return True if Undo is available for current History Stack

captureCurrentSelection()

Create dictionary with a list of selected nodes and a list of selected edges :return: dict 'nodes' - list of selected nodes, 'edges' - list of selected edges :rtype: dict

clear()

Reset the history stack

createHistoryStamp(desc)

Create History Stamp.

redo()

Redo operation

restoreHistory()

Restore History Stamp from History stack.

restoreHistoryStamp(history_stamp)

Restore History Stamp to current Scene with selection of items included

storeHistory(desc[, setModified])

Store History Stamp into History Stack

storeInitialHistoryStamp()

Helper function usually used when new or open file requested

undo()

Undo operation

addHistoryModifiedListener(callback: function)[source]

Register callback for HistoryModified event

Parameters

callback – callback function

addHistoryRestoredListener(callback: function)[source]

Register callback for HistoryRestored event

Parameters

callback – callback function

addHistoryStoredListener(callback: function)[source]

Register callback for HistoryStored event

Parameters

callback – callback function

canRedo() bool[source]

Return True if Redo is available for current History Stack

Return type

bool

canUndo() bool[source]

Return True if Undo is available for current History Stack

Return type

bool

captureCurrentSelection() dict[source]

Create dictionary with a list of selected nodes and a list of selected edges :return: dict ‘nodes’ - list of selected nodes, ‘edges’ - list of selected edges :rtype: dict

clear()[source]

Reset the history stack

createHistoryStamp(desc: str) dict[source]

Create History Stamp. Internally serialize whole scene and the current selection

Parameters

desc – Descriptive label for the History Stamp

Returns

History stamp serializing state of Scene and current selection

Return type

dict

redo()[source]

Redo operation

restoreHistory()[source]

Restore History Stamp from History stack.

Triggers:

  • History Modified event

  • History Restored event

restoreHistoryStamp(history_stamp: dict)[source]

Restore History Stamp to current Scene with selection of items included

Parameters

history_stamp (dict) – History Stamp to restore

storeHistory(desc: str, setModified: bool = False)[source]

Store History Stamp into History Stack

Parameters
  • desc (str) – Description of current History Stamp

  • setModified (bool) – if True marks Scene with has_been_modified

Triggers:

  • History Modified

  • History Stored

storeInitialHistoryStamp()[source]

Helper function usually used when new or open file requested

undo()[source]

Undo operation

node_editor.node_serializable module

A module containing Serializable “Interface”. We pretend its an abstract class

class node_editor.node_serializable.Serializable[source]

Bases: object

Methods

deserialize(data[, hashmap, restore_id])

Deserialization method which take data in python dict format with helping hashmap containing references to existing entities.

serialize()

Serialization method to serialize this class data into OrderedDict which can be easily stored in memory or file.

deserialize(data: dict, hashmap: dict = {}, restore_id: bool = True) bool[source]

Deserialization method which take data in python dict format with helping hashmap containing references to existing entities.

Parameters
  • data (dict) – Dictionary containing serialized data

  • hashmap (dict) – Helper dictionary containing references (by id == key) to existing objects

  • restore_id (bool) – True if we are creating new Sockets. False is useful when loading existing Sockets of which we want to keep the existing object’s id.

Returns

True if deserialization was successful, otherwise False

Return type

bool

serialize() OrderedDict[source]

Serialization method to serialize this class data into OrderedDict which can be easily stored in memory or file.

Returns

data serialized in OrderedDict

Return type

OrderedDict

node_editor.node_socket module

A module containing NodeEditor’s class for representing Socket and Socket Position Constants.

node_editor.node_socket.LEFT_BOTTOM = 3
node_editor.node_socket.LEFT_CENTER = 2
node_editor.node_socket.LEFT_TOP = 1
node_editor.node_socket.RIGHT_BOTTOM = 6
node_editor.node_socket.RIGHT_CENTER = 5
node_editor.node_socket.RIGHT_TOP = 4
class node_editor.node_socket.Socket(node: Node, index: int = 0, position: int = 1, socket_type: int = 1, multi_edges: bool = True, count_on_this_node_side: int = 1, is_input: bool = False)[source]

Bases: Serializable

Methods

Socket_GR_Class

Class representing Socket.

addEdge(edge)

Append an Edge to the list of connected Edges

changeSocketType(new_socket_type)

Change the Socket Type

delete()

Delete this Socket from graphics scene for sure

deserialize(data[, hashmap, restore_id])

Deserialization method which take data in python dict format with helping hashmap containing references to existing entities.

determineMultiEdges(data)

Deserialization helper function.

getSocketPosition()

return

Returns this Socket position according to the implementation stored in

hasAnyEdge()

Returns True if any Edge is connected to this socket

isConnected(edge)

Returns True if Edge is connected to this Socket

removeAllEdges([silent])

Disconnect all Edges from this Socket

removeEdge(edge)

Disconnect passed Edge from this Socket :param edge: Edge to disconnect :type edge: Edge

serialize()

Serialization method to serialize this class data into OrderedDict which can be easily stored in memory or file.

setSocketPosition()

Helper function to set Graphics Socket position.

Socket_GR_Class

Class representing Socket.

Attributes
socket_type

Methods

changeSocketType(new_socket_type)

Change the Socket Type

alias of QDMGraphicsSocket

addEdge(edge: Edge)[source]

Append an Edge to the list of connected Edges

Parameters

edge (Edge) – Edge to connect to this Socket

changeSocketType(new_socket_type: int) bool[source]

Change the Socket Type

Parameters

new_socket_type (int) – new socket type

Returns

Returns True if the socket type was actually changed

Return type

bool

delete()[source]

Delete this Socket from graphics scene for sure

deserialize(data: dict, hashmap: dict = {}, restore_id: bool = True) bool[source]

Deserialization method which take data in python dict format with helping hashmap containing references to existing entities.

Parameters
  • data (dict) – Dictionary containing serialized data

  • hashmap (dict) – Helper dictionary containing references (by id == key) to existing objects

  • restore_id (bool) – True if we are creating new Sockets. False is useful when loading existing Sockets of which we want to keep the existing object’s id.

Returns

True if deserialization was successful, otherwise False

Return type

bool

determineMultiEdges(data: dict) bool[source]

Deserialization helper function. In our tutorials we created a new version of graph data format. This function is here to help solve the issue of opening older files in the newer format. If the ‘multi_edges’ param is missing in the dictionary, we determine if this Socket should support multiple Edges.

Parameters

data (dict) – Socket data in dict format for deserialization

Returns

True if this Socket should support multi_edges

getSocketPosition()[source]
Returns

Returns this Socket position according to the implementation stored in Node

Return type

x, y position

hasAnyEdge() bool[source]

Returns True if any Edge is connected to this socket

Returns

True if any Edge is connected to this socket

Return type

bool

isConnected(edge: Edge) bool[source]

Returns True if Edge is connected to this Socket

Parameters

edge (Edge) – Edge to check if it is connected to this Socket

Returns

True if Edge is connected to this socket

Return type

bool

removeAllEdges(silent: bool = False)[source]

Disconnect all Edges from this Socket

removeEdge(edge: Edge)[source]

Disconnect passed Edge from this Socket :param edge: Edge to disconnect :type edge: Edge

serialize() OrderedDict[source]

Serialization method to serialize this class data into OrderedDict which can be easily stored in memory or file.

Returns

data serialized in OrderedDict

Return type

OrderedDict

setSocketPosition()[source]

Helper function to set Graphics Socket position. Exact socket position is calculated inside Node.

node_editor.utils module

Module with some helper functions

node_editor.utils.dumpException(e=None)[source]

Prints out an Exception message with a traceback to the console

Parameters

e (Exception) – Exception to print out

node_editor.utils.loadStylesheet(filename: str)[source]

Loads an qss stylesheet to the current QApplication instance

Parameters

filename (str) – Filename of qss stylesheet

node_editor.utils.loadStylesheets(*args)[source]

Loads multiple qss stylesheets. Concatenates them together and applies the final stylesheet to the current QApplication instance

Parameters

args (str, str,...) – variable number of filenames of qss stylesheets

Module contents