traitsui.undo module¶
Defines the manager for Undo and Redo history for Traits user interface support.
- class traitsui.undo.AbstractUndoItem[source]¶
Bases:
AbstractCommand
Abstract base class for undo items.
This class is deprecated and will be removed in TraitsUI 8. Any custom subclasses of this class should either subclass from AbstractCommand, or provide the ICommand interface.
- do()[source]¶
Does nothing.
All undo items log events after they have happened, so by default they do not do anything when added to the history.
- name = "Edit"¶
A simple default name.
- class traitsui.undo.ListUndoItem[source]¶
Bases:
AbstractUndoItem
A change to a list, which can be undone.
- added = List()¶
Items added to the list
- index = Int()¶
Starting index
- name = Str()¶
Name of the trait that changed
- object = Instance(HasTraits)¶
Object that the change occurred on
- removed = List()¶
Items removed from the list
- class traitsui.undo.UndoHistory[source]¶
Bases:
HasStrictTraits
Manages a list of undoable changes.
- can_redo = Property(Bool, observe='_can_redo')¶
Can an action be redone?
- can_undo = Property(Bool, observe='_can_undo')¶
Can an action be undone?
- extend(undo_item)[source]¶
Extends the undo history.
If possible the method merges the new UndoItem with the last item in the history; otherwise, it appends the new item.
- manager = Instance(IUndoManager, allow_none=False)¶
The undo manager for the history.
- now = Property(Int, observe='stack._index')¶
The current position in the list
- redoable = Event(False)¶
Fired when state changes to redoable
- stack = Instance(ICommandStack, allow_none=False)¶
The command stack for the history.
- undoable = Event(False)¶
Fired when state changes to undoable
- class traitsui.undo.UndoHistoryUndoItem[source]¶
Bases:
AbstractUndoItem
An undo item for the undo history.
- history = Instance(UndoHistory)¶
The undo history to undo or redo
- class traitsui.undo.UndoItem[source]¶
Bases:
AbstractUndoItem
A change to an object trait, which can be undone.
- name = Str()¶
Name of the trait that changed
- new_value = Property()¶
New value of the changed trait
- object = Instance(HasTraits)¶
Object the change occurred on
- old_value = Property()¶
Old value of the changed trait