traitsui.undo module¶
Defines the manager for Undo and Redo history for Traits user interface support.
-
class
traitsui.undo.
AbstractUndoItem
¶ Bases:
traits.has_traits.HasPrivateTraits
Abstract base class for undo items.
-
merge_undo
(undo_item)¶ Merges two undo items if possible.
-
redo
()¶ Re-does the change.
-
undo
()¶ Undoes the change.
-
-
class
traitsui.undo.
ListUndoItem
¶ Bases:
traitsui.undo.AbstractUndoItem
A change to a list, which can be undone.
-
added
= List()¶ Items added to the list
-
index
= Int()¶ Starting index
-
merge_undo
(undo_item)¶ Merges two undo items if possible.
-
name
= Str()¶ Name of the trait that changed
-
object
= Instance(HasTraits)¶ Object that the change occurred on
-
redo
()¶ Re-does the change.
-
removed
= List()¶ Items removed from the list
-
undo
()¶ Undoes the change.
-
-
class
traitsui.undo.
UndoHistory
¶ Bases:
traits.has_traits.HasStrictTraits
Manages a list of undoable changes.
-
add
(undo_item, extend=False)¶ Adds an UndoItem to the history.
-
can_redo
= Property()¶ Can an action be redone?
-
can_undo
= Property()¶ Can an action be undone?
-
clear
()¶ Clears the undo history.
-
extend
(undo_item)¶ 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.
-
history
= List()¶ List of accumulated undo changes
-
now
= Int()¶ The current position in the list
-
redo
()¶ Redoes an operation.
-
redoable
= Event(False)¶ Fired when state changes to redoable
-
revert
()¶ Reverts all changes made so far and clears the history.
-
undo
()¶ Undoes an operation.
-
undoable
= Event(False)¶ Fired when state changes to undoable
-
-
class
traitsui.undo.
UndoHistoryUndoItem
¶ Bases:
traitsui.undo.AbstractUndoItem
An undo item for the undo history.
-
history
= Instance(UndoHistory)¶ The undo history to undo or redo
-
redo
()¶ Re-does the change.
-
undo
()¶ Undoes the change.
-
-
class
traitsui.undo.
UndoItem
¶ Bases:
traitsui.undo.AbstractUndoItem
A change to an object trait, which can be undone.
-
merge_undo
(undo_item)¶ Merges two undo items if possible.
-
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
-
redo
()¶ Re-does the change.
-
undo
()¶ Undoes the change.
-