spinetoolbox.spine_db_editor.mvcmodels.pivot_table_models
¶
Provides pivot table models for the Tabular View.
- author
Vennström (VTT)
- date
1.11.2018
Module Contents¶
Classes¶
|
|
Base class for all ‘top left pivot headers’. |
|
A top left header for object_class. |
|
A top left header for parameter_definition. |
|
A top left header for parameter index. |
|
A top left header for alternative. |
|
A top left header for scenario. |
|
A top left header for database. |
|
A model for the pivot table in parameter_value input type. |
|
A model for the pivot table in parameter index expansion input type. |
|
A model for the pivot table in relationship input type. |
|
A model for the pivot table in scenario alternative input type. |
|
Initialize class. |
- class spinetoolbox.spine_db_editor.mvcmodels.pivot_table_models.PivotTableModelBase(parent)[source]¶
Bases:
PySide2.QtCore.QAbstractTableModel
- Parameters
parent (SpineDBEditor) –
- abstract call_reset_model(self, pivot=None)[source]¶
- Parameters
pivot (tuple, optional) – list of rows, list of columns, list of frozen indexes, frozen value
- update_model(self, data)[source]¶
Update model with new data, but doesn’t grow the model.
- Parameters
data (dict) –
- property plot_x_column(self)[source]¶
Returns the index of the column designated as Y values for plotting or None.
- rowCount(self, parent=QModelIndex())[source]¶
Number of rows in table, number of header rows + datarows + 1 empty row
- columnCount(self, parent=QModelIndex())[source]¶
Number of columns in table, number of header columns + datacolumns + 1 empty columns
- top_left_indexes(self)[source]¶
Returns indexes in the top left area.
- Returns
list(QModelIndex): top indexes (horizontal headers, associated to rows) list(QModelIndex): left indexes (vertical headers, associated to columns)
- index_in_top_left(self, index)[source]¶
Returns whether or not the given index is in top left corner, where pivot names are displayed
- index_in_column_headers(self, index)[source]¶
Returns whether or not the given index is in column headers (horizontal) area
- index_in_row_headers(self, index)[source]¶
Returns whether or not the given index is in row headers (vertical) area
- index_in_empty_column_headers(self, index)[source]¶
Returns whether or not the given index is in empty column headers (vertical) area
- index_in_empty_row_headers(self, index)[source]¶
Returns whether or not the given index is in empty row headers (vertical) area
- column_is_index_column(self, column)[source]¶
Returns True if column is the column containing expanded parameter_value indexes.
- map_to_pivot(self, index)[source]¶
Returns a tuple of row and column in the pivot model that corresponds to the given model index.
- Parameters
index (QModelIndex) –
- Returns
row int: column
- Return type
int
- top_left_id(self, index)[source]¶
Returns the id of the top left header corresponding to the given header index.
- Parameters
index (QModelIndex) –
- Returns
int, NoneType
- _header_id(self, index)[source]¶
Returns the id of the given row or column header index.
- Parameters
index (QModelIndex) –
- Returns
int, NoneType
- _header_ids(self, row, column)[source]¶
Returns the ids for the headers at given row and column.
- Parameters
row (int) –
column (int) –
- Returns
tuple(int)
- class spinetoolbox.spine_db_editor.mvcmodels.pivot_table_models.TopLeftHeaderItem(model)[source]¶
Base class for all ‘top left pivot headers’. Represents a header located in the top left area of the pivot table.
- Parameters
model (PivotTableModelBase) –
- class spinetoolbox.spine_db_editor.mvcmodels.pivot_table_models.TopLeftObjectHeaderItem(model, class_name, class_id)[source]¶
Bases:
TopLeftHeaderItem
A top left header for object_class.
- Parameters
model (PivotTableModelBase) –
- class spinetoolbox.spine_db_editor.mvcmodels.pivot_table_models.TopLeftParameterHeaderItem(model)[source]¶
Bases:
TopLeftHeaderItem
A top left header for parameter_definition.
- Parameters
model (PivotTableModelBase) –
- class spinetoolbox.spine_db_editor.mvcmodels.pivot_table_models.TopLeftParameterIndexHeaderItem(model)[source]¶
Bases:
TopLeftHeaderItem
A top left header for parameter index.
- Parameters
model (PivotTableModelBase) –
- class spinetoolbox.spine_db_editor.mvcmodels.pivot_table_models.TopLeftAlternativeHeaderItem(model)[source]¶
Bases:
TopLeftHeaderItem
A top left header for alternative.
- Parameters
model (PivotTableModelBase) –
- class spinetoolbox.spine_db_editor.mvcmodels.pivot_table_models.TopLeftScenarioHeaderItem(model)[source]¶
Bases:
TopLeftHeaderItem
A top left header for scenario.
- Parameters
model (PivotTableModelBase) –
- class spinetoolbox.spine_db_editor.mvcmodels.pivot_table_models.TopLeftDatabaseHeaderItem(model)[source]¶
Bases:
TopLeftHeaderItem
A top left header for database.
- Parameters
model (PivotTableModelBase) –
- class spinetoolbox.spine_db_editor.mvcmodels.pivot_table_models.ParameterValuePivotTableModel(parent)[source]¶
Bases:
PivotTableModelBase
A model for the pivot table in parameter_value input type.
- Parameters
parent (SpineDBEditor) –
- db_map_object_ids(self, index)[source]¶
Returns db_map and object ids for given index. Used by PivotTableView.
- Returns
DatabaseMapping, list
- _all_header_names(self, index)[source]¶
Returns the object, parameter, alternative, and db names corresponding to the given data index.
- Parameters
index (QModelIndex) –
- Returns
object names str: parameter name str: alternative name str: db name
- Return type
list(str)
- index_name(self, index)[source]¶
Returns a string that concatenates the object and parameter names corresponding to the given data index. Used by plotting and ParameterValueEditor.
- Parameters
index (QModelIndex) –
- Returns
str
- column_name(self, column)[source]¶
Returns a string that concatenates the object and parameter names corresponding to the given column. Used by plotting.
- Parameters
column (int) –
- Returns
str
- _batch_set_parameter_value_data(self, row_map, column_map, data, values)[source]¶
Sets parameter values in batch.
- class spinetoolbox.spine_db_editor.mvcmodels.pivot_table_models.IndexExpansionPivotTableModel(parent)[source]¶
Bases:
ParameterValuePivotTableModel
A model for the pivot table in parameter index expansion input type.
- Parameters
parent (SpineDBEditor) –
- class spinetoolbox.spine_db_editor.mvcmodels.pivot_table_models.RelationshipPivotTableModel(parent)[source]¶
Bases:
PivotTableModelBase
A model for the pivot table in relationship input type.
- Parameters
parent (SpineDBEditor) –
- class spinetoolbox.spine_db_editor.mvcmodels.pivot_table_models.ScenarioAlternativePivotTableModel(parent)[source]¶
Bases:
PivotTableModelBase
A model for the pivot table in scenario alternative input type.
- Parameters
parent (SpineDBEditor) –
- class spinetoolbox.spine_db_editor.mvcmodels.pivot_table_models.PivotTableSortFilterProxy(parent=None)[source]¶
Bases:
PySide2.QtCore.QSortFilterProxyModel
Initialize class.
- set_filter(self, identifier, filter_value)[source]¶
Sets filter for a given index (object_class) name.
- Parameters
identifier (int) – index identifier
filter_value (set, None) – A set of accepted values, or None if no filter (all pass)
- filterAcceptsRow(self, source_row, source_parent)[source]¶
Returns true if the item in the row indicated by the given source_row and source_parent should be included in the model; otherwise returns false.