spinetoolbox.link
¶
Classes for drawing graphics items on QGraphicsScene.
- authors
Marin (KTH), P. Savolainen (VTT)
- date
4.4.2018
Module Contents¶
Classes¶
Base class for Link and LinkDrawer. |
|
An icon to show over a Link. |
|
A graphics item to represent the connection between two project items. |
|
An item for drawing links between project items. |
- class spinetoolbox.link.LinkBase(toolbox)[source]¶
Bases:
PySide2.QtWidgets.QGraphicsPathItem
Base class for Link and LinkDrawer.
Mainly provides the
update_geometry
method for ‘drawing’ the link on the scene.- Parameters
toolbox (ToolboxUI) – main UI class instance
- moveBy(self, _dx, _dy)[source]¶
Does nothing. This item is not moved the regular way, but follows the ConnectorButtons it connects.
- do_update_geometry(self, guide_path)[source]¶
Sets the path for this item.
- Parameters
guide_path (QPainterPath) –
- _make_guide_path(self, curved_links)[source]¶
Returns a ‘narrow’ path connecting this item’s source and destination.
- Parameters
curved_links (bool) – Whether the path should follow a curved line or just a straight line
- Returns
QPainterPath
- _points_and_angles_from_path(self, path)[source]¶
Returns a list of representative points and angles from given path.
- Parameters
path (QPainterPath) –
- Returns
points list(float): angles
- Return type
list(QPointF)
- _make_connecting_path(self, guide_path)[source]¶
Returns a ‘thick’ path connecting source and destination, by following the given ‘guide’ path.
- Parameters
guide_path (QPainterPath) –
- Returns
QPainterPath
- class spinetoolbox.link._LinkIcon(x, y, w, h, parent)[source]¶
Bases:
PySide2.QtWidgets.QGraphicsEllipseItem
An icon to show over a Link.
- class spinetoolbox.link.Link(toolbox, src_connector, dst_connector, connection)[source]¶
Bases:
LinkBase
A graphics item to represent the connection between two project items.
- Parameters
toolbox (ToolboxUI) – main UI class instance
src_connector (ConnectorButton) – Source connector button
dst_connector (ConnectorButton) – Destination connector button
connection (spine_engine.project_item.Connection) – connection this link represents
- refresh_resource_filter_model(self)[source]¶
Makes resource filter mode fetch filter data from database.
- make_execution_animation(self, excluded)[source]¶
Returns an animation to play when execution ‘passes’ through this link.
- Returns
QVariantAnimation
- mousePressEvent(self, e)[source]¶
Ignores event if there’s a connector button underneath, to allow creation of new links.
- Parameters
e (QGraphicsSceneMouseEvent) – Mouse event
- class spinetoolbox.link.LinkDrawer(toolbox)[source]¶
Bases:
LinkBase
An item for drawing links between project items.
- Parameters
toolbox (ToolboxUI) – main UI class instance
- wake_up(self, src_connector)[source]¶
Sets the source connector, shows this item and adds it to the scene. After calling this, the scene is in link drawing mode.
- Parameters
src_connector (ConnectorButton) –