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:
SerializableClass for representing Edge in NodeEditor.
- Attributes
edge_typeEdge type
end_socketEnd socket
start_socketStart socket
Methods
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
dictformat with helping hashmap containing references to existing entities.doSelect([new_state])Provide the safe selecting/deselecting operation.
Return the list of Edge Validator Callbacks
Returns the class representing Graphics Edge
getOtherSocket(known_socket)Returns the opposite socket on this
Edgereconnect(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.
Helper function which sets start and end
SockettoNoneSerialization method to serialize this class data into
OrderedDictwhich can be easily stored in memory or file.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
dictformat with helping hashmap containing references to existing entities.- Parameters
data (
dict) – Dictionary containing serialized datahashmap (
dict) – Helper dictionary containing references (by id == key) to existing objectsrestore_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
Trueif deserialization was successful, otherwiseFalse- 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) –Trueif you want to select theEdge,Falseif you want to deselect theEdge
- 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
QDMGraphicsEdgechild class if necessary, adds thisQGraphicsPathItemto theQGraphicsSceneand updates edge sockets positions.
- edge_validators = []
class variable containing list of registered edge validators
- property end_socket
End socket
- getOtherSocket(known_socket: Socket)[source]
Returns the opposite socket on this
Edge- Parameters
known_socket (
Socket) – Provide knownSocketto be able to determine the opposite one.- Returns
The oposite socket on this
EdgeorNone- Return type
SocketorNone
- 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
QGraphicsSceneand it’s reference to all GC to clean it up. Notifies nodes previously connectedNode(s) about this event.Triggers Nodes’:
onEdgeConnectionChanged()onInputChanged()
- Parameters
silent_for_socket (
Socket) –Socketof aNodewhich won’t be notified, when thisEdgeis going to be removedsilent (
bool) –Trueif no events should be triggered during removing
- serialize() OrderedDict[source]
Serialization method to serialize this class data into
OrderedDictwhich can be easily stored in memory or file.- Returns
data serialized in
OrderedDict- Return type
OrderedDict
- property start_socket
Start socket
- updatePositions()[source]
Updates the internal Graphics Edge positions according to the start and end
Socket. This should be called if you updateEdgepositions.
node_editor.node_edge_dragging module
A module containing the Edge Dragging functionality
- class node_editor.node_edge_dragging.EdgeDragging(grView: QGraphicsView)[source]
Bases:
objectMethods
edgeDragEnd(item)Code handling the end of the dragging an Edge operation.
edgeDragStart(item)Code handling the start of a dragging an Edge operation
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
Noneto cancel the edge dragging mode- Parameters
item (
QGraphicsItem) – Item in the Graphics Scene where we ended dragging an Edge
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:
objectMethods
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
Trueif node got any connectionsleaveState(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) –Nodewhich we started to drag
- hotZoneRect(node: Node) QRectF[source]
Returns A QRectF of creating a box around a node
- Parameters
node (
Node) –Nodefor 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
Edgeor None if the node is being cut by an Edge- Return type
Edge
- isConnected(node: Node)[source]
Return
Trueif node got any connections- Parameters
node (
Node) –Nodewhich connections to check- Returns
node_editor.node_edge_rerouting module
A module containing the Edge Rerouting functionality
- class node_editor.node_edge_rerouting.EdgeRerouting(grView: QGraphicsView)[source]
Bases:
objectMethods
Remove the helping dashed edges from the
SceneGet a list of all edges connected to the self.start_socket where we started the re-routing
Helper function to get the Edge class.
print(*args)Helper function to better control debug printing to console for this feature
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).
- 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
- setAffectedEdgesVisible(visibility: bool = True)[source]
Show/Hide all edges connected to the self.start_socket where we started the re-routing
- Parameters
visibility (
bool) –Trueif all the affectedEdge(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) –Socketwhere we started the re-routing
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:
objectMethods
getSnappedSocketItem(event)Returns
QDMGraphicsSocketwhich we should snap togetSnappedToSocketPosition(scenepos)Returns grSocket and Scene position to nearest Socket or original position if no nearby Socket found
- getSnappedSocketItem(event: QMouseEvent) QDMGraphicsSocket[source]
Returns
QDMGraphicsSocketwhich 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_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:
QGraphicsItemClass representing Cutting Line used for cutting multiple Edges with one stroke
Methods
CacheModeGraphicsItemChangeGraphicsItemFlagGraphicsItemFlags(...)PanelModalityacceptDrops(self)acceptHoverEvents(self)acceptTouchEvents(self)acceptedMouseButtons(self)advance(self, int)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)
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:
QGraphicsPathItemBase class for Graphics Edge
Methods
CacheModeGraphicsItemChangeGraphicsItemFlagGraphicsItemFlags(...)PanelModalityacceptDrops(self)acceptHoverEvents(self)acceptTouchEvents(self)acceptedMouseButtons(self)advance(self, int)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, ...)Create instance of
GraphicsEdgePathBasecursor(self)data(self, int)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)Initialize
QObjectslikeQColor,QPenandQBrushinitUI()Set up this
QGraphicsPathIteminputMethodEvent(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)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)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, ...)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
QPainterPathrepresentation of this Edgeshow(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)- calcPath() QPainterPath[source]
Will handle drawing QPainterPath from Point A to B. Internally there exist self.pathCalculator which is an instance of derived
GraphicsEdgePathBaseclass containing the actual calcPath() function - computing how the edge should look like.- Returns
QPainterPathof the edge connecting source and destination- Return type
QPainterPath
- 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) –Trueto select,Falseto deselect
- 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 Ap2 (
QPointF) – point B
- Returns
Trueif this Graphics Edge intersects- Return type
bool
- mouseReleaseEvent(event)[source]
Overridden Qt’s method to handle selecting and deselecting this Graphics Edge
- 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
Trueif color can be determined
- setDestination(x: float, y: float)[source]
Set destination point
- Parameters
x (
float) – x positiony (
float) – y position
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:
objectBase Class for calculating the graphics path to draw for an graphics Edge
Methods
calcPath()Calculate the Direct line connection
- class node_editor.node_graphics_edge_path.GraphicsEdgePathBezier(owner: QDMGraphicsEdge)[source]
Bases:
GraphicsEdgePathBaseCubic line connection Graphics Edge
Methods
calcPath()Calculate the cubic Bezier line connection with 2 control points
- class node_editor.node_graphics_edge_path.GraphicsEdgePathDirect(owner: QDMGraphicsEdge)[source]
Bases:
GraphicsEdgePathBaseDirect line connection Graphics Edge
Methods
calcPath()Calculate the Direct line connection
- class node_editor.node_graphics_edge_path.GraphicsEdgePathSquare(*args, handle_weight=0.5, **kwargs)[source]
Bases:
GraphicsEdgePathBaseSquare line connection Graphics Edge
Methods
calcPath()Calculate the square edge line connection
- 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:
QGraphicsItemClass describing Graphics representation of
NodeMethods
CacheModeGraphicsItemChangeGraphicsItemFlagGraphicsItemFlags(...)PanelModalityacceptDrops(self)acceptHoverEvents(self)acceptTouchEvents(self)acceptedMouseButtons(self)advance(self, int)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)Initialize
QObjectslikeQColor,QPenandQBrushSet up the grContent -
QGraphicsProxyWidgetto have a container for Graphics ContentSet up internal attributes like width, height, etc.
Set up the title Graphics representation: font, color, position, etc.
initUI()Set up this
QGraphicsIteminputMethodEvent(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)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)- 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) –Trueto select,Falseto deselect
- initContent()[source]
Set up the grContent -
QGraphicsProxyWidgetto have a container for Graphics Content
- mouseDoubleClickEvent(event)[source]
Overriden event for doubleclick. Resend to Node::onDoubleClicked
- mouseReleaseEvent(event)[source]
Overriden event to handle when we moved, selected or deselected this 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:
QGraphicsSceneClass representing Graphic of
SceneMethods
ItemIndexMethodSceneLayerSceneLayers(...)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)changedchanged(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)destroyedQObject = 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)focusItemChangedfocusItemChanged(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)Initialize
QObjectslikeQColor,QPenandQBrushinputMethodEvent(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)objectNameChangedobjectNameChanged(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)sceneRectChangedsceneRectChanged(self, QRectF) [signal]
selectedItems(self)selectionArea(self)selectionChangedselectionChanged(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
- itemSelected
pyqtSignal emitted when some item is selected in the Scene
- itemsDeselected
pyqtSignal emitted when items are deselected in the 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:
QGraphicsItemClass representing Graphic Socket in
QGraphicsScene- Attributes
- socket_type
Methods
CacheModeGraphicsItemChangeGraphicsItemFlagGraphicsItemFlags(...)PanelModalityacceptDrops(self)acceptHoverEvents(self)acceptTouchEvents(self)acceptedMouseButtons(self)advance(self, int)Defining Qt' bounding rectangle
boundingRegion(self, QTransform)boundingRegionGranularity(self)cacheMode(self)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
QColorfor thiskeygrabKeyboard(self)grabMouse(self)graphicsEffect(self)group(self)hasCursor(self)hasFocus(self)hide(self)hoverEnterEvent(self, QGraphicsSceneHoverEvent)hoverLeaveEvent(self, QGraphicsSceneHoverEvent)hoverMoveEvent(self, QGraphicsSceneHoverEvent)Initialize
QObjectslikeQColor,QPenandQBrushinputMethodEvent(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)- 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:
QGraphicsViewClass representing NodeEditor’s Graphics View
Methods
CacheMode(...)CacheModeFlagDragModeOptimizationFlagOptimizationFlags(...)PaintDeviceMetricRenderFlagRenderFlags(...)ShadowShapeSizeAdjustPolicyStyleMaskViewportAnchorViewportUpdateModeacceptDrops(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)customContextMenuRequestedcustomContextMenuRequested(self, QPoint) [signal]
customEvent(self, QEvent)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)Shortcut for safe deleting every object selected in the Scene.
depth(self)destroy(self[, destroyWindow, destroySubWindows])destroyedQObject = None) [signal]
devType(self)devicePixelRatio(self)devicePixelRatioF(self)devicePixelRatioFScale()disconnect(-> bool disconnect)disconnectNotify(self, QMetaMethod)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
QGraphicsViewinputMethodEvent(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
Trueif snapping is currently enabledisTransformed(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
mouseMoveEventhandling Scene/View logicmousePressEvent(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)objectNameChangedobjectNameChanged(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)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)rubberBandChangedrubberBandChanged(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)windowIconChangedwindowIconChanged(self, QIcon) [signal]
windowIconText(self)windowIconTextChangedwindowIconTextChanged(self, str) [signal]
windowModality(self)windowOpacity(self)windowRole(self)windowState(self)windowTitle(self)windowTitleChangedwindowTitleChanged(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
- 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
Trueif we released too far from where we clicked before
- 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
QGraphicsItemwhich the mouse event happened orNone
- isSnappingEnabled(event: QInputEvent = None) bool[source]
Returns
Trueif snapping is currently enabled
- keyPressEvent(event: QKeyEvent)[source]
Note
This overridden Qt’s method was used for handling key shortcuts, before we implemented proper
QWindowwith 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
- 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
- scenePosChanged
pyqtSignal emitted when cursor position on the Scene has changed
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:
objectClass 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
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:
objectClass 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
Trueif Redo is available for current History StackcanUndo()Return
Trueif Undo is available for current History StackCreate 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:dictclear()Reset the history stack
createHistoryStamp(desc)Create History Stamp.
redo()Redo operation
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
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
- 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
- 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
- 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
node_editor.node_serializable module
A module containing Serializable “Interface”. We pretend its an abstract class
- class node_editor.node_serializable.Serializable[source]
Bases:
objectMethods
deserialize(data[, hashmap, restore_id])Deserialization method which take data in python
dictformat with helping hashmap containing references to existing entities.Serialization method to serialize this class data into
OrderedDictwhich 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
dictformat with helping hashmap containing references to existing entities.- Parameters
data (
dict) – Dictionary containing serialized datahashmap (
dict) – Helper dictionary containing references (by id == key) to existing objectsrestore_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
Trueif deserialization was successful, otherwiseFalse- Return type
bool
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:
SerializableMethods
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
dictformat with helping hashmap containing references to existing entities.determineMultiEdges(data)Deserialization helper function.
- return
Returns this Socket position according to the implementation stored in
Returns
Trueif anyEdgeis connected to this socketisConnected(edge)Returns
TrueifEdgeis connected to this SocketremoveAllEdges([silent])Disconnect all Edges from this Socket
removeEdge(edge)Disconnect passed
Edgefrom this Socket :param edge:Edgeto disconnect :type edge:EdgeSerialization method to serialize this class data into
OrderedDictwhich can be easily stored in memory or file.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) –Edgeto 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
Trueif the socket type was actually changed- Return type
bool
- deserialize(data: dict, hashmap: dict = {}, restore_id: bool = True) bool[source]
Deserialization method which take data in python
dictformat with helping hashmap containing references to existing entities.- Parameters
data (
dict) – Dictionary containing serialized datahashmap (
dict) – Helper dictionary containing references (by id == key) to existing objectsrestore_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
Trueif deserialization was successful, otherwiseFalse- 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 indictformat for deserialization- Returns
Trueif this Socket should support multi_edges
- getSocketPosition()[source]
- Returns
Returns this Socket position according to the implementation stored in
Node- Return type
x, yposition
- hasAnyEdge() bool[source]
Returns
Trueif anyEdgeis connected to this socket- Returns
Trueif anyEdgeis connected to this socket- Return type
bool
- isConnected(edge: Edge) bool[source]
Returns
TrueifEdgeis connected to this Socket- Parameters
edge (
Edge) –Edgeto check if it is connected to this Socket- Returns
Trueif Edge is connected to this socket- Return type
bool
- removeEdge(edge: Edge)[source]
Disconnect passed
Edgefrom this Socket :param edge:Edgeto disconnect :type edge:Edge
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