Karana.KUtils.MultibodyTUI.history#

Attributes#

Classes#

StateHistory

Container for a state object with undo and redo capabilities

Module Contents#

Karana.KUtils.MultibodyTUI.history.State#
class Karana.KUtils.MultibodyTUI.history.StateHistory(init_state: State)[source]#

Bases: Generic[State]

Container for a state object with undo and redo capabilities

property state: State#

The current state

push(state: State)[source]#

Set a new state

property current_state_count: int#

The number of states in the undo stack

Note that this includes the current state and is always positive.

property total_state_count: int#

The number of states - past, present, and future

This is similar to past_state_count but also includes states in the redo stack.

undo_stack_size() int[source]#

The number of states in the undo stack

Note that this includes the current state and is always positive

can_undo() bool[source]#

Return whether an undo state is available

undo()[source]#

Return to the previous state

can_redo() bool[source]#

Return whether a redo state is available

redo()[source]#

Return to the next state (ie: undo a previous undo)