Spine Toolbox
release-0.6

Contents:

  • Getting Started
  • How to set up SpineOpt.jl
  • Tutorials
  • Setting up External Tools
  • Main Window
  • Project Items
  • Tool specification editor
  • Executing Projects
  • Execution Modes
  • Settings
  • Spine database editor
  • Plotting
  • Parameter value editor
  • Importing and exporting data
  • Spine datapackage editor
  • Terminology
  • Dependencies
  • Contribution Guide for Spine Toolbox
  • Developer documentation
  • API Reference
    • spinetoolbox
      • Subpackages
      • Submodules
        • spinetoolbox.__main__
        • spinetoolbox.config
        • spinetoolbox.custom_file_system_watcher
        • spinetoolbox.dag_handler
        • spinetoolbox.data_package_commands
        • spinetoolbox.execution_managers
        • spinetoolbox.headless
        • spinetoolbox.helpers
        • spinetoolbox.link
        • spinetoolbox.load_project_items
        • spinetoolbox.logger_interface
        • spinetoolbox.main
        • spinetoolbox.metaobject
        • spinetoolbox.plotting
        • spinetoolbox.plugin_manager
        • spinetoolbox.project
        • spinetoolbox.project_commands
        • spinetoolbox.project_item_icon
        • spinetoolbox.project_tree_item
        • spinetoolbox.project_upgrader
        • spinetoolbox.spine_db_commands
        • spinetoolbox.spine_db_fetcher
        • spinetoolbox.spine_db_icon_manager
        • spinetoolbox.spine_db_manager
        • spinetoolbox.spine_db_parcel
        • spinetoolbox.spine_db_signaller
        • spinetoolbox.spine_db_worker
        • spinetoolbox.spine_engine_manager
        • spinetoolbox.spine_engine_version_check
        • spinetoolbox.spine_engine_worker
        • spinetoolbox.spinedb_api_version_check
        • spinetoolbox.ui_main
        • spinetoolbox.version
      • Package Contents
Spine Toolbox
  • Docs »
  • API Reference »
  • spinetoolbox »
  • spinetoolbox.link
  • Edit on GitHub

spinetoolbox.link¶

Classes for drawing graphics items on QGraphicsScene.

authors
  1. Marin (KTH), P. Savolainen (VTT)

date

4.4.2018

Module Contents¶

Classes¶

LinkBase

Base class for Link and LinkDrawer.

_LinkIcon

An icon to show over a Link.

Link

A graphics item to represent the connection between two project items.

LinkDrawer

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

property magic_number(self)[source]¶
property src_rect(self)[source]¶

Returns the scene rectangle of the source connector.

property src_center(self)[source]¶

Returns the center point of the source rectangle.

property dst_rect(self)[source]¶

Returns the scene rectangle of the destination connector.

property dst_center(self)[source]¶

Returns the center point of the destination rectangle.

moveBy(self, _dx, _dy)[source]¶

Does nothing. This item is not moved the regular way, but follows the ConnectorButtons it connects.

update_geometry(self, curved_links=None)[source]¶

Updates geometry.

do_update_geometry(self, guide_path)[source]¶

Sets the path for this item.

Parameters

guide_path (QPainterPath) –

_make_ellipse_path(self)[source]¶

Returns an ellipse path for the link’s base.

Returns

QPainterPath

_get_src_offset(self)[source]¶
_get_dst_offset(self, c1)[source]¶
_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

static _follow_points(curve_path, points)[source]¶
_radius_from_point_and_angle(self, point, angle)[source]¶
_make_arrow_path(self, guide_path)[source]¶

Returns an arrow path for the link’s tip.

Parameters

guide_path (QPainterPath) – A narrow path connecting source and destination, used to determine the arrow orientation.

Returns

QPainterPath

_get_joint_line(self, guide_path)[source]¶
_get_joint_angle(self, guide_path)[source]¶
class spinetoolbox.link._LinkIcon(x, y, w, h, parent)[source]¶

Bases: PySide2.QtWidgets.QGraphicsEllipseItem

An icon to show over a Link.

update_icon(self)[source]¶

Sets the icon (filter, datapkg, or none), depending on Connection state.

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.

set_connection_options(self, options)[source]¶
property name(self)[source]¶
property connection(self)[source]¶
do_update_geometry(self, guide_path)[source]¶

See base class.

make_execution_animation(self, excluded)[source]¶

Returns an animation to play when execution ‘passes’ through this link.

Returns

QVariantAnimation

_handle_execution_animation_value_changed(self, step)[source]¶
has_parallel_link(self)[source]¶

Returns whether or not this link entirely overlaps another.

send_to_bottom(self)[source]¶

Stacks this link before the parallel one if any.

mousePressEvent(self, e)[source]¶

Ignores event if there’s a connector button underneath, to allow creation of new links.

Parameters

e (QGraphicsSceneMouseEvent) – Mouse event

contextMenuEvent(self, e)[source]¶

Selects the link and shows context menu.

Parameters

e (QGraphicsSceneMouseEvent) – Mouse event

paint(self, painter, option, widget=None)[source]¶

Sets a dashed pen if selected.

shape(self)[source]¶
itemChange(self, change, value)[source]¶

Brings selected link to top.

wipe_out(self)[source]¶

Removes any trace of this item from the system.

class spinetoolbox.link.LinkDrawer(toolbox)[source]¶

Bases: LinkBase

An item for drawing links between project items.

Parameters

toolbox (ToolboxUI) – main UI class instance

property src_rect(self)[source]¶

Returns the scene rectangle of the source connector.

property dst_rect(self)[source]¶

Returns the scene rectangle of the destination connector.

property dst_center(self)[source]¶

Returns the center point of the destination rectangle.

add_link(self)[source]¶

Makes link between source and destination connectors.

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) –

sleep(self)[source]¶

Removes this drawer from the scene, clears its source and destination connectors, and hides it. After calling this, the scene is no longer in link drawing mode.

Next Previous

© Copyright 2017-2021 Spine project consortium Revision a41c0cb9.

Built with Sphinx using a theme provided by Read the Docs.