spinetoolbox.spine_db_editor.widgets.graph_view_mixin¶
Contains the GraphViewMixin class.
| author: |
|
|---|---|
| date: | 26.11.2018 |
Module Contents¶
Classes¶
GraphViewMixin |
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.
Initialize self. See help(type(self)) for accurate signature.
Adds toggle view actions to View menu.
-
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.
Enables or disables actions according to current selection in the graph.
-
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, builds the graph on top of the current one.
-
_complete_graph(self, x, y)[source]¶ Parameters: - 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) –
Shows hidden items.
-
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) –
-
finalize_relationship(self, relationship_class, *object_items)[source]¶ Tries to add relationships between the given object items.
Parameters: - relationship_class (dict) –
- object_items (.graphics_items.ObjectItem) –
Populates the menu ‘Add parameter heat map’ with parameters for currently shown items in the graph.