spinetoolbox.spine_db_editor.graphics_items¶
Classes for drawing graphics items on graph view’s QGraphicsScene.
| authors: |
|
|---|---|
| date: | 4.4.2018 |
Module Contents¶
Classes¶
EntityItem |
Base class for ObjectItem and RelationshipItem. |
RelationshipItem |
Represents a relationship in the Entity graph. |
ObjectItem |
Represents an object in the Entity graph. |
ArcItem |
Connects a RelationshipItem to an ObjectItem. |
CrossHairsItem |
Creates new relationships directly in the graph. |
CrossHairsRelationshipItem |
Represents the relationship that’s being created using the CrossHairsItem. |
CrossHairsArcItem |
Connects a CrossHairsRelationshipItem with the CrossHairsItem, |
ObjectLabelItem |
Provides a label for ObjectItem’s. |
Functions¶
make_figure_graphics_item(scene, z=0, static=True) |
Creates a FigureCanvas and adds it to the given scene. |
-
spinetoolbox.spine_db_editor.graphics_items.make_figure_graphics_item(scene, z=0, static=True)[source]¶ Creates a FigureCanvas and adds it to the given scene. Used for creating heatmaps and associated colorbars.
Parameters: - scene (QGraphicsScene) –
- z (int, optional) – z value. Defaults to 0.
- static (bool, optional) – if True (the default) the figure canvas is not movable
Returns: the graphics item that represents the canvas Figure: the figure in the canvas
Return type: QGraphicsProxyWidget
-
class
spinetoolbox.spine_db_editor.graphics_items.EntityItem(spine_db_editor, x, y, extent, entity_id=None)[source]¶ Bases:
PySide2.QtWidgets.QGraphicsPixmapItemBase class for ObjectItem and RelationshipItem.
Initializes item
Parameters: - spine_db_editor (SpineDBEditor) – ‘owner’
- x (float) – x-coordinate of central point
- y (float) – y-coordinate of central point
- extent (int) – Preferred extent
- entity_id (int) – The entity id
-
shape(self)[source]¶ Returns a shape containing the entire bounding rect, to work better with icon transparency.
-
add_arc_item(self, arc_item)[source]¶ Adds an item to the list of arcs.
Parameters: arc_item (ArcItem) –
-
apply_rotation(self, angle, center)[source]¶ Applies rotation.
Parameters: - angle (float) – The angle in degrees.
- center (QPoint) – Rotates around this point.
-
mouseMoveEvent(self, event)[source]¶ Moves the item and all connected arcs. Also checks for a merge target and sets an appropriate mouse cursor.
Parameters: event (QGraphicsSceneMouseEvent) –
-
itemChange(self, change, value)[source]¶ 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: the same value given as input
-
set_all_visible(self, on)[source]¶ Sets visibility status for this item and all arc items.
Parameters: on (bool) –
-
class
spinetoolbox.spine_db_editor.graphics_items.RelationshipItem(spine_db_editor, x, y, extent, entity_id=None)[source]¶ Bases:
spinetoolbox.spine_db_editor.graphics_items.EntityItemRepresents a relationship in the Entity graph.
Initializes the item.
Parameters: - spine_db_editor (GraphViewForm) – ‘owner’
- x (float) – x-coordinate of central point
- y (float) – y-coordinate of central point
- extent (int) – preferred extent
- entity_id (int) – object id
-
class
spinetoolbox.spine_db_editor.graphics_items.ObjectItem(spine_db_editor, x, y, extent, entity_id=None)[source]¶ Bases:
spinetoolbox.spine_db_editor.graphics_items.EntityItemRepresents an object in the Entity graph.
Initializes the item.
Parameters: - spine_db_editor (GraphViewForm) – ‘owner’
- x (float) – x-coordinate of central point
- y (float) – y-coordinate of central point
- extent (int) – preferred extent
- entity_id (int) – object id
-
shape(self)[source]¶ Returns a shape containing the entire bounding rect, to work better with icon transparency.
Populates the ‘Add relationships’ menu.
-
class
spinetoolbox.spine_db_editor.graphics_items.ArcItem(rel_item, obj_item, width)[source]¶ Bases:
PySide2.QtWidgets.QGraphicsPathItemConnects a RelationshipItem to an ObjectItem.
Initializes item.
Parameters: - rel_item (spinetoolbox.widgets.graph_view_graphics_items.RelationshipItem) – relationship item
- obj_item (spinetoolbox.widgets.graph_view_graphics_items.ObjectItem) – object item
- width (float) – Preferred line width
-
class
spinetoolbox.spine_db_editor.graphics_items.CrossHairsItem(spine_db_editor, x, y, extent)[source]¶ Bases:
spinetoolbox.spine_db_editor.graphics_items.RelationshipItemCreates new relationships directly in the graph.
Initializes the item.
Parameters: - spine_db_editor (GraphViewForm) – ‘owner’
- x (float) – x-coordinate of central point
- y (float) – y-coordinate of central point
- extent (int) – preferred extent
- entity_id (int) – object id
-
class
spinetoolbox.spine_db_editor.graphics_items.CrossHairsRelationshipItem(*args, **kwargs)[source]¶ Bases:
spinetoolbox.spine_db_editor.graphics_items.RelationshipItemRepresents the relationship that’s being created using the CrossHairsItem.
Initializes the item.
Parameters: - spine_db_editor (GraphViewForm) – ‘owner’
- x (float) – x-coordinate of central point
- y (float) – y-coordinate of central point
- extent (int) – preferred extent
- entity_id (int) – object id
-
class
spinetoolbox.spine_db_editor.graphics_items.CrossHairsArcItem(rel_item, obj_item, width)[source]¶ Bases:
spinetoolbox.spine_db_editor.graphics_items.ArcItemConnects a CrossHairsRelationshipItem with the CrossHairsItem, and with all the ObjectItem’s in the relationship so far.
Initializes item.
Parameters: - rel_item (spinetoolbox.widgets.graph_view_graphics_items.RelationshipItem) – relationship item
- obj_item (spinetoolbox.widgets.graph_view_graphics_items.ObjectItem) – object item
- width (float) – Preferred line width