spinetoolbox.import_editor.mvcmodels.mapping_specification_model¶
Contains the mapping specification model.
| author: |
|
|---|---|
| date: | 1.6.2019 |
Module Contents¶
Classes¶
MappingSpecificationModel |
A model to hold a Mapping specification. |
Functions¶
_name_index(name) |
Parses an index from a string which ends with that number. |
-
class
spinetoolbox.import_editor.mvcmodels.mapping_specification_model.MappingSpecificationModel(table_name, mapping_name, mapping, undo_stack)[source]¶ Bases:
PySide2.QtCore.QAbstractTableModelA model to hold a Mapping specification.
Parameters: - table_name (str) – source table name
- mapping_name (str) – mapping name
- mapping (spinedb_api.ItemMappingBase) – the item mapping to model
- undo_stack (QUndoStack) – undo stack
-
row_or_column_type_recommendation_changed[source]¶ Emitted when a change in mapping prompts for change in column or row type.
-
multi_column_type_recommendation_changed[source]¶ Emitted when all but given columns should be of given type.
-
change_item_mapping_type(self, new_type)[source]¶ Change item mapping’s type.
Parameters: new_type (str) – name of the type
-
set_parameter_mapping(self, mapping)[source]¶ Changes the parameter mapping.
Parameters: mapping (ParameterDefinitionMapping) – new mapping
-
_mapping_issues(self, row)[source]¶ Returns a message string if given row contains issues, or an empty string if everything is OK.
-
change_component_mapping(self, component_name, type_name, reference)[source]¶ Pushes
SetComponentMappingTypeto the undo stack.Parameters: - component_name (str) – name of the component whose type to change
- type_name (str) – name of the new type
- reference (str or int) – component mapping reference
-
set_type(self, name, value)[source]¶ Changes the type of a component mapping.
Parameters: - name (str) – component name
- value (str) – mapping type name
-
set_value(self, name, value)[source]¶ Sets the reference for given mapping.
Parameters: - name (str) – name of the mapping
- value (str) – a new value
Returns: True if the reference was modified successfully, False otherwise.
Return type: bool
-
set_map_compress_flag(self, compress)[source]¶ Sets the compress flag for Map type parameters.
Parameters: compress (bool) – flag value
-
to_dict(self)[source]¶ Serializes the mapping specification into a dict.
Returns: serialized specification Return type: dict
-
static
from_dict(specification_dict, table_name, undo_stack)[source]¶ Restores a serialized mapping specification.
Parameters: - specification_dict (dict) – serialized specification model
- table_name (str) – source table name
- undo_stack (QUndoStack) – undo stack
Returns: mapping specification
Return type: