spinetoolbox.spine_db_editor.widgets.tabular_view_mixin
Contains TabularViewMixin class.
Module Contents
Classes
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.
- 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
- get_pivot_preferences()[source]
Returns saved pivot preferences.
- Returns
pivot tuple, or None if no preference stored
- Return type
tuple, NoneType
- make_pivot_headers()[source]
Turns top left indexes in the pivot table into TabularViewHeaderWidget.
- _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.
- _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.
Returns a filter menu for given filterable item.
- Parameters
identifier (str) – item identifier
- Returns
filter menu corresponding to identifier
- Return type
- 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
dropped (TabularViewHeaderWidget) – drag source widget
catcher (TabularViewHeaderWidget or PivotTableHeaderView or FrozenTableView) – drop target widget
position (str) – either “before”, “after”, or “”
- _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.
- _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