spinetoolbox.spine_db_editor.graphics_items
¶
Classes for drawing graphics items on graph view’s QGraphicsScene.
- authors
Marin (KTH), P. Savolainen (VTT)
- date
4.4.2018
Module Contents¶
Classes¶
Base class for ObjectItem and RelationshipItem. |
|
Represents a relationship in the Entity graph. |
|
Represents an object in the Entity graph. |
|
Connects a RelationshipItem to an ObjectItem. |
|
Creates new relationships directly in the graph. |
|
Represents the relationship that’s being created using the CrossHairsItem. |
|
Connects a CrossHairsRelationshipItem with the CrossHairsItem, |
|
Provides a label for ObjectItem’s. |
Functions¶
|
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, db_map_entity_id)[source]¶
Bases:
PySide2.QtWidgets.QGraphicsRectItem
Base class for ObjectItem and RelationshipItem.
- Parameters
spine_db_editor (SpineDBEditor) – ‘owner’
x (float) – x-coordinate of central point
y (float) – y-coordinate of central point
extent (int) – Preferred extent
db_map_entity_id (tuple) – db_map, 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 (QPointF) – Rotates around this point.
- mouseMoveEvent(self, event)[source]¶
Moves the item and all connected arcs.
- 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, db_map_entity_id)[source]¶
Bases:
EntityItem
Represents 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
db_map_entity_id (tuple) – db_map, relationship id
- class spinetoolbox.spine_db_editor.graphics_items.ObjectItem(spine_db_editor, x, y, extent, db_map_entity_id)[source]¶
Bases:
EntityItem
Represents 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
db_map_entity_id (tuple) – db_map, object id
- shape(self)[source]¶
Returns a shape containing the entire bounding rect, to work better with icon transparency.
Populates the ‘Expand’ or ‘Collapse’ menu.
- Parameters
menu (QMenu) –
Populates the ‘Add relationships’ menu.
- Parameters
menu (QMenu) –
- class spinetoolbox.spine_db_editor.graphics_items.ArcItem(rel_item, obj_item, width)[source]¶
Bases:
PySide2.QtWidgets.QGraphicsPathItem
Connects 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(*args, **kwargs)[source]¶
Bases:
RelationshipItem
Creates 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
db_map_entity_id (tuple) – db_map, relationship id
- class spinetoolbox.spine_db_editor.graphics_items.CrossHairsRelationshipItem(*args, **kwargs)[source]¶
Bases:
RelationshipItem
Represents 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
db_map_entity_id (tuple) – db_map, relationship id
- class spinetoolbox.spine_db_editor.graphics_items.CrossHairsArcItem(rel_item, obj_item, width)[source]¶
Bases:
ArcItem
Connects 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