spinetoolbox.spine_db_editor.widgets.graph_view_mixin
¶
Contains the GraphViewMixin class.
- author
Marin (KTH)
- date
26.11.2018
Module Contents¶
Classes¶
Provides the graph view for the DS form. |
- class spinetoolbox.spine_db_editor.widgets.graph_view_mixin.GraphViewMixin(*args, **kwargs)[source]¶
Provides the graph view for the DS form.
- receive_objects_added(self, db_map_data)[source]¶
Runs when objects are added to the db. Adds the new objects to the graph if needed.
- Parameters
db_map_data (dict) – list of dictionary-items keyed by DiffDatabaseMapping instance.
- receive_relationships_added(self, db_map_data)[source]¶
Runs when relationships are added to the db. Adds the new relationships to the graph if needed.
- Parameters
db_map_data (dict) – list of dictionary-items keyed by DiffDatabaseMapping instance.
- receive_objects_updated(self, db_map_data)[source]¶
Runs when objects are updated in the db. Refreshes names of objects in graph.
- Parameters
db_map_data (dict) – list of dictionary-items keyed by DiffDatabaseMapping instance.
- receive_objects_removed(self, db_map_data)[source]¶
Runs when objects are removed from the db. Rebuilds graph if needed.
- Parameters
db_map_data (dict) – list of dictionary-items keyed by DiffDatabaseMapping instance.
- receive_relationships_removed(self, db_map_data)[source]¶
Runs when relationships are removed from the db. Rebuilds graph if needed.
- Parameters
db_map_data (dict) – list of dictionary-items keyed by DiffDatabaseMapping instance.
- restore_removed_entities(self, added_ids)[source]¶
Restores any entities that have been previously removed and returns their ids. This happens in the context of undo/redo.
- Parameters
added_ids (set(int)) – Set of newly added ids.
- Returns
set(int)
- hide_removed_entities(self, db_map_data)[source]¶
Hides removed entities while saving them into a list attribute. This allows entities to be restored in case the user undoes the operation.
- refresh_icons(self, db_map_data)[source]¶
Runs when entity classes are updated in the db. Refreshes icons of entities in graph.
- Parameters
db_map_data (dict) – list of dictionary-items keyed by DiffDatabaseMapping instance.
- rebuild_graph(self, selected)[source]¶
Stores the given selection of entity tree indexes and builds graph.
- build_graph(self, persistent=False)[source]¶
Builds the graph.
- Parameters
persistent (bool, optional) – If True, elements in the current graph (if any) retain their position in the new one.
- _complete_graph(self, layout_gen_id, x, y)[source]¶
- Parameters
layout_gen_id (object) –
x (list) – Horizontal coordinates
y (list) – Vertical coordinates
- _get_selected_entity_ids(self)[source]¶
Returns a set of ids corresponding to selected entities in the trees.
- Returns
selected object ids set: selected relationship ids
- Return type
set
- _make_layout_generator(self)[source]¶
Returns a layout generator for the current graph.
- Returns
GraphLayoutGenerator
- _make_new_items(self, x, y)[source]¶
Returns new items for the graph.
- Parameters
x (list) –
y (list) –
- start_relationship(self, relationship_class, obj_item)[source]¶
Starts a relationship from the given object item.
- Parameters
relationship_class (dict) –
obj_item (.graphics_items.ObjectItem) –