undo (was Re: Why does Dynamic Typing really matter?!?)

Andrew Dalke adalke at mindspring.com
Sat Feb 8 12:52:54 EST 2003


Edward K. Ream:
> BTW, Python makes implementing this relatively easy.  Each "bead" is
simply
> a dictionary containing whatever is needed to undo _and_ redo the
operation.
> setUndoParams has a **keywords parameter.  The caller specifies whatever
is
> needed as keyword arguments; setUndoParams puts the items of the keywords
> dict into the bead's dict.

One of the papers I read used

class BaseCommand:
  def Do(self):
    ...
  def Undo(self):
    ...
  def ReDo(self):
    self.Do()

I bring this up because it said in a few cases, redoing needed different
behaviour
than doing.  For example, the original Do may do a pop-up to get more
information
from the user, or verify a change, or give a "tip of the day" while the redo
shouldn't
do the same thing again.

> You will need to download and install leo2.py 3.10 to read LeoPy.leo,
> although you could read the "raw" code of leoUndo.py at Leo's CVS site:

I did try to install Leo a few weeks ago but ran into some problems.
I posted them in the thread "Hacking Heaven - Leo+XEmacs Integrated"
http://groups.google.com/groups?selm=b176jl%24vrg%241%40slb5.atl.mindspring.
net

Doesn't mean I can't take a look at the source code though :)

                    Andrew
                    dalke at dalkescientific.com






More information about the Python-list mailing list