wx.lib.docview.CommandProcessor¶
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.
Class Hierarchy¶
Known Superclasses¶
Methods Summary¶
Constructor. |
|
Returns |
|
Returns |
|
Deletes all the commands in the list and sets the current command |
|
Returns the list of commands. |
|
Returns the edit menu associated with the command processor. |
|
Returns the maximum number of commands that the command processor |
|
Returns the string that will be appended to the Redo menu item. |
|
Returns the string that will be appended to the Undo menu item. |
|
Redoes the command just undone. |
|
Tells the command processor to update the Undo and Redo items on this |
|
Sets the menu labels according to the currently set menu and the |
|
Sets the string that will be appended to the Redo menu item. |
|
Sets the string that will be appended to the Redo menu item. |
|
Submits a new command to the command processor. The command processor |
|
Undoes the command just executed. |
Class API¶
- class CommandProcessor(wx.Object)¶
CommandProcessor
is a class that maintains a history ofCommands
, with undo/redo functionality built-in. Derive a new class from this if you want different behaviour.
Methods¶
- __init__(self, maxCommands=-1)¶
Constructor.
maxCommands
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.
- CanUndo(self)¶
Returns
True
if the currently-active command can be undone,False
otherwise.
- ClearCommands(self)¶
Deletes all the commands in the list and sets the current command pointer to None.
- GetCommands(self)¶
Returns the list of commands.
- GetEditMenu(self)¶
Returns the edit menu associated with the command processor.
- GetMaxCommands(self)¶
Returns the maximum number of commands that the command processor stores.
- GetRedoAccelerator(self)¶
Returns the string that will be appended to the Redo menu item.
- GetUndoAccelerator(self)¶
Returns the string that will be appended to the Undo menu item.
- Redo(self)¶
Redoes the command just undone.
- 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.
- 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.
- SetUndoAccelerator(self, accel)¶
Sets the string that will be appended to the Redo menu item.
- Submit(self, command, storeIt=True)¶
Submits a new command to the command processor. The command processor calls
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.storeIt
indicates whether the successful command should be stored in the history list.
- Undo(self)¶
Undoes the command just executed.