spinetoolbox.spine_db_editor.widgets.graph_view_mixin

Contains the GraphViewMixin class.

Module Contents

Classes

GraphViewMixin

Provides the graph view for the DB editor.

_Offset

Functions

_min_value(pv)

_max_value(pv)

_get_value(pv, index)

_min_max(pvs)

_min_max_indexes(pvs)

spinetoolbox.spine_db_editor.widgets.graph_view_mixin._min_value(pv)[source]
spinetoolbox.spine_db_editor.widgets.graph_view_mixin._max_value(pv)[source]
spinetoolbox.spine_db_editor.widgets.graph_view_mixin._get_value(pv, index)[source]
spinetoolbox.spine_db_editor.widgets.graph_view_mixin._min_max(pvs)[source]
spinetoolbox.spine_db_editor.widgets.graph_view_mixin._min_max_indexes(pvs)[source]
class spinetoolbox.spine_db_editor.widgets.graph_view_mixin.GraphViewMixin(*args, **kwargs)[source]

Provides the graph view for the DB editor.

NOT_SPECIFIED[source]
_VERTEX_EXTENT = 64[source]
_ARC_WIDTH[source]
_ARC_LENGTH_HINT[source]
_update_time_line_index(index)[source]
_graph_fetch_more_later(entity=True, parameter_value=True)[source]
_graph_fetch_more(entity=True, parameter_value=True)[source]
_graph_fetch_more_parameter_value()[source]
_graph_fetch_more_entity()[source]
init_models()[source]
connect_signals()[source]

Connects signals.

_refresh_icons(item_type, db_map_data)[source]

Runs when entity classes are added or updated in the db. Refreshes icons of entities in graph.

Parameters

db_map_data (dict) – list of dictionary-items keyed by DiffDatabaseMapping instance.

_all_pruned_db_map_entity_ids()[source]
_accepts_entity_item(item, db_map)[source]
_graph_handle_entities_added(db_map_data)[source]

Runs when entities are added to the db. Adds the new entities to the graph if needed.

Parameters

db_map_data (dict) – list of dictionary-items keyed by DiffDatabaseMapping instance.

_graph_handle_entities_removed(db_map_data)[source]

Runs when entities are removed from the db. Rebuilds graph if needed.

Parameters

db_map_data (dict) – list of dictionary-items keyed by DiffDatabaseMapping instance.

_graph_handle_entities_updated(db_map_data)[source]

Runs when entities are updated in the db.

Parameters

db_map_data (dict) – list of dictionary-items keyed by DiffDatabaseMapping instance.

_db_map_ids_by_key(db_map_data)[source]
add_db_map_ids_to_items(db_map_data)[source]

Goes through entity items and adds the corresponding db_map ids. This could mean either restoring removed (db_map, id) tuples previously removed, or adding new (db_map, id) tuples.

Parameters

db_map_data (dict(DiffDatabaseMapping, list)) – List of added items keyed by db_map

Returns

tuples (db_map, id) that didn’t match any item in the view.

Return type

list

_graph_handle_parameter_values_added(db_map_data)[source]
polish_items()[source]
_update_property_pvs()[source]
_handle_entity_graph_visibility_changed(visible)[source]
_handle_entity_tree_selection_changed_in_graph(selected)[source]

Stores the given selection of entity tree indexes and builds graph.

expand_graph(db_map_entity_ids)[source]
collapse_graph(db_map_entity_ids)[source]
prune_graph(key, db_map_entity_ids)[source]
restore_graph(key=None)[source]
_get_db_map_graph_data()[source]
save_graph_data(name)[source]
overwrite_graph_data(db_map_graph_data)[source]
get_db_map_graph_data_by_name()[source]
load_graph_data(db_map_graph_data)[source]
remove_graph_data(name)[source]
rebuild_graph(_checked=False)[source]
build_graph(persistent=False)[source]

Builds graph from current selection of items.

Parameters

persistent (bool, optional) – If True, elements in the current graph (if any) retain their position in the new one.

_refresh_graph()[source]
_stop_layout_generators()[source]
_complete_graph(layout_gen_id, x, y)[source]
Parameters
  • layout_gen_id (object) –

  • x (list) – Horizontal coordinates

  • y (list) – Vertical coordinates

_update_selected_item_type_db_map_ids(selected_tree_inds)[source]

Upsates the dict mapping item type to db_map to selected ids.

_get_db_map_entities_for_graph()[source]
_update_graph_data()[source]

Updates data for graph according to selection in trees.

get_entity_key(db_map_entity_id)[source]
_update_entity_element_inds(db_map_element_id_lists)[source]
_get_pv(db_map, entity_id, pname)[source]
get_item_name(db_map, entity_id)[source]
get_item_color(db_map, entity_id, time_line_index)[source]
get_arc_width(db_map, entity_id, time_line_index)[source]
get_vertex_radius(db_map, entity_id, time_line_index)[source]
_get_item_property(db_map, entity_id, pname, time_line_index)[source]

Returns a tuple of (min_value, value, max_value) for given entity and property. Returns self.NOT_SPECIFIED if the property is not defined for the entity. Returns None if the property is not defined for any entity.

Returns

tuple or None

_get_fixed_pos(db_map, entity_id)[source]
_make_layout_generator()[source]

Returns a layout generator for the current graph.

Returns

GraphLayoutGeneratorRunnable

static convert_position(x, y)[source]
_get_entity_offset(db_map_entity_ids)[source]
_make_new_items(x, y)[source]

Makes new items for the graph.

Parameters
  • x (list) –

  • y (list) –

Returns

True if graph contains any items after the operation, False otherwise

Return type

bool

_add_new_items()[source]
start_connecting_entities(db_map, entity_class, ent_item)[source]

Starts connecting entites with the given entity item.

Parameters
  • db_map (DiffDatabaseMapping) –

  • entity_class (dict) –

  • ent_item (..graphics_items.EntityItem) –

finalize_connecting_entities(entity_class, *entity_items)[source]

Tries to add multi dimensional entity with the given entity items as elements.

Parameters
  • entity_class (dict) –

  • entity_items (..graphics_items.EntityItem) –

_do_finalize_connecting_entities(dialog, element_items)[source]
add_entities_at_position(pos)[source]
_do_add_entites_at_pos(dialog, x, y)[source]
_add_entities_from_dialog(dialog)[source]
get_save_file_path(group, caption, filters)[source]
get_open_file_path(group, caption, filters)[source]
closeEvent(event)[source]

Handle close window.

Parameters

event (QCloseEvent) – Closing event

class spinetoolbox.spine_db_editor.widgets.graph_view_mixin._Offset(all_offsets)[source]
value()[source]