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 = 6¶
- GRID = 5¶
- 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.
- shape()[source]¶
Return an enlarged hit shape so connections are easier to select.
- Returns:
Stroke path used for hit testing.
- mousePressEvent(event)[source]¶
Start manual segment dragging when pressing a routed segment.
- Parameters:
event – Qt mouse-press event.