spinetoolbox.spine_db_editor.widgets.tabular_view_mixin

Contains TabularViewMixin class.

Module Contents

Classes

TabularViewMixin

Provides the pivot table and its frozen table for the Database editor.

class spinetoolbox.spine_db_editor.widgets.tabular_view_mixin.TabularViewMixin(*args, **kwargs)[source]

Provides the pivot table and its frozen table for the Database editor.

property current_dimension_id_list[source]
property first_current_entity_class[source]
property current_dimension_name_list[source]
property current_dimension_ids[source]
_PARAMETER_VALUE = '&Value'[source]
_INDEX_EXPANSION = '&Index'[source]
_ELEMENT = 'E&lement'[source]
_SCENARIO_ALTERNATIVE = '&Scenario'[source]
_PARAMETER = 'parameter'[source]
_ALTERNATIVE = 'alternative'[source]
_INDEX = 'index'[source]
populate_pivot_action_group()[source]
connect_signals()[source]

Connects signals to slots.

refresh_views()[source]
update_filter_menus(action)[source]
_needs_to_update_headers(item_type, db_map_data)[source]
_reload_pivot_table_if_needed(item_type, db_map_data)[source]
_connect_pivot_table_header_signals()[source]

Connects signals of pivot table’s header views.

init_models()[source]

Initializes models.

_set_model_data(index, value)[source]
static _is_class_index(index)[source]

Returns whether the given tree index is a class index.

Parameters

index (QModelIndex) – index from object or relationship tree

Returns

bool

_handle_pivot_action_triggered(action)[source]
_handle_pivot_table_visibility_changed(visible)[source]
_handle_entity_tree_selection_changed_in_pivot_table(selected_indexes)[source]
_update_class_attributes(current_index)[source]

Updates current class id and name.

static _get_current_class_item(current_index)[source]
get_pivot_preferences()[source]

Returns saved pivot preferences.

Returns

pivot tuple, or None if no preference stored

Return type

tuple, NoneType

do_reload_pivot_table()[source]

Reloads pivot table.

_can_build_pivot_table()[source]
clear_pivot_table()[source]
wipe_out_headers()[source]
make_pivot_headers()[source]

Turns top left indexes in the pivot table into TabularViewHeaderWidget.

_resize_pivot_header_columns()[source]
_make_inserted_frozen_headers(parent_index, first_column, last_column)[source]

Turns the first row of columns in the frozen table into TabularViewHeaderWidgets.

Parameters
  • parent_index (QModelIndex) – frozen table column’s parent index

  • first_column (int) – first inserted column

  • last_column (int) – last inserted column

_make_all_frozen_headers()[source]

Turns the first row of columns in the frozen table into TabularViewHeaderWidgets.

_make_frozen_headers(first_column, last_column)[source]
_check_frozen_value_selected(parent, first_row, last_row)[source]

Ensures that at least one row is selected in frozen table when number of rows change.

create_filter_menu(identifier)[source]

Returns a filter menu for given filterable item.

Parameters

identifier (str) – item identifier

Returns

filter menu corresponding to identifier

Return type

TabularViewDBItemFilterMenu

create_header_widget(identifier, area, with_menu=True)[source]

Returns a TabularViewHeaderWidget for given object_class identifier.

Parameters
  • identifier (str) –

  • area (str) –

  • with_menu (bool) –

Returns

TabularViewHeaderWidget

static _get_insert_index(pivot_list, catcher, position)[source]

Returns an index for inserting a new element in the given pivot list.

Returns

int

handle_header_dropped(dropped, catcher, position='')[source]

Updates pivots when a header is dropped.

Parameters
_change_selected_frozen_row(current, previous)[source]

Sets the frozen value from selection in frozen table.

_update_current_index_if_need()[source]

Ensures selected frozen row corresponds to current index.

Frozen table gets sorted from time to time possibly changing the selected row.

change_filter(identifier, valid_values, has_filter)[source]
_add_values_to_frozen_table(frozen_values)[source]

Adds values to frozen table.

Parameters

frozen_values (set of tuple) – values to add

_remove_values_from_frozen_table(frozen_values)[source]

Removes values from frozen table.

Parameters

frozen_values (set of tuple) – values to remove

reload_frozen_table()[source]

Resets the frozen model according to new selection in entity trees.

find_frozen_values(frozen)[source]

Returns a list of tuples containing unique values for the frozen indexes.

Parameters

frozen (tuple) – A tuple of currently frozen indexes

Returns

frozen value

Return type

list

_change_frozen_value()[source]

Updated frozen value according to selected row in Frozen table.

receive_session_rolled_back(db_maps)[source]

Reacts to session rolled back event.

accepts_entity_class_item(item, db_map)[source]
accepts_entity_item(item, db_map)[source]
accepts_parameter_item(item, db_map)[source]
accepts_element_item(item, db_map)[source]
accepts_ith_element_item(i, item, db_map)[source]
_frozen_table_reload_disabled()[source]
closeEvent(event)[source]