spinetoolbox.import_editor.commands¶
Contains undo and redo commands for Import editor.
| author: |
|
|---|---|
| date: | 4.8.2020 |
Module Contents¶
Classes¶
_Id |
Enum where members are also (and must be) ints |
PasteMappings |
Command to paste copied mappings |
PasteOptions |
Command to paste copied mapping options. |
SetTableChecked |
Command to change a source table’s checked state. |
RenameMapping |
A command to change the name of a mapping. |
SetComponentMappingType |
Sets the type of a component mapping. |
SetComponentMappingReference |
Sets the reference for a component mapping. |
SetConnectorOption |
Command to set a ConnectorManager option. |
CreateMapping |
Creates a new mapping. |
DeleteMapping |
Command to delete a mapping. |
SetItemMappingType |
Command to change item mapping’s type. |
SetImportObjectsFlag |
Command to set item mapping’s import objects flag. |
SetParameterType |
Command to change the parameter type of an item mapping. |
SetReadStartRow |
Command to change item mapping’s read start row option. |
SetItemMappingDimension |
Command to change item mapping’s dimension option. |
SetTimeSeriesRepeatFlag |
Command to change the repeat flag for time series. |
SetMapDimensions |
Command to change the dimensions of a Map parameter value type. |
SetMapCompressFlag |
Command to change the Map compress flag. |
SetColumnOrRowType |
Command to change the type of columns or rows. |
RestoreMappingsFromDict |
Restores mappings from a dict. |
-
class
spinetoolbox.import_editor.commands._Id[source]¶ Bases:
enum.IntEnumEnum where members are also (and must be) ints
Initialize self. See help(type(self)) for accurate signature.
-
class
spinetoolbox.import_editor.commands.PasteMappings(import_editor, source_table_name, copied_mappings, previous_mappings)[source]¶ Bases:
PySide2.QtWidgets.QUndoCommandCommand to paste copied mappings
Parameters: - import_editor (ImportEditor) – import editor
- source_table_name (src) – name of the target source table
- copied_mappings (Iterable) – mappings to paste
- previous_mappings (Iterable) – mappings before pasting
-
class
spinetoolbox.import_editor.commands.PasteOptions(import_editor, source_table_name, copied_options, previous_options)[source]¶ Bases:
PySide2.QtWidgets.QUndoCommandCommand to paste copied mapping options.
Parameters: - import_editor (ImportEditor) – import editor
- source_table_name (src) – name of the target source table
- copied_options (dict) – options from the internal clipboard
- previous_options (dict) – previous options
-
class
spinetoolbox.import_editor.commands.SetTableChecked(table_name, table_list_model, row, checked)[source]¶ Bases:
PySide2.QtWidgets.QUndoCommandCommand to change a source table’s checked state.
Parameters: - table_name (str) – source table name
- table_list_model (SourceTableListModel) – source table model
- row (int) – table row on the list
- checked (bool) – new checked state
-
class
spinetoolbox.import_editor.commands.RenameMapping(row, mapping_list_model, name, previous_name)[source]¶ Bases:
PySide2.QtWidgets.QUndoCommandA command to change the name of a mapping.
Parameters: - mapping_list_model (MappingListModel) – model holding the mapping names
- name (str) – new name
- previous_name (str) – original name
-
class
spinetoolbox.import_editor.commands.SetComponentMappingType(component_display_name, mapping_specification_model, mapping_type, previous_type, previous_reference)[source]¶ Bases:
PySide2.QtWidgets.QUndoCommandSets the type of a component mapping.
Parameters: - component_display_name (str) – component name on the mapping specification table
- mapping_specification_model (MappingSpecificationModel) – specification model
- mapping_type (str) – name of the new type
- previous_type (str) – name of the original type
- previous_reference (str or int) – original mapping’s reference
-
class
spinetoolbox.import_editor.commands.SetComponentMappingReference(component_display_name, mapping_specification_model, reference, previous_reference, previous_mapping_type_was_none)[source]¶ Bases:
PySide2.QtWidgets.QUndoCommandSets the reference for a component mapping.
Parameters: - component_display_name (str) – component name on the mapping specification table
- mapping_specification_model (MappingSpecificationModel) – specification model
- reference (str or int) – new value for the reference
- previous_reference (str or int) – preference’s original value
- previous_mapping_type_was_none (bool) – True if the mapping was originally a
NoneMapping
-
class
spinetoolbox.import_editor.commands.SetConnectorOption(source_table, option_key, options_widget, value, previous_value)[source]¶ Bases:
PySide2.QtWidgets.QUndoCommandCommand to set a
ConnectorManageroption.Parameters: - source_table (str) – source table name
- option_key (str) – option’s key
- options_widget (OptionsWidget) – connector options widget
- value (str or int or bool) – option’s new value
- previous_value (str or int or bool) – option’s previous value
-
mergeWith(self, command)[source]¶ Merges command with another
SetConnectorOption.Parameters: command (QUndoCommand) – a command to merge with Returns: True if merge was successful, False otherwise Return type: bool
-
class
spinetoolbox.import_editor.commands.CreateMapping(source_table_name, import_mappings, row)[source]¶ Bases:
PySide2.QtWidgets.QUndoCommandCreates a new mapping.
Parameters: - source_table_name (src) – source table name
- import_mappings (ImportMappings) – mappings manager
- row (int) – row where the new mapping should be created
-
class
spinetoolbox.import_editor.commands.DeleteMapping(source_table_name, import_mappings, mapping_name, row)[source]¶ Bases:
PySide2.QtWidgets.QUndoCommandCommand to delete a mapping.
Parameters: - source_table_name (src) – source table name
- import_mappings (ImportMappings) – mappings manager
- mapping_name (str) – name of the mapping to delete
- row (int) – mapping’s row in the mapping list
-
class
spinetoolbox.import_editor.commands.SetItemMappingType(source_table_name, mapping_specification_name, options_widget, new_type, previous_mapping)[source]¶ Bases:
PySide2.QtWidgets.QUndoCommandCommand to change item mapping’s type.
Parameters: - source_table_name (src) – name of the source table
- mapping_specification_name (str) – name of the mapping
- options_widget (ImportMappingOptions) – options widget
- new_type (str) – name of the new mapping type
- previous_mapping (ItemMappingBase) – the previous mapping
-
class
spinetoolbox.import_editor.commands.SetImportObjectsFlag(source_table_name, mapping_specification_name, options_widget, import_objects)[source]¶ Bases:
PySide2.QtWidgets.QUndoCommandCommand to set item mapping’s import objects flag.
Parameters: - source_table_name (str) – name of the source table
- mapping_specification_name (str) – name of the mapping specification
- options_widget (ImportMappingOptions) – options widget
- import_objects (bool) – new flag value
-
class
spinetoolbox.import_editor.commands.SetParameterType(source_table_name, mapping_specification_name, options_widget, new_type, previous_parameter)[source]¶ Bases:
PySide2.QtWidgets.QUndoCommandCommand to change the parameter type of an item mapping.
Parameters: - source_table_name (str) – name of the source table
- mapping_specification_name (str) – name of the mapping specification
- options_widget (ImportMappingOptions) – options widget
- new_type (str) – name of the new parameter type
- previous_parameter (ParameterDefinitionMapping) – previous parameter mapping
-
class
spinetoolbox.import_editor.commands.SetReadStartRow(source_table_name, mapping_specification_name, options_widget, start_row, previous_start_row)[source]¶ Bases:
PySide2.QtWidgets.QUndoCommandCommand to change item mapping’s read start row option.
Parameters: - source_table_name (str) – name of the source table
- mapping_specification_name (str) – name of the mapping specification
- options_widget (ImportMappingOptions) – options widget
- start_row (int) – new read start row
- previous_start_row (int) – previous read start row value
-
class
spinetoolbox.import_editor.commands.SetItemMappingDimension(source_table_name, mapping_specification_name, options_widget, dimension, previous_dimension)[source]¶ Bases:
PySide2.QtWidgets.QUndoCommandCommand to change item mapping’s dimension option.
Parameters: - source_table_name (str) – name of the source table
- mapping_specification_name (str) – name of the mapping specification
- options_widget (ImportMappingOptions) – options widget
- dimension (int) – new dimension
- previous_dimension (int) – previous dimension
-
class
spinetoolbox.import_editor.commands.SetTimeSeriesRepeatFlag(source_table_name, mapping_specification_name, options_widget, repeat)[source]¶ Bases:
PySide2.QtWidgets.QUndoCommandCommand to change the repeat flag for time series.
Parameters: - source_table_name (str) – name of the source table
- mapping_specification_name (str) – name of the mapping specification
- options_widget (ImportMappingOptions) – options widget
- repeat (bool) – new repeat flag value
-
class
spinetoolbox.import_editor.commands.SetMapDimensions(source_table_name, mapping_specification_name, options_widget, dimensions, previous_dimensions)[source]¶ Bases:
PySide2.QtWidgets.QUndoCommandCommand to change the dimensions of a Map parameter value type.
Parameters: - source_table_name (str) – name of the source table
- mapping_specification_name (str) – name of the mapping specification
- options_widget (ImportMappingOptions) – options widget
- dimensions (int) – new dimensions
- previous_dimensions (int) – previous dimensions
-
class
spinetoolbox.import_editor.commands.SetMapCompressFlag(source_table_name, mapping_specification_name, options_widget, compress)[source]¶ Bases:
PySide2.QtWidgets.QUndoCommandCommand to change the Map compress flag.
Parameters: - source_table_name (str) – name of the source table
- mapping_specification_name (str) – name of the mapping specification
- options_widget (ImportMappingOptions) – options widget
- compress (bool) – compress flag value
-
class
spinetoolbox.import_editor.commands.SetColumnOrRowType(source_table_name, header_widget, sections, new_type, previous_type)[source]¶ Bases:
PySide2.QtWidgets.QUndoCommandCommand to change the type of columns or rows.
Parameters: - source_table_name (src) – name of the source table
- header_widget (HeaderWithButton) – widget of origin
- sections (Iterable of int) – row or column indexes
- new_type (ConvertSpec) – conversion specification for the rows/columns
- previous_type (ConvertSpec) – previous conversion specification for the rows/columns
-
class
spinetoolbox.import_editor.commands.RestoreMappingsFromDict(import_editor, mapping_dict)[source]¶ Bases:
PySide2.QtWidgets.QUndoCommandRestores mappings from a dict.
Parameters: - import_editor (ImportEditor) – import editor
- mapping_dict (dict) – mappings to