| Representation of Undoinfo | The Undo Mechanism | The Undo API |
The SetFillStyle method of the Group class has to return
undoinfo that describes how to undo several operations at once. To
achieve this, one can define a function UndoList as follows:
def UndoList(infos):
undoinfo = map(Undo, infos)
undoinfo.reverse()
return (UndoList, undoinfo)
|
Undo is a function that executes a single undoinfo (defined
in undo.py).
Given a list `infos' of undoinfos, Group.SetFillStyle can
return (UndoList, infos).
Calling reverse in UndoList is essential, as some operations
must be undone in exactly the reverse order in which they were
performed.
For more complex cases where several undoinfos have to be executed in a
certain order one can easily define similar functions. See for instance
UndoAfter in undo.py
| Representation of Undoinfo | The Undo Mechanism | The Undo API |