pyface.undo.i_undo_manager module

class pyface.undo.i_undo_manager.IUndoManager(adaptee, default=<class 'traits.adaptation.adaptation_error.AdaptationError'>)[source]

Bases: Interface

The undo manager interface. An undo manager is responsible for one or more command stacks. Typically an application would have a single undo manager.

active_stack = Instance("pyface.undo.api.ICommandStack")

This is the currently active command stack and may be None. Typically it is set when some sort of editor becomes active. IUndoManager and ICommandStack depend on one another, hence we can’t directly import ICommandStack and use it here.

active_stack_clean = Bool()

This reflects the clean state of the currently active command stack. It is intended to support a “document modified” indicator in the GUI. It is maintained by the undo manager.

redo_name = Str()

This is the name of the command that can be redone. It will be empty if there is no command that can be redone. It is maintained by the undo manager.

sequence_nr = Int()

This is the sequence number of the next command to be performed. It is incremented immediately before a command is invoked (by its ‘do()’ method).

stack_updated = Event(Instance("pyface.undo.api.ICommandStack"))

This event is fired when the index of a command stack changes. Note that it may not be the active stack.

undo_name = Str()

This is the name of the command that can be undone. It will be empty if there is no command that can be undone. It is maintained by the undo manager.

redo()[source]

Redo the last undone command of the active command stack.

undo()[source]

Undo the last command of the active command stack.