spinetoolbox.spine_db_editor.widgets.custom_qtreeview

Classes for custom QTreeView.

author
  1. Marin (KTH)

date

25.4.2018

Module Contents

Classes

EntityTreeView

Tree view base class for object and relationship tree views.

ObjectTreeView

Custom QTreeView class for the object tree in SpineDBEditor.

RelationshipTreeView

Custom QTreeView class for the relationship tree in SpineDBEditor.

ItemTreeView

Base class for all non-entity tree views.

ToolFeatureTreeView

Custom QTreeView class for tools and features in SpineDBEditor.

AlternativeScenarioTreeView

Custom QTreeView class for the alternative scenario tree in SpineDBEditor.

ParameterValueListTreeView

Custom QTreeView class for parameter_value_list in SpineDBEditor.

ParameterTagTreeView

Custom QTreeView class for the parameter_tag tree in SpineDBEditor.

class spinetoolbox.spine_db_editor.widgets.custom_qtreeview.EntityTreeView(parent)[source]

Bases: spinetoolbox.widgets.custom_qtreeview.CopyTreeView

Tree view base class for object and relationship tree views.

Initialize the view.

tree_selection_changed[source]
connect_spine_db_editor(self, spine_db_editor)[source]

Connects a Spine db editor to work with this view.

Parameters

spine_db_editor (SpineDBEditor) –

_add_middle_actions(self)[source]

Adds action at the middle of the context menu. Subclasses can reimplement at will.

_create_context_menu(self)[source]

Creates a context menu for this view.

edit(self, index, trigger, event)[source]

Edit all selected items.

connect_signals(self)[source]

Connects signals.

rowsInserted(self, parent, start, end)[source]
rowsRemoved(self, parent, start, end)[source]
_resize_first_column_to_contents(self, _index=None)[source]
_handle_selection_changed(self, selected, deselected)[source]

Classifies selection by item type and emits signal.

_refresh_selected_indexes(self)[source]
clear_any_selections(self)[source]

Clears the selection if any.

fully_expand(self)[source]

Expands selected indexes and all their children.

fully_collapse(self)[source]

Collapses selected indexes and all their children.

export_selected(self)[source]

Exports data from selected indexes using the connected Spine db editor.

remove_selected(self)[source]

Removes selected indexes using the connected Spine db editor.

manage_relationships(self)[source]
show_entity_metadata(self)[source]

Shows entity’s metadata.

contextMenuEvent(self, event)[source]

Shows context menu.

Parameters

event (QContextMenuEvent) –

mousePressEvent(self, event)[source]

Overrides selection behaviour if the user has selected sticky selection in Settings. If sticky selection is enabled, multiple-selection is enabled when selecting items in the Object tree. Pressing the Ctrl-button down, enables single selection.

Parameters

event (QMouseEvent) –

_add_relationship_actions(self)[source]
update_actions_availability(self)[source]

Updates the visible property of actions according to whether or not they apply to given item.

edit_selected(self)[source]

Edits all selected indexes using the connected Spine db editor.

class spinetoolbox.spine_db_editor.widgets.custom_qtreeview.ObjectTreeView(parent)[source]

Bases: EntityTreeView

Custom QTreeView class for the object tree in SpineDBEditor.

Initialize the view.

update_actions_availability(self)[source]

Updates the visible property of actions according to whether or not they apply to given item.

_add_middle_actions(self)[source]

Adds action at the middle of the context menu. Subclasses can reimplement at will.

connect_signals(self)[source]

Connects signals.

add_object_classes(self)[source]
add_objects(self)[source]
add_relationship_classes(self)[source]
add_relationships(self)[source]
find_next_relationship(self)[source]

Finds the next occurrence of the relationship at the current index and expands it.

duplicate_object(self)[source]

Duplicates the object at the current index using the connected Spine db editor.

add_object_group(self)[source]
manage_members(self)[source]
class spinetoolbox.spine_db_editor.widgets.custom_qtreeview.RelationshipTreeView(parent)[source]

Bases: EntityTreeView

Custom QTreeView class for the relationship tree in SpineDBEditor.

Initialize the view.

_add_middle_actions(self)[source]

Adds action at the middle of the context menu. Subclasses can reimplement at will.

update_actions_availability(self)[source]

Updates the visible property of actions according to whether or not they apply to given item.

add_relationship_classes(self)[source]
add_relationships(self)[source]
class spinetoolbox.spine_db_editor.widgets.custom_qtreeview.ItemTreeView(parent)[source]

Bases: spinetoolbox.widgets.custom_qtreeview.CopyTreeView

Base class for all non-entity tree views.

Initialize the view.

connect_signals(self)[source]

Connects signals.

_resize_first_column_to_contents(self, _index=None)[source]
abstract remove_selected(self)[source]

Removes items selected in the view.

abstract update_actions_availability(self, item)[source]

Updates the visible property of actions according to whether or not they apply to given item.

connect_spine_db_editor(self, spine_db_editor)[source]
populate_context_menu(self)[source]

Creates a context menu for this view.

contextMenuEvent(self, event)[source]

Shows context menu.

Parameters

event (QContextMenuEvent) –

class spinetoolbox.spine_db_editor.widgets.custom_qtreeview.ToolFeatureTreeView(parent)[source]

Bases: ItemTreeView

Custom QTreeView class for tools and features in SpineDBEditor.

Initialize the view.

connect_spine_db_editor(self, spine_db_editor)[source]

see base class

remove_selected(self)[source]

See base class.

update_actions_availability(self, item)[source]

See base class.

dragMoveEvent(self, event)[source]
dragEnterEvent(self, event)[source]
class spinetoolbox.spine_db_editor.widgets.custom_qtreeview.AlternativeScenarioTreeView(parent)[source]

Bases: ItemTreeView

Custom QTreeView class for the alternative scenario tree in SpineDBEditor.

Initialize the view.

alternative_selection_changed[source]
connect_signals(self)[source]

Connects signals.

connect_spine_db_editor(self, spine_db_editor)[source]

see base class

_db_map_alt_ids_from_selection(self, selection)[source]
_db_map_scen_alt_ids_from_selection(self, selection)[source]
_handle_selection_changed(self, selected, deselected)[source]

Emits alternative_selection_changed with the current selection.

remove_selected(self)[source]

See base class.

update_actions_availability(self, item)[source]

See base class.

dragMoveEvent(self, event)[source]
dragEnterEvent(self, event)[source]
class spinetoolbox.spine_db_editor.widgets.custom_qtreeview.ParameterValueListTreeView(parent)[source]

Bases: ItemTreeView

Custom QTreeView class for parameter_value_list in SpineDBEditor.

Initialize the view.

connect_spine_db_editor(self, spine_db_editor)[source]

see base class

populate_context_menu(self)[source]

Creates a context menu for this view.

update_actions_availability(self, item)[source]

See base class.

open_in_editor(self)[source]

Opens the parameter_value editor for the first selected cell.

remove_selected(self)[source]

See base class.

class spinetoolbox.spine_db_editor.widgets.custom_qtreeview.ParameterTagTreeView(parent)[source]

Bases: ItemTreeView

Custom QTreeView class for the parameter_tag tree in SpineDBEditor.

Initialize the view.

tag_selection_changed[source]
connect_signals(self)[source]

Connects signals.

remove_selected(self)[source]

See base class.

update_actions_availability(self, item)[source]

See base class.

_handle_selection_changed(self, selected, deselected)[source]

Emits tag_selection_changed with the current selection.

_db_map_tag_ids_from_selection(self, selection)[source]