nodedge.graphics_socket

Graphics socket module containing GraphicsSocket class.

class nodedge.graphics_socket.GraphicsSocket(socket: Socket)

Bases: PySide2.QtWidgets.QGraphicsItem

GraphicsSocket class.

The graphics socket is the graphical representation of the Socket.

Parameters

socket (Socket) – reference to Socket

initUI() → None

Setup this QGraphicsItem.

initStyle() → None

Initialize QObjects like QColor, QPen and QBrush.

initSizes() → None

Set up internal attributes like width, height, etc.

property socketType
Returns

socket type

Return type

int

updateSocketType() → None

Change the Socket Type.

paint(painter: PySide2.QtGui.QPainter, options: PySide2.QtWidgets.QStyleOptionGraphicsItem, widget: Optional[PySide2.QtWidgets.QWidget] = None)

Paint a circle.

boundingRect() → PySide2.QtCore.QRectF

Define Qt’s bounding rectangle.

Returns

Graphics socket bounding rectangle.

Return type

QRectF

hoverEnterEvent(event: PySide2.QtWidgets.QGraphicsSceneHoverEvent) → None

Overridden Qt’s slot to handle mouse hovering on the edge.

Parameters

event (QGraphicsSceneHoverEvent) – Qt’s mouse hover event

hoverLeaveEvent(event: PySide2.QtWidgets.QGraphicsSceneHoverEvent) → None

Overridden Qt’s slot to handle mouse hovering’s end on the edge.

Parameters

event (QGraphicsSceneHoverEvent) – Qt’s mouse hover event

nodedge.graphics_socket.getSocketColor(key: Union[int, str]) → PySide2.QtGui.QColor

Returns the QColor for this key.