spinetoolbox.spine_db_commands¶
QUndoCommand subclasses for modifying the db.
| authors: |
|
|---|---|
| date: | 31.1.2020 |
Module Contents¶
Classes¶
AgedUndoStack |
|||
AgedUndoCommand |
|
||
SpineDBCommand |
|
||
AddItemsCommand |
|
||
AddCheckedParameterValuesCommand |
|
||
UpdateItemsCommand |
|
||
UpdateCheckedParameterValuesCommand |
|
||
RemoveItemsCommand |
|
Functions¶
_cache_to_db_relationship_class(item) |
|
_cache_to_db_relationship(item) |
|
_cache_to_db_parameter_definition(item) |
|
_cache_to_db_parameter_value(item) |
|
_cache_to_db_parameter_value_list(item) |
|
_cache_to_db_item(item_type, item) |
|
_format_item(item_type, item) |
-
class
spinetoolbox.spine_db_commands.AgedUndoCommand(parent=None)[source]¶ Bases:
PySide2.QtWidgets.QUndoCommandParameters: parent (QUndoCommand, optional) – The parent command, used for defining macros.
-
class
spinetoolbox.spine_db_commands.SpineDBCommand(db_mngr, db_map, parent=None)[source]¶ Bases:
spinetoolbox.spine_db_commands.AgedUndoCommandParameters: - db_mngr (SpineDBManager) – SpineDBManager instance
- db_map (DiffDatabaseMapping) – DiffDatabaseMapping instance
- parent (QUndoCommand, optional) – The parent command, used for defining macros.
-
silence_listener(self, func)[source]¶ Calls given function while silencing the listener Spine db editors. This is so undo() and subsequent redo() calls don’t trigger the same notifications over and over.
-
static
redomethod(func)[source]¶ Returns a new redo method that determines if the command was completed. The command is completed if calling the function triggers the
completed_signal. Once the command is completed, we don’t listen to the signal anymore and we also silence the affected Spine db editors. If the signal is not received, then the command is declared obsolete.
-
class
spinetoolbox.spine_db_commands.AddItemsCommand(db_mngr, db_map, data, item_type, parent=None)[source]¶ Bases:
spinetoolbox.spine_db_commands.SpineDBCommandParameters: - db_mngr (SpineDBManager) – SpineDBManager instance
- db_map (DiffDatabaseMapping) – DiffDatabaseMapping instance
- data (list) – list of dict-items to add
- item_type (str) – the item type
- parent (QUndoCommand, optional) – The parent command, used for defining macros.
-
class
spinetoolbox.spine_db_commands.AddCheckedParameterValuesCommand(db_mngr, db_map, data, parent=None)[source]¶ Bases:
spinetoolbox.spine_db_commands.AddItemsCommandParameters: - db_mngr (SpineDBManager) – SpineDBManager instance
- db_map (DiffDatabaseMapping) – DiffDatabaseMapping instance
- data (list) – list of dict-items to add
- item_type (str) – the item type
- parent (QUndoCommand, optional) – The parent command, used for defining macros.
-
class
spinetoolbox.spine_db_commands.UpdateItemsCommand(db_mngr, db_map, data, item_type, parent=None)[source]¶ Bases:
spinetoolbox.spine_db_commands.SpineDBCommandParameters: - db_mngr (SpineDBManager) – SpineDBManager instance
- db_map (DiffDatabaseMapping) – DiffDatabaseMapping instance
- data (list) – list of dict-items to update
- item_type (str) – the item type
- parent (QUndoCommand, optional) – The parent command, used for defining macros.
-
class
spinetoolbox.spine_db_commands.UpdateCheckedParameterValuesCommand(db_mngr, db_map, data, parent=None)[source]¶ Bases:
spinetoolbox.spine_db_commands.UpdateItemsCommandParameters: - db_mngr (SpineDBManager) – SpineDBManager instance
- db_map (DiffDatabaseMapping) – DiffDatabaseMapping instance
- data (list) – list of dict-items to update
- item_type (str) – the item type
- parent (QUndoCommand, optional) – The parent command, used for defining macros.
-
class
spinetoolbox.spine_db_commands.RemoveItemsCommand(db_mngr, db_map, typed_data, parent=None)[source]¶ Bases:
spinetoolbox.spine_db_commands.SpineDBCommandParameters: - db_mngr (SpineDBManager) – SpineDBManager instance
- db_map (DiffDatabaseMapping) – DiffDatabaseMapping instance
- typed_data (dict) – lists of dict-items to remove keyed by string type
- parent (QUndoCommand, optional) – The parent command, used for defining macros.