spinetoolbox.import_editor.mvcmodels.source_data_table_model

Contains the source data table model.

author:
  1. Vennström (VTT)
date:

1.6.2019

Module Contents

Classes

SourceDataTableModel A model for import mapping specification.
class spinetoolbox.import_editor.mvcmodels.source_data_table_model.SourceDataTableModel(parent=None)[source]

Bases: spinetoolbox.mvcmodels.minimal_table_model.MinimalTableModel

A model for import mapping specification.

Highlights columns, rows, and so on, depending on Mapping specification.

Table model for outlining simple tabular data.

Parameters:parent (QObject) – the parent object
column_types_updated[source]
row_types_updated[source]
mapping_changed[source]
about_to_undo[source]

Emitted when an undo/redo command is going to be executed.

mapping_specification(self)[source]
clear(self)[source]

Clear all data in model.

reset_model(self, main_data=None)[source]

Reset model.

set_mapping(self, mapping)[source]

Set mapping to display colors from

Parameters:mapping (MappingSpecificationModel) – mapping model
validate(self, section, orientation=Qt.Horizontal)[source]
get_type(self, section, orientation=Qt.Horizontal)[source]
get_types(self, orientation=Qt.Horizontal)[source]
set_type(self, section, section_type, orientation=Qt.Horizontal)[source]
set_types(self, sections, section_type, orientation)[source]
set_all_column_types(self, excluded_columns, column_type)[source]
_mapping_data_changed(self)[source]
update_colors(self)[source]
data_error(self, index, role=Qt.DisplayRole, orientation=Qt.Horizontal)[source]
data(self, index, role=Qt.DisplayRole)[source]

Returns the data stored under the given role for the item referred to by the index.

Parameters:
  • index (QModelIndex) – Index of item
  • role (int) – Data role
Returns:

Item data for given role.

data_color(self, index)[source]

Returns background color for index depending on mapping.

Parameters:index (PySide2.QtCore.QModelIndex) – index
Returns:color of index
Return type:QColor
index_in_mapping(self, mapping, index)[source]

Checks if index is in mapping

Parameters:
  • mapping (MappingBase) – mapping
  • index (QModelIndex) – index
Returns:

True if mapping is in index

Return type:

bool

mapping_column_ref_int_list(self)[source]

Returns a list of column indexes that are not pivoted

Returns:[List[int]] – list of ints