widgets.graph_view_widget

Contains the TreeViewForm class.

author:
  1. Marin (KTH)
date:

26.11.2018

Module Contents

class widgets.graph_view_widget.GraphViewForm(project, db_maps, read_only=False)[source]

Bases: widgets.data_store_widget.DataStoreForm

A widget to show the graph view.

project

The project instance that owns this form

Type:SpineToolboxProject
db_maps

named DiffDatabaseMapping instances

Type:dict
read_only

Whether or not the form should be editable

Type:bool
show(self)[source]

Show usage message together with the form.

init_models(self)[source]

Initialize models.

init_parameter_value_models(self)[source]

Initialize parameter value models from source database.

init_parameter_definition_models(self)[source]

Initialize parameter (definition) models from source database.

setup_zoom_action(self)[source]

Setup zoom action in view menu.

create_add_more_actions(self)[source]

Create and ‘Add more’ action and button for the Item Palette views.

connect_signals(self)[source]

Connect signals.

restore_dock_widgets(self)[source]

Dock all floating and or hidden QDockWidgets back to the window at ‘factory’ positions.

_handle_zoom_widget_minus_pressed(self)[source]
_handle_zoom_widget_plus_pressed(self)[source]
_handle_zoom_widget_reset_pressed(self)[source]
_handle_zoom_widget_action_hovered(self)[source]

Called when the zoom widget action is hovered. Hide the ‘Dock widgets’ submenu in case it’s being shown. This is the default behavior for hovering ‘normal’ ‘QAction’s, but for some reason it’s not the case for hovering ‘QWidgetAction’s.

_handle_menu_about_to_show(self)[source]

Called when a menu from the menubar is about to show.

_handle_item_palette_dock_location_changed(self, area)[source]

Called when the item palette dock widget location changes. Adjust splitter orientation accordingly.

add_toggle_view_actions(self)[source]

Add toggle view actions to View menu.

init_commit_rollback_actions(self)[source]
build_graph(self, checked=True)[source]

Initialize graph data and build graph.

_handle_object_tree_selection_changed(self, selected, deselected)[source]

Build_graph.

init_graph_data(self)[source]

Initialize graph data.

static shortest_path_matrix(object_name_list, src_ind_list, dst_ind_list, spread)[source]

Return the shortest-path matrix.

static sets(N)[source]

Return sets of vertex pairs indices.

static vertex_coordinates(matrix, heavy_positions=None, iterations=10, weight_exp=-2, initial_diameter=1000)[source]

Return x and y coordinates for each vertex in the graph, computed using VSGD-MS.

make_graph(self)[source]

Make graph.

new_scene(self)[source]

A new scene with a background.

extend_scene(self)[source]

Make scene rect the size of the scene show all items.

_handle_scene_selection_changed(self)[source]

Show parameters for selected items.

_handle_scene_changed(self, region)[source]

Handle scene changed. Show usage message if no items other than the bg.

show_usage_msg(self)[source]

Show usage instructions in new scene.

_handle_item_dropped(self, pos, text)[source]
relationship_items(self, object_name_list, object_class_name_list, extent, spread, label_color, object_class_id_list=None, relationship_class_id=None)[source]

Lists of object and arc items that form a relationship.

add_relationship_template(self, scene, x, y, object_items, arc_items, dimension_at_origin=None)[source]

Add relationship parts into the scene to form a ‘relationship template’.

add_object(self, object_item, name)[source]

Try and add object given an object item and a name.

update_object(self, object_item, name)[source]

Try and update object given an object item and a name.

add_relationship(self, template_id, object_items)[source]

Try and add relationship given a template id and a list of object items.

add_object_classses_to_models(self, db_map, added)[source]
add_relationship_classes_to_models(self, db_map, added)[source]

Insert new relationship classes.

show_graph_view_context_menu(self, global_pos)[source]

Show context menu for graphics view.

hide_selected_items(self, checked=False)[source]

Hide selected items.

show_hidden_items(self, checked=False)[source]

Show hidden items.

prune_selected_items(self, checked=False)[source]

Prune selected items.

reinstate_pruned_items(self, checked=False)[source]

Reinstate pruned items.

show_object_item_context_menu(self, e, main_item)[source]

Show context menu for object_item.

show_object_parameter_value_context_menu(self, pos)[source]
show_object_parameter_definition_context_menu(self, pos)[source]
show_relationship_parameter_value_context_menu(self, pos)[source]
show_relationship_parameter_definition_context_menu(self, pos)[source]
_show_table_context_menu(self, position, table_view, column_name)[source]
remove_graph_items(self, checked=False)[source]

Remove all selected items in the graph.

closeEvent(self, event=None)[source]

Handle close window.

Parameters:event (QEvent) – Closing event if ‘X’ is clicked.