wx.CommandProcessor is a class that maintains a history of Commands, with undo/redo functionality built-in.
Derive a new class from this if you want different behaviour.
See also
CommandProcessor Overview, wx.Command
Constructor. |
|
Returns |
|
Returns |
|
Deletes all commands in the list and sets the current command pointer to |
|
Returns the list of commands. |
|
Returns the current command. |
|
Returns the edit menu associated with the command processor. |
|
Returns the maximum number of commands that the command processor stores. |
|
Returns the string that will be appended to the Redo menu item. |
|
Returns the string that will be shown for the redo menu item. |
|
Returns the string that will be appended to the Undo menu item. |
|
Returns the string that will be shown for the undo menu item. |
|
Initializes the command processor, setting the current command to the last in the list (if any), and updating the edit menu (if one has been specified). |
|
Returns a boolean value that indicates if changes have been made since the last save operation. |
|
You must call this method whenever the project is saved if you plan to use |
|
Executes (redoes) the current command (the command that has just been undone if any). |
|
Tells the command processor to update the Undo and Redo items on this menu as appropriate. |
|
Sets the menu labels according to the currently set menu and the current command state. |
|
Sets the string that will be appended to the Redo menu item. |
|
Sets the string that will be appended to the Undo menu item. |
|
Just store the command without executing it. |
|
Submits a new command to the command processor. |
|
Undoes the last command executed. |
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
wx.
CommandProcessor
(Object)¶Possible constructors:
CommandProcessor(maxCommands=-1)
CommandProcessor is a class that maintains a history of Commands, with undo/redo functionality built-in.
__init__
(self, maxCommands=-1)¶Constructor.
maxCommands (int) – May be set to a positive integer to limit the number of commands stored to it, otherwise (and by default) the list of commands can grow arbitrarily.
CanRedo
(self)¶Returns True
if the currently-active command can be redone, False
otherwise.
bool
CanUndo
(self)¶Returns True
if the currently-active command can be undone, False
otherwise.
bool
ClearCommands
(self)¶Deletes all commands in the list and sets the current command pointer to None
.
GetCommands
(self)¶Returns the list of commands.
CommandList
GetCurrentCommand
(self)¶Returns the current command.
GetEditMenu
(self)¶Returns the edit menu associated with the command processor.
GetMaxCommands
(self)¶Returns the maximum number of commands that the command processor stores.
int
GetRedoAccelerator
(self)¶Returns the string that will be appended to the Redo menu item.
string
GetRedoMenuLabel
(self)¶Returns the string that will be shown for the redo menu item.
string
GetUndoAccelerator
(self)¶Returns the string that will be appended to the Undo menu item.
string
GetUndoMenuLabel
(self)¶Returns the string that will be shown for the undo menu item.
string
Initialize
(self)¶Initializes the command processor, setting the current command to the last in the list (if any), and updating the edit menu (if one has been specified).
IsDirty
(self)¶Returns a boolean value that indicates if changes have been made since the last save operation.
This only works if MarkAsSaved
is called whenever the project is saved.
bool
MarkAsSaved
(self)¶You must call this method whenever the project is saved if you plan to use IsDirty
.
Redo
(self)¶Executes (redoes) the current command (the command that has just been undone if any).
bool
SetEditMenu
(self, menu)¶Tells the command processor to update the Undo and Redo items on this menu as appropriate.
Set this to None
if the menu is about to be destroyed and command operations may still be performed, or the command processor may try to access an invalid pointer.
menu (wx.Menu) –
SetMenuStrings
(self)¶Sets the menu labels according to the currently set menu and the current command state.
SetRedoAccelerator
(self, accel)¶Sets the string that will be appended to the Redo menu item.
accel (string) –
SetUndoAccelerator
(self, accel)¶Sets the string that will be appended to the Undo menu item.
accel (string) –
Store
(self, command)¶Just store the command without executing it.
The command is stored in the history list, and the associated edit menu (if any) updated appropriately.
command (wx.Command) –
Submit
(self, command, storeIt=True)¶Submits a new command to the command processor.
The command processor calls wx.Command.Do
to execute the command; if it succeeds, the command is stored in the history list, and the associated edit menu (if any) updated appropriately. If it fails, the command is deleted immediately. Once Submit
has been called, the passed command should not be deleted directly by the application.
command (wx.Command) – The command to submit
storeIt (bool) – Indicates whether the successful command should be stored in the history list.
bool
Undo
(self)¶Undoes the last command executed.
bool
Commands
¶See GetCommands
CurrentCommand
¶EditMenu
¶See GetEditMenu
and SetEditMenu
MaxCommands
¶See GetMaxCommands
RedoAccelerator
¶See GetRedoAccelerator
and SetRedoAccelerator
RedoMenuLabel
¶See GetRedoMenuLabel
UndoAccelerator
¶See GetUndoAccelerator
and SetUndoAccelerator
UndoMenuLabel
¶See GetUndoMenuLabel