pySimBlocks.gui.graphics.port_item¶
- class pySimBlocks.gui.graphics.port_item.PortItem(instance: PortInstance, parent_block: BlockItem)[source]¶
Bases:
QGraphicsItemRender and interact with a block port on the diagram.
- instance¶
Port model represented by the item.
- parent_block¶
Block item owning the port.
- label¶
Text label displayed next to the port.
- MARGIN = 4¶
- R = 6¶
- L = 15¶
- H = 10¶
- RECT = PySide6.QtCore.QRectF(-8.000000, -8.000000, 15.000000, 15.000000)¶
- property is_input¶
Return whether this port is an input port.
- property is_on_left_side: bool¶
Return whether the port is currently placed on the left block side.
- connection_anchor() QPointF[source]¶
Return the scene anchor point used to attach a connection.
- Returns:
Scene coordinate used as the wire anchor for this port.
- is_compatible(other: PortItem)[source]¶
Return whether this port can connect to another port.
- Parameters:
other – Other port item to compare against.
- Returns:
True if the ports have opposite directions.
- boundingRect() QRectF[source]¶
Return the fixed bounding rectangle of the port.
- Returns:
Bounding rectangle used for painting and hit testing.
- paint(painter, option, widget=None)[source]¶
Paint the port as a circle or triangle depending on its direction.
- Parameters:
painter – Painter used to render the item.
option – Style option describing the current paint state.
widget – Optional target widget.
- shape()[source]¶
Return the hit-test shape of the port.
- Returns:
Painter path matching the painted port shape.