spinetoolbox.project_commands

QUndoCommand subclasses for modifying the project.

authors:
  1. Marin (KTH)
date:

12.2.2020

Module Contents

Classes

SpineToolboxCommand
SetProjectNameCommand Command to set the project name.
SetProjectDescriptionCommand Command to set the project description.
AddProjectItemsCommand Command to add items.
RemoveAllProjectItemsCommand Command to remove all items from project.
RemoveProjectItemCommand Command to remove items.
RenameProjectItemCommand Command to rename items.
AddLinkCommand Command to add link.
RemoveLinkCommand Command to remove link.
MoveIconCommand Command to move icons in the Design view.
SetItemSpecificationCommand Command to set the specification for a Tool.
AddSpecificationCommand Command to add item specs to a project.
RemoveSpecificationCommand Command to remove item specs from a project.
UpdateSpecificationCommand Command to update item specs in a project.
class spinetoolbox.project_commands.SpineToolboxCommand[source]

Bases: PySide2.QtWidgets.QUndoCommand

static is_critical()[source]

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

class spinetoolbox.project_commands.SetProjectNameCommand(project, name)[source]

Bases: spinetoolbox.project_commands.SpineToolboxCommand

Command to set the project name.

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

Bases: spinetoolbox.project_commands.SpineToolboxCommand

Command to set the project description.

Parameters:
redo(self)[source]
undo(self)[source]
class spinetoolbox.project_commands.AddProjectItemsCommand(project, item_type, items, set_selected=False, verbosity=True)[source]

Bases: spinetoolbox.project_commands.SpineToolboxCommand

Command to add items.

Parameters:
  • project (SpineToolboxProject) – the project
  • item_type (str) – The factory name
  • items (Iterable) – one or more dict of items to add
  • set_selected (bool) – Whether to set item selected after the item has been added to project
  • verbosity (bool) – If True, prints message
redo(self)[source]
undo(self)[source]
class spinetoolbox.project_commands.RemoveAllProjectItemsCommand(project, items_per_category, links, delete_data=False)[source]

Bases: spinetoolbox.project_commands.SpineToolboxCommand

Command to remove all items from project.

Parameters:
  • project (SpineToolboxProject) – the project
  • delete_data (bool) – If True, deletes the directories and data associated with the items
redo(self)[source]
undo(self)[source]
class spinetoolbox.project_commands.RemoveProjectItemCommand(project, name, delete_data=False)[source]

Bases: spinetoolbox.project_commands.SpineToolboxCommand

Command to remove items.

Parameters:
  • project (SpineToolboxProject) – the project
  • name (str) – Item’s name
  • delete_data (bool) – If True, deletes the directories and data associated with the item
redo(self)[source]
undo(self)[source]
class spinetoolbox.project_commands.RenameProjectItemCommand(project_item_model, tree_item, new_name)[source]

Bases: spinetoolbox.project_commands.SpineToolboxCommand

Command to rename items.

Parameters:
redo(self)[source]
undo(self)[source]
static is_critical()[source]

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

class spinetoolbox.project_commands.AddLinkCommand(graphics_view, src_connector, dst_connector)[source]

Bases: spinetoolbox.project_commands.SpineToolboxCommand

Command to add link.

Parameters:
redo(self)[source]
undo(self)[source]
class spinetoolbox.project_commands.RemoveLinkCommand(graphics_view, link)[source]

Bases: spinetoolbox.project_commands.SpineToolboxCommand

Command to remove link.

Parameters:
redo(self)[source]
undo(self)[source]
class spinetoolbox.project_commands.MoveIconCommand(graphics_item)[source]

Bases: spinetoolbox.project_commands.SpineToolboxCommand

Command to move icons in the Design view.

Parameters:graphics_item (ProjectItemIcon) – the icon
redo(self)[source]
undo(self)[source]
class spinetoolbox.project_commands.SetItemSpecificationCommand(item, specification)[source]

Bases: spinetoolbox.project_commands.SpineToolboxCommand

Command to set the specification for a Tool.

Parameters:
redo(self)[source]
undo(self)[source]
class spinetoolbox.project_commands.AddSpecificationCommand(toolbox, specification)[source]

Bases: spinetoolbox.project_commands.SpineToolboxCommand

Command to add item specs to a project.

Parameters:
redo(self)[source]
undo(self)[source]
class spinetoolbox.project_commands.RemoveSpecificationCommand(toolbox, row, ask_verification)[source]

Bases: spinetoolbox.project_commands.SpineToolboxCommand

Command to remove item specs from a project.

Parameters:
  • toolbox (ToolboxUI) – the toolbox
  • row (int) – the row in the ProjectItemSpecPaletteModel
  • ask_verification (bool) – if True, shows confirmation message the first time
redo(self)[source]
undo(self)[source]
class spinetoolbox.project_commands.UpdateSpecificationCommand(toolbox, row, specification)[source]

Bases: spinetoolbox.project_commands.SpineToolboxCommand

Command to update item specs in a project.

Parameters:
  • toolbox (ToolboxUI) – the toolbox
  • row (int) – the row in the ProjectItemSpecPaletteModel of the spec to be replaced
  • specification (ProjectItemSpecification) – the updated spec
redo(self)[source]
undo(self)[source]