motile_plugin.data_model.action_history
Classes
An action history implementing the ideas from this blog: |
Module Contents
- class motile_plugin.data_model.action_history.ActionHistory
An action history implementing the ideas from this blog: https://github.com/zaboople/klonk/blob/master/TheGURQ.md Essentially, if you go back and change something after undo-ing, you can always get back to every state if you undo far enough (instead of throwing out the undone actions)
- undo_stack: list[motile_plugin.data_model.actions.TracksAction] = []
- redo_stack: list[motile_plugin.data_model.actions.TracksAction] = []
- property undo_pointer
- add_new_action(action: motile_plugin.data_model.actions.TracksAction) None
Add a newly performed action to the history. Args:
action (TracksAction): The new action to be added to the history.
- undo() bool
Undo the last performed action
- Returns:
bool: True if an action was undone, and False if there was no previous action to undo.
- redo() bool
Redo the last undone action
- Returns:
bool: True if an action was redone, and False if there was no undone action to redo.