1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193
|
.. wxPython Phoenix documentation
This file was generated by Phoenix's sphinx generator and associated
tools, do not edit by hand.
Copyright: (c) 2011-2018 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
<div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
<img id="toggleBlock-trigger" src="_static/images/closed.png"/>
Inheritance diagram for class <strong>CommandProcessor</strong>:
</div>
<div id="toggleBlock-summary" style="display:block;"></div>
<div id="toggleBlock-content" style="display:none;">
<p class="graphviz">
<center><img src="_static/images/inheritance/wx.lib.docview.CommandProcessor_inheritance.png" alt="Inheritance diagram of CommandProcessor" usemap="#dummy" class="inheritance"/></center>
</div>
<script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
<map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.lib.docview.CommandProcessor.html" title="wx.lib.docview.CommandProcessor" alt="" coords="5,83,248,112"/> <area shape="rect" id="node2" href="wx.Object.html" title="wx.Object" alt="" coords="85,5,167,35"/> </map>
</p>
|
|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.
|