.. wxPython Phoenix documentation This file was generated by Phoenix's sphinx generator and associated tools, do not edit by hand. Copyright: (c) 2011-2020 by Total Control Software License: wxWindows License .. include:: headings.inc .. currentmodule:: wx.lib.docview .. highlight:: python .. _wx.lib.docview.CommandProcessor: ========================================================================================================================================== |phoenix_title| **wx.lib.docview.CommandProcessor** ========================================================================================================================================== :class:`CommandProcessor` is a class that maintains a history of :class:`Commands`, with undo/redo functionality built-in. Derive a new class from this if you want different behaviour. | |class_hierarchy| Class Hierarchy ================================= .. raw:: html
Inheritance diagram for class CommandProcessor:
| |super_classes| Known Superclasses ================================== :class:`wx.Object` | |method_summary| Methods Summary ================================ ================================================================================ ================================================================================ :meth:`~wx.lib.docview.CommandProcessor.__init__` Constructor. ``maxCommands`` may be set to a positive integer to limit :meth:`~wx.lib.docview.CommandProcessor.CanRedo` Returns ``True`` if the currently-active command can be redone, :meth:`~wx.lib.docview.CommandProcessor.CanUndo` Returns ``True`` if the currently-active command can be undone, :meth:`~wx.lib.docview.CommandProcessor.ClearCommands` Deletes all the commands in the list and sets the current command :meth:`~wx.lib.docview.CommandProcessor.GetCommands` Returns the list of commands. :meth:`~wx.lib.docview.CommandProcessor.GetEditMenu` Returns the edit menu associated with the command processor. :meth:`~wx.lib.docview.CommandProcessor.GetMaxCommands` Returns the maximum number of commands that the command processor :meth:`~wx.lib.docview.CommandProcessor.GetRedoAccelerator` Returns the string that will be appended to the Redo menu item. :meth:`~wx.lib.docview.CommandProcessor.GetUndoAccelerator` Returns the string that will be appended to the Undo menu item. :meth:`~wx.lib.docview.CommandProcessor.Redo` Redoes the command just undone. :meth:`~wx.lib.docview.CommandProcessor.SetEditMenu` Tells the command processor to update the Undo and Redo items on this :meth:`~wx.lib.docview.CommandProcessor.SetMenuStrings` Sets the menu labels according to the currently set menu and the :meth:`~wx.lib.docview.CommandProcessor.SetRedoAccelerator` Sets the string that will be appended to the Redo menu item. :meth:`~wx.lib.docview.CommandProcessor.SetUndoAccelerator` Sets the string that will be appended to the Redo menu item. :meth:`~wx.lib.docview.CommandProcessor.Submit` Submits a new command to the command processor. The command processor :meth:`~wx.lib.docview.CommandProcessor.Undo` Undoes the command just executed. ================================================================================ ================================================================================ | |api| Class API =============== .. class:: CommandProcessor(wx.Object) :class:`CommandProcessor` is a class that maintains a history of :class:`Commands`, with undo/redo functionality built-in. Derive a new class from this if you want different behaviour. .. method:: __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. .. method:: CanRedo(self) Returns ``True`` if the currently-active command can be redone, ``False`` otherwise. .. method:: CanUndo(self) Returns ``True`` if the currently-active command can be undone, ``False`` otherwise. .. method:: ClearCommands(self) Deletes all the commands in the list and sets the current command pointer to None. .. method:: GetCommands(self) Returns the list of commands. .. method:: GetEditMenu(self) Returns the edit menu associated with the command processor. .. method:: GetMaxCommands(self) Returns the maximum number of commands that the command processor stores. .. method:: GetRedoAccelerator(self) Returns the string that will be appended to the Redo menu item. .. method:: GetUndoAccelerator(self) Returns the string that will be appended to the Undo menu item. .. method:: Redo(self) Redoes the command just undone. .. method:: 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. .. method:: SetMenuStrings(self) Sets the menu labels according to the currently set menu and the current command state. .. method:: SetRedoAccelerator(self, accel) Sets the string that will be appended to the Redo menu item. .. method:: SetUndoAccelerator(self, accel) Sets the string that will be appended to the Redo menu item. .. method:: Submit(self, command, storeIt=True) Submits a new command to the command processor. The command processor calls :meth:`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. .. method:: Undo(self) Undoes the command just executed.