spinetoolbox.spine_db_commands

QUndoCommand subclasses for modifying the db.

authors:
  1. Marin (KTH)
date:

31.1.2020

Module Contents

spinetoolbox.spine_db_commands._cache_to_db_relationship_class(item)[source]
spinetoolbox.spine_db_commands._cache_to_db_relationship(item)[source]
spinetoolbox.spine_db_commands._cache_to_db_parameter_definition(item)[source]
spinetoolbox.spine_db_commands._cache_to_db_parameter_value(item)[source]
spinetoolbox.spine_db_commands._cache_to_db_parameter_value_list(item)[source]
spinetoolbox.spine_db_commands._cache_to_db_item(item_type, item)[source]
spinetoolbox.spine_db_commands._format_item(item_type, item)[source]
class spinetoolbox.spine_db_commands.AgedUndoStack[source]

Bases: PySide2.QtWidgets.QUndoStack

redo_age[source]
undo_age[source]
commands(self)[source]
class spinetoolbox.spine_db_commands.CommandBase(db_mngr, db_map)[source]

Bases: PySide2.QtWidgets.QUndoCommand

Parameters:
  • db_mngr (SpineDBManager) – SpineDBManager instance
  • db_map (DiffDatabaseMapping) – DiffDatabaseMapping instance
age[source]
block_notifications(self, func)[source]

Calls given function while blocking notifications on the affected Data Store forms. This is so undo() and subsequent redo() calls don’t trigger the same notifications over and over.

static redomethod(func)[source]

Wraps the given function with a mechanism to determine this command’s completion. The command is considered completed if calling the function triggers a certain signal. Once the command is completed, we don’t listen to the signal anymore and we also block notifications on the affected Data Store forms. If the signal is not received, then the command is declared obsolete.

static undomethod(func)[source]

Wraps the given function with an artifact to block notifications on the affected Data Store forms.

receive_items_changed(self, _db_map_data)[source]

Marks the command as completed.

data(self)[source]

Returns data to present this command in a DBHistoryDialog.

class spinetoolbox.spine_db_commands.AddItemsCommand(db_mngr, db_map, data, item_type)[source]

Bases: spinetoolbox.spine_db_commands.CommandBase

Parameters:
  • db_mngr (SpineDBManager) – SpineDBManager instance
  • db_map (DiffDatabaseMapping) – DiffDatabaseMapping instance
  • data (list) – list of dict-items to add
  • item_type (str) – the item type
_command_name[source]
_method_name[source]
_redo_method_name[source]
_emit_signal_name[source]
_receive_signal_name[source]
redo(self)[source]
undo(self)[source]
receive_items_changed(self, db_map_data)[source]
data(self)[source]
class spinetoolbox.spine_db_commands.AddCheckedParameterValuesCommand(db_mngr, db_map, data)[source]

Bases: spinetoolbox.spine_db_commands.AddItemsCommand

class spinetoolbox.spine_db_commands.UpdateItemsCommand(db_mngr, db_map, data, item_type)[source]

Bases: spinetoolbox.spine_db_commands.CommandBase

Parameters:
  • db_mngr (SpineDBManager) – SpineDBManager instance
  • db_map (DiffDatabaseMapping) – DiffDatabaseMapping instance
  • data (list) – list of dict-items to update
  • item_type (str) – the item type
_command_name[source]
_method_name[source]
_emit_signal_name[source]
_undo_item(self, db_map, redo_item)[source]
redo(self)[source]
undo(self)[source]
data(self)[source]
class spinetoolbox.spine_db_commands.UpdateCheckedParameterValuesCommand(db_mngr, db_map, data)[source]

Bases: spinetoolbox.spine_db_commands.UpdateItemsCommand

class spinetoolbox.spine_db_commands.SetParameterDefinitionTagsCommand(db_mngr, db_map, data)[source]

Bases: spinetoolbox.spine_db_commands.CommandBase

_undo_item(self, db_map, redo_item)[source]
redo(self)[source]
undo(self)[source]
class spinetoolbox.spine_db_commands.RemoveItemsCommand(db_mngr, db_map, typed_data)[source]

Bases: spinetoolbox.spine_db_commands.CommandBase

Parameters:
  • db_mngr (SpineDBManager) – SpineDBManager instance
  • db_map (DiffDatabaseMapping) – DiffDatabaseMapping instance
  • typed_data (dict) – lists of dict-items to remove keyed by string type
_undo_method_name[source]
_emit_signal_name[source]
redo(self)[source]
undo(self)[source]
receive_items_changed(self, db_map_typed_data)[source]
data(self)[source]