spinetoolbox.project_commands

QUndoCommand subclasses for modifying the project.

Module Contents

Classes

SpineToolboxCommand

SetItemSpecificationCommand

Command to set the specification for a project item.

MoveIconCommand

Command to move icons in the Design view.

SetProjectDescriptionCommand

Command to set the project description.

AddProjectItemsCommand

Command to add items.

RemoveAllProjectItemsCommand

Command to remove all items from project.

RemoveProjectItemsCommand

Command to remove items.

RenameProjectItemCommand

Command to rename project items.

AddConnectionCommand

Command to add connection between project items.

RemoveConnectionsCommand

Command to remove links.

AddJumpCommand

Command to add a jump between project items.

RemoveJumpsCommand

Command to remove jumps.

SetJumpConditionCommand

Command to set jump condition.

UpdateJumpCmdLineArgsCommand

Command to update Jump command line args.

SetFiltersOnlineCommand

Command to toggle filter value.

SetConnectionDefaultFilterOnlineStatus

Command to set connection's default filter online status.

SetConnectionFilterTypeEnabled

Command to enable and disable connection's filter types.

SetConnectionOptionsCommand

Command to set connection options.

AddSpecificationCommand

Command to add item specification to a project.

ReplaceSpecificationCommand

Command to replace item specification in project.

RemoveSpecificationCommand

Command to remove specs from a project.

SaveSpecificationAsCommand

Command to remove item specs from a project.

class spinetoolbox.project_commands.SpineToolboxCommand[source]

Bases: PySide6.QtGui.QUndoCommand

property is_critical[source]

Returns True if this command needs to be undone before closing the project without saving changes.

successfully_undone = False[source]

Flag to register the outcome of undoing a critical command, so toolbox can react afterwards.

class spinetoolbox.project_commands.SetItemSpecificationCommand(item_name, spec, old_spec, project)[source]

Bases: SpineToolboxCommand

Command to set the specification for a project item.

Parameters
  • item_name (str) – item’s name

  • spec (ProjectItemSpecification) – the new spec

  • old_spec (ProjectItemSpecification) – the old spec

  • project (SpineToolboxProject) – project

redo()[source]
undo()[source]
class spinetoolbox.project_commands.MoveIconCommand(icon, project)[source]

Bases: SpineToolboxCommand

Command to move icons in the Design view.

Parameters
redo()[source]
undo()[source]
_move_to(positions)[source]
class spinetoolbox.project_commands.SetProjectDescriptionCommand(project, description)[source]

Bases: SpineToolboxCommand

Command to set the project description.

Parameters
redo()[source]
undo()[source]
class spinetoolbox.project_commands.AddProjectItemsCommand(project, items_dict, item_factories)[source]

Bases: SpineToolboxCommand

Command to add items.

Parameters
  • project (SpineToolboxProject) – the project

  • items_dict (dict) – a mapping from item name to item dict

  • item_factories (dict) – a mapping from item type to ProjectItemFactory

  • silent (bool) – If True, suppress messages

redo()[source]
undo()[source]
class spinetoolbox.project_commands.RemoveAllProjectItemsCommand(project, item_factories, delete_data=False)[source]

Bases: SpineToolboxCommand

Command to remove all items from project.

Parameters
  • project (SpineToolboxProject) – the project

  • item_factories (dict) – a mapping from item type to ProjectItemFactory

  • delete_data (bool) – If True, deletes the directories and data associated with the items

redo()[source]
undo()[source]
class spinetoolbox.project_commands.RemoveProjectItemsCommand(project, item_factories, item_names, delete_data=False)[source]

Bases: SpineToolboxCommand

Command to remove items.

Parameters
  • project (SpineToolboxProject) – The project

  • item_factories (dict) – a mapping from item type to ProjectItemFactory

  • item_names (list of str) – Item names

  • delete_data (bool) – If True, deletes the directories and data associated with the item

redo()[source]
undo()[source]
class spinetoolbox.project_commands.RenameProjectItemCommand(project, previous_name, new_name)[source]

Bases: SpineToolboxCommand

Command to rename project items.

Parameters
  • project (SpineToolboxProject) – the project

  • previous_name (str) – item’s previous name

  • new_name (str) – the new name

property is_critical[source]

Returns True if this command needs to be undone before closing the project without saving changes.

