spinetoolbox.project_item_icon
Classes for drawing graphics items on QGraphicsScene.
Module Contents
Classes
Base class for project item icons drawn in Design View. |
|
Connector button graphics item. Used for Link drawing between project items. |
|
An icon to show information about the item's execution. |
|
An icon to notify that a ProjectItem is missing some configuration. |
|
An icon to show the rank of a ProjectItem within its DAG. |
- class spinetoolbox.project_item_icon.ProjectItemIcon(toolbox, icon_file, icon_color)[source]
Bases:
PySide6.QtWidgets.QGraphicsPathItem
Base class for project item icons drawn in Design View.
- Parameters
toolbox (ToolboxUI) – QMainWindow instance
icon_file (str) – Path to icon resource
icon_color (QColor) – Icon’s color
- add_specification_icon(spec_icon_path)[source]
Adds an SVG icon to bottom left corner of the item icon based on Tool Specification type.
- Parameters
spec_icon_path (str) – Path to icon resource file.
- finalize(name, x, y)[source]
Names the icon and moves it by a given amount.
- Parameters
name (str) – icon’s name
x (int) – horizontal offset
y (int) – vertical offset
- name()[source]
Returns name of the item that is represented by this icon.
- Returns
icon’s name
- Return type
str
- update_name_item(new_name)[source]
Sets a new text to name item.
- Parameters
new_name (str) – icon’s name
- conn_button(position='left')[source]
Returns item’s connector button.
- Parameters
position (str) – “left”, “right” or “bottom”
- Returns
connector button
- Return type
QWidget
- outgoing_connection_links()[source]
Collects outgoing connection links.
- Returns
outgoing links
- Return type
list of LinkBase
- incoming_links()[source]
Collects incoming connection links.
- Returns
outgoing links
- Return type
list of LinkBase
- _update_link_drawer_destination(pos=None)[source]
Updates link drawer destination. If pos is None, then the link drawer would have no destination. Otherwise, the destination would be the connector button closest to pos.
- hoverEnterEvent(event)[source]
Sets a drop shadow effect to icon when mouse enters its boundaries.
- Parameters
event (QGraphicsSceneMouseEvent) – Event
- hoverLeaveEvent(event)[source]
Disables the drop shadow when mouse leaves icon boundaries.
- Parameters
event (QGraphicsSceneMouseEvent) – Event
- update_links_geometry()[source]
Updates geometry of connected links to reflect this item’s most recent position.
- mouseReleaseEvent(event)[source]
Clears pre-bump rects, and pushes a move icon command if necessary.
- contextMenuEvent(event)[source]
Show item context menu.
- Parameters
event (QGraphicsSceneMouseEvent) – Mouse event
- itemChange(change, value)[source]
Reacts to item removal and position changes.
In particular, destroys the drop shadow effect when the item is removed from a scene and keeps track of item’s movements on the scene.
- Parameters
change (GraphicsItemChange) – a flag signalling the type of the change
value – a value related to the change
- Returns
Whatever super() does with the value parameter
- set_pos_without_bumping(pos)[source]
Sets position without bumping other items. Needed for undoing move operations.
- Parameters
pos (QPointF) –
- make_room_for_item(other)[source]
Makes room for another item.
- Parameters
item (ProjectItemIcon) –
- class spinetoolbox.project_item_icon.ConnectorButton(toolbox, parent, position='left')[source]
Bases:
PySide6.QtWidgets.QGraphicsPathItem
Connector button graphics item. Used for Link drawing between project items.
- Parameters
toolbox (ToolboxUI) – QMainWindow instance
parent (ProjectItemIcon) – parent graphics item
position (str) – Either “top”, “left”, “bottom”, or “right”
- project_item()[source]
Returns the project item this connector button is attached to.
- Returns
project item
- Return type
- mousePressEvent(event)[source]
Connector button mouse press event.
- Parameters
event (QGraphicsSceneMouseEvent) – Event
- set_friend_connectors_enabled(enabled)[source]
Enables or disables all connectors in the parent.
This is called by LinkDrawer to disable invalid connectors while drawing and reenabling them back when done.
- Parameters
enabled (bool) – True to enable connectors, False to disable
- hoverEnterEvent(event)[source]
Sets a darker shade to connector button when mouse enters its boundaries.
- Parameters
event (QGraphicsSceneMouseEvent) – Event
- class spinetoolbox.project_item_icon.ExecutionIcon(parent)[source]
Bases:
PySide6.QtWidgets.QGraphicsEllipseItem
An icon to show information about the item’s execution.
- Parameters
parent (ProjectItemIcon) – the parent item
- class spinetoolbox.project_item_icon.ExclamationIcon(parent)[source]
Bases:
PySide6.QtWidgets.QGraphicsTextItem
An icon to notify that a ProjectItem is missing some configuration.
- Parameters
parent (ProjectItemIcon) – the parent item
- clear_other_notifications(subtext)[source]
Remove notifications that don’t include the given subtext.