PyANGKernel.GKCommander

class GKCommander

Class the execute commands.

Details

The GKCommander is the class that executes and holds all the commands executed and that can be undone.

When a command is add it is executed (GKCommand::doit) and moved to the undoCommands list. When the command is undone (GKCommand::undoit) it is moved to the redoCommands list.

When the developer wants to execute a command it will add it to the commander (the commander is part of the model) using the addCommand method. This method will: - Call GKCommand::init method to know if the command can be executed. If not it will be removed. - Discard any command in the redo list (redoCommands) - Try merging it with the previous executed command - Execute the command (GKCommand::doit) - Add it to the undoCommands list. - Mark it as done ( setDone ( true )); - Emit the signal commandDone if it was done or emit commandMerged if it was merged. - Mark the model as modified ( setStatus ( eModified ) )

When the user selects the Undo item from the file menu, the commander will: - Remove the command from the undoCommands list - Add it to the redoCommands list - Execute the undo (GKCommand::undoit) - Mark it as not done ( setDone ( false )) - Emit the signal commandDone - Mark the model as modified ( setStatus ( eModified ) )

When the user selects the Redo item from the file menu, the commander will: - Remove the command from the redoCommands list - Add it to the undoCommands list - Execute it (GKCommand::doit) - Mark it as done ( setDone ( true )) - Emit the signal commandDone - Mark the model as modified ( setStatus ( eModified ) )

Inheritance diagram of PyANGKernel.GKCommander

Synopsis

Methods

Slots

Signals

Note

This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE

__init__()
addCommand(aCommand)
Parameters:

aCommandGKCommand

Return type:

GKCommandReport

Add a command to the system. The command will be execute (doit) by this function and will return any error found on the init function. If an error is found the command will be deleted, if not the command will be adopted.

Calling this function with aCommand = null has the same effect as calling notUndoableOperationDone

addDoneCommand(aCommand)
Parameters:

aCommandGKCommand

Add a done command to the system. The command will NOT be execute (doit) by this function since it has been already executed. The command will be adopted. init function in the command will not be called since the command has been already execute (and no error is returned).

clear()

Removes all the current commands discarting undone operations and making done operations permament without marking as modified the model.

commandMerged()
commandRunning()
Return type:

bool

Return true if a command is running (either the do or the undo)

commanderChanged(arg__1)
Parameters:

arg__1GKCommander

commanderDo(arg__1)
Parameters:

arg__1GKCommand

commanderUndo(arg__1)
Parameters:

arg__1GKCommand

doCommand()

Perform a redo operation (if any available)

getModel()
Return type:

GKModel

The model of this commander.

getMultiDelCmd()
Return type:

GKObjectDelMultipleCmd

Returns the command to delete several objects at once

notUndoableOperationDone()

A command that the user cannot “undo” has been executed so the all the current undo commands are removed making done operations permament. This method marks the model as modified.

redoName()
Return type:

str

Return the name of the command that can be redoned or an empty string if there is no command.

setModel(amodel)
Parameters:

amodelGKModel

Called by the GKModel when it creates the commander.

undoCommand()

Perform a undo operation (if any available)

undoName()
Return type:

str

Return the name of the command that can be undoned or an empty string if there is no command.