spinetoolbox.project_item_icon
¶
Classes for drawing graphics items on QGraphicsScene.
- authors
Marin (KTH), P. Savolainen (VTT)
- date
4.4.2018
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:
PySide2.QtWidgets.QGraphicsRectItem
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
- finalize(self, name, x, y)[source]¶
Names the icon and moves it by given amount.
- Parameters
name (str) – icon’s name
x (int) – horizontal offset
y (int) – vertical offset
- _setup(self, brush, svg, svg_color)[source]¶
Setup item’s attributes.
- Parameters
brush (QBrush) – Used in filling the background rectangle
svg (str) – Path to SVG icon file
svg_color (QColor) – Color of SVG icon
- name(self)[source]¶
Returns name of the item that is represented by this icon.
- Returns
icon’s name
- Return type
str
- update_name_item(self, new_name)[source]¶
Set a new text to name item.
- Parameters
new_name (str) – icon’s name
- set_name_attributes(self)[source]¶
Set name QGraphicsSimpleTextItem attributes (font, size, position, etc.)
- conn_button(self, position='left')[source]¶
Returns item’s connector button.
- Parameters
position (str) – “left”, “right” or “bottom”
- Returns
connector button
- Return type
QWidget
- outgoing_links(self)[source]¶
Collects outgoing links.
- Returns
outgoing links
- Return type
list of LinkBase
- incoming_links(self)[source]¶
Collects incoming links.
- Returns
outgoing links
- Return type
list of LinkBase
- run_execution_leave_animation(self, excluded)[source]¶
Starts the animation associated with execution leaving the icon.
- Parameters
excluded (bool) – True if project item was not actually executed.
- hoverEnterEvent(self, event)[source]¶
Sets a drop shadow effect to icon when mouse enters its boundaries.
- Parameters
event (QGraphicsSceneMouseEvent) – Event
- hoverLeaveEvent(self, event)[source]¶
Disables the drop shadow when mouse leaves icon boundaries.
- Parameters
event (QGraphicsSceneMouseEvent) – Event
- mouseMoveEvent(self, event)[source]¶
Moves icon(s) while the mouse button is pressed. Update links that are connected to selected icons.
- Parameters
event (QGraphicsSceneMouseEvent) – Event
- update_links_geometry(self)[source]¶
Updates geometry of connected links to reflect this item’s most recent position.
- contextMenuEvent(self, event)[source]¶
Show item context menu.
- Parameters
event (QGraphicsSceneMouseEvent) – Mouse event
- itemChange(self, change, value)[source]¶
Reacts to item removal and position changes.
In particular, destroys the drop shadow effect when the items 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
- class spinetoolbox.project_item_icon.ConnectorButton(parent, toolbox, position='left')[source]¶
Bases:
PySide2.QtWidgets.QGraphicsRectItem
Connector button graphics item. Used for Link drawing between project items.
- Parameters
parent (QGraphicsItem) – Project item bg rectangle
toolbox (ToolboxUI) – QMainWindow instance
position (str) – Either “top”, “left”, “bottom”, or “right”
- project_item(self)[source]¶
Returns the project item this connector button is attached to.
- Returns
project item
- Return type
- mousePressEvent(self, event)[source]¶
Connector button mouse press event. Either starts or closes a link.
- Parameters
event (QGraphicsSceneMouseEvent) – Event
- set_friend_connectors_enabled(self, 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.
- mouseDoubleClickEvent(self, event)[source]¶
Connector button mouse double click event. Makes sure the LinkDrawer is hidden.
- Parameters
event (QGraphicsSceneMouseEvent) – Event
- hoverEnterEvent(self, 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:
PySide2.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:
PySide2.QtWidgets.QGraphicsTextItem
An icon to notify that a ProjectItem is missing some configuration.
- Parameters
parent (ProjectItemIcon) – the parent item
- remove_notification(self, subtext)[source]¶
Remove the first notification that includes given subtext.
- class spinetoolbox.project_item_icon.RankIcon(parent)[source]¶
Bases:
PySide2.QtWidgets.QGraphicsTextItem
An icon to show the rank of a ProjectItem within its DAG.
- Parameters
parent (ProjectItemIcon) – the parent item