widgets.tree_view_widget

Contains the TreeViewForm class.

author:
  1. Marin (KTH)
date:

26.11.2018

Module Contents

class widgets.tree_view_widget.TreeViewForm(project, db_maps)[source]

Bases: widgets.data_store_widget.DataStoreForm

A widget to show and edit Spine objects in a data store.

project

The project instance that owns this form

Type:SpineToolboxProject
db_maps

named DiffDatabaseMapping instances

Type:dict
object_class_selection_available[source]
object_selection_available[source]
relationship_class_selection_available[source]
relationship_selection_available[source]
object_tree_selection_available[source]
relationship_tree_selection_available[source]
obj_parameter_definition_selection_available[source]
obj_parameter_value_selection_available[source]
rel_parameter_definition_selection_available[source]
rel_parameter_value_selection_available[source]
parameter_value_list_selection_available[source]
add_toggle_view_actions(self)[source]

Add toggle view actions to View menu.

connect_signals(self)[source]

Connect signals to slots.

restore_dock_widgets(self)[source]

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

update_copy_and_remove_actions(self)[source]

Update copy and remove actions according to selections across the widgets.

_handle_object_tree_selection_available(self, on)[source]
_handle_relationship_tree_selection_available(self, on)[source]
_handle_obj_parameter_definition_selection_available(self, on)[source]
_handle_obj_parameter_value_selection_available(self, on)[source]
_handle_rel_parameter_definition_selection_available(self, on)[source]
_handle_rel_parameter_value_selection_available(self, on)[source]
_handle_parameter_value_list_selection_available(self, on)[source]
update_paste_action(self, old, new)[source]
copy(self, checked=False)[source]

Copy data to clipboard.

paste(self, checked=False)[source]

Paste data from clipboard.

remove_selection(self, checked=False)[source]

Remove selection of items.

_handle_object_parameter_definition_selection_changed(self, selected, deselected)[source]

Enable/disable the option to remove rows.

_handle_object_parameter_value_selection_changed(self, selected, deselected)[source]

Enable/disable the option to remove rows.

_handle_relationship_parameter_definition_selection_changed(self, selected, deselected)[source]

Enable/disable the option to remove rows.

_handle_relationship_parameter_value_selection_changed(self, selected, deselected)[source]

Enable/disable the option to remove rows.

_handle_parameter_value_list_selection_changed(self, selected, deselected)[source]

Enable/disable the option to remove rows.

_handle_object_parameter_tab_changed(self, index)[source]

Update filter.

_handle_relationship_parameter_tab_changed(self, index)[source]

Update filter.

show_import_file_dialog(self, checked=False)[source]

Show dialog to allow user to select a file to import.

import_file(self, file_path, checked=False)[source]

Import data from file into current database.

export_database(self, checked=False)[source]

Exports a database to a file.

_select_database(self)[source]

Lets user select a database from available databases.

Shows a dialog from which user can select a single database. If there is only a single database it is selected automatically and no dialog is shown.

Returns:the database map of the database or None if no database was selected
export_to_excel(self, db_map, file_path)[source]

Export data from database into Excel file.

export_to_sqlite(self, db_map, file_path)[source]

Export data from database into SQlite file.

init_models(self)[source]

Initialize models.

init_object_tree_model(self)[source]

Initialize object tree model.

init_relationship_tree_model(self)[source]

Initialize relationship tree model.

find_next_leaf(self, index)[source]

If object tree index corresponds to a relationship, then expand the next ocurrence of it.

find_next(self, index)[source]

Expand next occurrence of a relationship in object tree.

clear_other_selections(self, *skip_widgets)[source]

Clear selections in all widgets except skip_widgets.

_handle_object_tree_selection_changed(self, selected, deselected)[source]

Called when the object tree selection changes. Set default rows and apply filters on parameter models.

_handle_relationship_tree_selection_changed(self, selected, deselected)[source]

Called when the relationship tree selection changes. Set default rows and apply filters on parameter models.

update_filter(self)[source]

Update filters on parameter models according to selected and deselected object tree indexes.

show_object_tree_context_menu(self, pos)[source]

Context menu for object tree.

Parameters:pos (QPoint) – Mouse position
show_relationship_tree_context_menu(self, pos)[source]

Context menu for relationship tree.

Parameters:pos (QPoint) – Mouse position
fully_expand_selection(self)[source]
fully_collapse_selection(self)[source]
call_show_add_objects_form(self, index)[source]
call_show_add_relationship_classes_form(self, index)[source]
call_show_add_relationships_form(self, index)[source]
add_object_classes(self, object_class_d)[source]

Insert new object classes.

add_relationship_classes_to_models(self, db_map, added)[source]
add_relationships_to_models(self, db_map, added)[source]
edit_object_tree_items(self)[source]

Called when F2 is pressed while the object tree has focus. Call the appropriate method to show the edit form, depending on the current index.

edit_relationship_tree_items(self)[source]

Called when F2 is pressed while the relationship tree has focus. Call the appropriate method to show the edit form, depending on the current index.

update_object_classes_in_models(self, db_map, updated)[source]
update_objects_in_models(self, db_map, updated)[source]
update_relationship_classes_in_models(self, db_map, updated)[source]
update_relationships_in_models(self, db_map, updated)[source]
show_remove_object_tree_items_form(self)[source]

Show form to remove items from object treeview.

show_remove_relationship_tree_items_form(self)[source]

Show form to remove items from relationship treeview.

remove_tree_items(self, item_d)[source]

Remove items from tree views.

show_object_parameter_value_context_menu(self, pos)[source]

Context menu for object parameter value table view.

Parameters:pos (QPoint) – Mouse position
show_relationship_parameter_value_context_menu(self, pos)[source]

Context menu for relationship parameter value table view.

Parameters:pos (QPoint) – Mouse position
show_object_parameter_context_menu(self, pos)[source]

Context menu for object parameter table view.

Parameters:pos (QPoint) – Mouse position
show_relationship_parameter_context_menu(self, pos)[source]

Context menu for relationship parameter table view.

Parameters:pos (QPoint) – Mouse position
_show_parameter_context_menu(self, position, table_view, value_column_header, remove_selection)[source]

Show a context menu for parameter tables.

Parameters:
  • position (QPoint) – local mouse position in the table view
  • table_view (QTableView) – the table view where the context menu was triggered
  • value_column_header (str) – column header for editable/plottable values
show_parameter_value_list_context_menu(self, pos)[source]

Context menu for relationship parameter table view.

Parameters:pos (QPoint) – Mouse position
remove_object_parameter_values(self)[source]

Remove selected rows from object parameter value table.

remove_relationship_parameter_values(self)[source]

Remove selected rows from relationship parameter value table.

_remove_parameter_values(self, table_view)[source]

Remove selected rows from parameter value table.

Parameters:table_view (QTableView) – a table view from which to remove
remove_object_parameter_definitions(self)[source]

Remove selected rows from object parameter definition table.

remove_relationship_parameter_definitions(self)[source]

Remove selected rows from relationship parameter definition table.

_remove_parameter_definitions(self, table_view, value_model, class_id_header)[source]

Remove selected rows from parameter table.

Parameters:
  • table_view (QTableView) – the table widget from which to remove
  • value_model (QAbstractTableModel) – a value model corresponding to the definition model of table_view
  • class_id_header (str) – header of the class id column
remove_parameter_value_lists(self)[source]

Remove selection of parameter value_lists.