Spine Toolbox
0.8-dev

Contents:

  • What’s New?
  • Getting Started
  • How to Set up SpineOpt.jl
  • Setting up Consoles and External Tools
  • Main Window
  • Project Items
  • Links
  • Tool Specification Editor
  • Executing Projects
  • Settings
  • Spine Database Editor
  • Plotting
  • Parameter Value Editor
  • Spine Metadata Description
  • Importing and Exporting Data
  • Spine Engine Server
  • Terminology
  • Contribution Guide
  • Developer Documentation
  • API Reference
    • spinetoolbox
      • Subpackages
      • Submodules
        • spinetoolbox.__main__
        • spinetoolbox._version
        • spinetoolbox.config
        • spinetoolbox.execution_managers
        • spinetoolbox.fetch_parent
        • spinetoolbox.headless
        • spinetoolbox.helpers
        • spinetoolbox.kernel_fetcher
        • spinetoolbox.link
        • spinetoolbox.load_project_items
        • spinetoolbox.log_mixin
        • spinetoolbox.logger_interface
        • spinetoolbox.main
        • spinetoolbox.metaobject
        • spinetoolbox.plotting
        • spinetoolbox.plugin_manager
        • spinetoolbox.project
        • spinetoolbox.project_commands
        • spinetoolbox.project_item_icon
        • spinetoolbox.project_settings
        • spinetoolbox.project_upgrader
        • spinetoolbox.qthread_pool_executor
        • spinetoolbox.spine_db_commands
        • spinetoolbox.spine_db_icon_manager
        • spinetoolbox.spine_db_manager
        • spinetoolbox.spine_db_parcel
        • spinetoolbox.spine_db_worker
        • spinetoolbox.spine_engine_manager
        • spinetoolbox.spine_engine_worker
        • spinetoolbox.ui_main
        • spinetoolbox.version
      • Package Contents
Spine Toolbox
  • API Reference
  • spinetoolbox
  • spinetoolbox.link
  • Edit on GitHub

spinetoolbox.link

Classes for drawing graphics items on QGraphicsScene.

Module Contents

Classes

LinkBase

Base class for Link and LinkDrawer.

_IconBase

Base class for icons to show over a Link.

_SvgIcon

An SVG icon to show over a Link.

_TextIcon

A font awesome icon to show over a Link.

_WarningTextIcon

A font awesome icon to show over a Link.

JumpOrLink

Base class for Jump and Link.

Link

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

JumpLink

A graphics icon to represent a jump connection between items.

LinkDrawerBase

A base class for items intended for drawing links between project items.

ConnectionLinkDrawer

An item for drawing connection links between project items.

JumpLinkDrawer

An item for drawing jump connections between project items.

Functions

_regular_polygon_points(n, side[, initial_angle])

Attributes

LINK_COLOR

JUMP_COLOR

spinetoolbox.link.LINK_COLOR[source]
spinetoolbox.link.JUMP_COLOR[source]
class spinetoolbox.link.LinkBase(toolbox, src_connector, dst_connector)[source]

Bases: PySide6.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

  • src_connector (ConnectorButton, optional) – Source connector button

  • dst_connector (ConnectorButton) – Destination connector button

property outline_color[source]
property magic_number[source]
property src_rect[source]

Returns the scene rectangle of the source connector.

property src_center[source]

Returns the center point of the source rectangle.

property dst_rect[source]

Returns the scene rectangle of the destination connector.

property dst_center[source]

Returns the center point of the destination rectangle.

_COLOR[source]
shape()[source]
moveBy(_dx, _dy)[source]

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

update_geometry(curved_links=None)[source]

Updates geometry.

guide_path()[source]

For tests.

_do_update_geometry()[source]

Sets the path for this item.

_add_ellipse_path(path)[source]

Adds an ellipse for the link’s base.

Parameters

QPainterPath –

_get_joint_angle()[source]
_add_arrow_path(path)[source]

Returns an arrow path for the link’s tip.

Parameters

QPainterPath –

static _get_offset(button)[source]
_get_src_offset()[source]
_get_dst_offset()[source]
_find_new_point(points, target)[source]

Finds a new point that approximates points to target in a smooth trajectory. Returns the new point, or None if no need for approximation.

Parameters
  • points (list(QPointF)) –

  • target (QPointF) –

Returns

QPointF or None

