Phoenix Logo

phoenix_title 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 Class Hierarchy

Inheritance diagram for class CommandProcessor:

super_classes Known Superclasses

wx.Object


method_summary Methods Summary

__init__ Constructor. maxCommands may be set to a positive integer to limit
CanRedo Returns True if the currently-active command can be redone,
CanUndo Returns True if the currently-active command can be undone,
ClearCommands Deletes all the commands in the list and sets the current command
GetCommands Returns the list of commands.
GetEditMenu Returns the edit menu associated with the command processor.
GetMaxCommands Returns the maximum number of commands that the command processor
GetRedoAccelerator Returns the string that will be appended to the Redo menu item.
GetUndoAccelerator Returns the string that will be appended to the Undo menu item.
Redo Redoes the command just undone.
SetEditMenu Tells the command processor to update the Undo and Redo items on this
SetMenuStrings Sets the menu labels according to the currently set menu and the
SetRedoAccelerator Sets the string that will be appended to the Redo menu item.
SetUndoAccelerator Sets the string that will be appended to the Redo menu item.
Submit Submits a new command to the command processor. The command processor
Undo Undoes the command just executed.

api Class API



class CommandProcessor(wx.Object)

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.


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.