redo()[source]
undo()[source]
class spinetoolbox.project_commands.AddConnectionCommand(project, source_name, source_position, destination_name, destination_position)[source]

Bases: SpineToolboxCommand

Command to add connection between project items.

Parameters
  • project (SpineToolboxProject) – project

  • source_name (str) – source item’s name

  • source_position (str) – link’s position on source item’s icon

  • destination_name (str) – destination item’s name

  • destination_position (str) – link’s position on destination item’s icon

redo()[source]
undo()[source]
class spinetoolbox.project_commands.RemoveConnectionsCommand(project, connections)[source]

Bases: SpineToolboxCommand

Command to remove links.

Parameters
  • project (SpineToolboxProject) – project

  • connections (list of LoggingConnection) – the connections

redo()[source]
undo()[source]
class spinetoolbox.project_commands.AddJumpCommand(project, source_name, source_position, destination_name, destination_position)[source]

Bases: SpineToolboxCommand

Command to add a jump between project items.

Parameters
  • project (SpineToolboxProject) – project

  • source_name (str) – source item’s name

  • source_position (str) – link’s position on source item’s icon

  • destination_name (str) – destination item’s name

  • destination_position (str) – link’s position on destination item’s icon

redo()[source]
undo()[source]
class spinetoolbox.project_commands.RemoveJumpsCommand(project, jumps)[source]

Bases: SpineToolboxCommand

Command to remove jumps.

Parameters
redo()[source]
undo()[source]
class spinetoolbox.project_commands.SetJumpConditionCommand(project, jump, jump_properties, condition)[source]

Bases: SpineToolboxCommand

Command to set jump condition.

Parameters
redo()[source]
undo()[source]
class spinetoolbox.project_commands.UpdateJumpCmdLineArgsCommand(project, jump, jump_properties, cmd_line_args)[source]

Bases: SpineToolboxCommand

Command to update Jump command line args.

Parameters
redo()[source]
undo()[source]
class spinetoolbox.project_commands.SetFiltersOnlineCommand(project, connection, resource, filter_type, online)[source]

Bases: SpineToolboxCommand

Command to toggle filter value.

Parameters
  • project (SpineToolboxProject) – project

  • connection (Connection) – connection

  • resource (str) – resource label

  • filter_type (str) – filter type identifier

  • online (dict) – mapping from scenario/tool id to online flag

redo()[source]
undo()[source]
class spinetoolbox.project_commands.SetConnectionDefaultFilterOnlineStatus(project, connection, default_status)[source]

Bases: SpineToolboxCommand

Command to set connection’s default filter online status.

Parameters
redo()[source]
undo()[source]
class spinetoolbox.project_commands.SetConnectionFilterTypeEnabled(project, connection, filter_type, enabled)[source]

Bases: SpineToolboxCommand

Command to enable and disable connection’s filter types.

Parameters
redo()[source]
undo()[source]
class spinetoolbox.project_commands.SetConnectionOptionsCommand(project, connection, options)[source]

Bases: SpineToolboxCommand

Command to set connection options.

Parameters
redo()[source]
undo()[source]
class spinetoolbox.project_commands.AddSpecificationCommand(project, specification, save_to_disk)[source]

Bases: SpineToolboxCommand

Command to add item specification to a project.

Parameters
  • project (ToolboxUI) – the toolbox

  • specification (ProjectItemSpecification) – the spec

  • save_to_disk (bool) – If True, save the specification to disk

redo()[source]
undo()[source]
class spinetoolbox.project_commands.ReplaceSpecificationCommand(project, name, specification)[source]

Bases: SpineToolboxCommand

Command to replace item specification in project.

Parameters
  • project (ToolboxUI) – the toolbox

  • name (str) – the name of the spec to be replaced

  • specification (ProjectItemSpecification) – the new spec

property is_critical[source]

Returns True if this command needs to be undone before closing the project without saving changes.

redo()[source]
undo()[source]
class spinetoolbox.project_commands.RemoveSpecificationCommand(project, name)[source]

Bases: SpineToolboxCommand

Command to remove specs from a project.

Parameters
redo()[source]
undo()[source]
class spinetoolbox.project_commands.SaveSpecificationAsCommand(project, name, path)[source]

Bases: SpineToolboxCommand

Command to remove item specs from a project.

Parameters
  • project (SpineToolboxProject) – the project

  • name (str) – specification’s name

  • path (str) – new specification file location

redo()[source]
undo()[source]