_close_enough(p1, p2)[source]
_make_guide_path(curved_links=False)[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

itemChange(change, value)[source]

Wipes out the link when removed from scene.

wipe_out()[source]

Removes any trace of this item from the system.

class spinetoolbox.link._IconBase(x, y, w, h, parent, tooltip=None, active=True)[source]

Bases: PySide6.QtWidgets.QGraphicsEllipseItem

Base class for icons to show over a Link.

hoverEnterEvent(event)[source]
hoverLeaveEvent(event)[source]
class spinetoolbox.link._SvgIcon(parent, extent, path, tooltip=None, active=False)[source]

Bases: _IconBase

An SVG icon to show over a Link.

wipe_out()[source]

Cleans up icon’s resources.

class spinetoolbox.link._TextIcon(parent, extent, char, tooltip=None, active=False)[source]

Bases: _IconBase

A font awesome icon to show over a Link.

wipe_out()[source]

Cleans up icon’s resources.

class spinetoolbox.link._WarningTextIcon(parent, extent, char, tooltip)[source]

Bases: _TextIcon

A font awesome icon to show over a Link.

class spinetoolbox.link.JumpOrLink(toolbox, src_connector, dst_connector)[source]

Bases: LinkBase

Base class for Jump and Link.

Parameters
  • toolbox (ToolboxUI) – main UI class instance

  • src_connector (ConnectorButton, optional) – Source connector button

  • dst_connector (ConnectorButton) – Destination connector button

abstract property item[source]
_do_update_geometry()[source]

See base class.

_place_icons()[source]
mousePressEvent(e)[source]

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

Parameters

e (QGraphicsSceneMouseEvent) – Mouse event

contextMenuEvent(e)[source]

Selects the link and shows context menu.

Parameters

e (QGraphicsSceneMouseEvent) – Mouse event

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

Sets a dashed pen if selected.

shape()[source]
wipe_out()[source]

Removes any trace of this item from the system.

_make_execution_animation()[source]

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

Returns

QVariantAnimation

run_execution_animation()[source]

Runs execution animation.

_handle_execution_animation_value_changed(step)[source]
class spinetoolbox.link.Link(toolbox, src_connector, dst_connector, connection)[source]

Bases: JumpOrLink

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 (LoggingConnection) – connection this link represents

property name[source]
property connection[source]
property item[source]
_COLOR[source]
_MEMORY = '\uf538'[source]
_FILTERS = '\uf0b0'[source]
_PURGE = '\uf0e7'[source]
_WARNING = '\uf06a'[source]
_DATAPACKAGE = ':/icons/datapkg.svg'[source]
update_icons()[source]
itemChange(change, value)[source]

Brings selected link to top.

class spinetoolbox.link.JumpLink(toolbox, src_connector, dst_connector, jump)[source]

Bases: JumpOrLink

A graphics icon to represent a jump connection between items.

Parameters
  • toolbox (ToolboxUI) – main UI class instance

  • src_connector (ConnectorButton) – Source connector button

  • dst_connector (ConnectorButton) – Destination connector button

  • jump (spine_engine.project_item.connection.Jump) – connection this link represents

property jump[source]
property item[source]
property name[source]
_COLOR[source]
_ISSUE = '\uf071'[source]
issues()[source]

Checks if jump is well-defined.

Returns

issues regarding the jump

Return type

list of str

update_icons()[source]
class spinetoolbox.link.LinkDrawerBase(toolbox)[source]

Bases: LinkBase

A base class for items intended for drawing links between project items.

Parameters

toolbox (ToolboxUI) – main UI class instance

property src_rect[source]

Returns the scene rectangle of the source connector.

property dst_rect[source]

Returns the scene rectangle of the destination connector.

property dst_center[source]

Returns the center point of the destination rectangle.

_get_dst_offset()[source]
abstract add_link()[source]

Makes link between source and destination connectors.

wake_up(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) – source connector

sleep()[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.

class spinetoolbox.link.ConnectionLinkDrawer(toolbox)[source]

Bases: LinkDrawerBase

An item for drawing connection links between project items.

Parameters

toolbox (ToolboxUI) – main UI class instance

_COLOR[source]
add_link()[source]

Makes link between source and destination connectors.

wake_up(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) – source connector

sleep()[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.

class spinetoolbox.link.JumpLinkDrawer(toolbox)[source]

Bases: LinkDrawerBase

An item for drawing jump connections between project items.

Parameters

toolbox (ToolboxUI) – main UI class instance

_COLOR[source]
add_link()[source]

Makes link between source and destination connectors.

spinetoolbox.link._regular_polygon_points(n, side, initial_angle=0)[source]
Previous Next

© Copyright 2017-2021 Spine project consortium. Revision 082272a9.

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