pySimBlocks.gui.graphics.connection_item¶
- class pySimBlocks.gui.graphics.connection_item.OrthogonalRoute(points: list[QPointF])[source]¶
Bases:
objectStore routed connection points and the segment being dragged.
- points¶
Ordered route points in scene coordinates.
- dragged_index¶
Index of the segment currently being dragged.
- class pySimBlocks.gui.graphics.connection_item.ConnectionItem(src_port: PortItem | None, dst_port: PortItem | None, instance: ConnectionInstance, points: list[QPointF] | None = None)[source]¶
Bases:
QGraphicsPathItemRender and interact with a connection between two ports.
- src_port¶
Source port item of the connection.
- dst_port¶
Destination port item of the connection.
- instance¶
Connection model represented by this item.
- is_temporary¶
Whether the connection is currently incomplete.
- is_manual¶
Whether the route was manually adjusted.
- route¶
Current orthogonal route definition.
- OFFSET = 8¶
- MARGIN = 12¶
- DETOUR = 8¶
- PICK_TOL = 10¶
- GRID = 5¶
- AXIS_EPS = 0.5¶
- JOG_EPS = 8.0¶
- update_temp_position(scene_pos: QPointF)[source]¶
Update the temporary route endpoint while dragging.
- Parameters:
scene_pos – Current mouse position in scene coordinates.
- apply_manual_route(points: list[QPointF])[source]¶
Apply a persisted manual route to the connection.
- Parameters:
points – Route points in scene coordinates.
- segment_at(scene_pos: QPointF) int | None[source]¶
Return the route segment index located near the given scene point.
- Parameters:
scene_pos – Scene position to test.
- Returns:
Index of the matching segment, or None if none is close enough.