PyANGKernel.GKCommander¶
- class GKCommander¶
Class the execute commands.
Details
The
GKCommanderis 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
addCommandmethod. 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) )Synopsis¶
Methods¶
def
__init__()def
addCommand()def
addDoneCommand()def
clear()def
commandRunning()def
getModel()def
getMultiDelCmd()def
redoName()def
setModel()def
undoName()
Slots¶
def
doCommand()def
undoCommand()
Signals¶
def
commandMerged()def
commanderDo()def
commanderUndo()
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__()¶
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
notUndoableOperationDoneAdd 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()¶
Return true if a command is running (either the do or the undo)
- commanderChanged(arg__1)¶
- Parameters:
arg__1 –
GKCommander
- doCommand()¶
Perform a redo operation (if any available)
The model of this commander.
- getMultiDelCmd()¶
- Return type:
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.
Return the name of the command that can be redoned or an empty string if there is no command.
Called by the
GKModelwhen it creates the commander.- undoCommand()¶
Perform a undo operation (if any available)
Return the name of the command that can be undoned or an empty string if there is no command.