yasmin_editor.editor_gui.history module

Editor undo/redo history helpers.

class yasmin_editor.editor_gui.history.EditorHistory(max_entries: int = 100)

Bases: object

Small bounded undo/redo stack for editor snapshots.

property can_redo: bool

Return whether one undone snapshot can be restored.

property can_undo: bool

Return whether at least one earlier snapshot is available.

clear() None

Remove all stored snapshots.

record(snapshot: EditorHistorySnapshot) bool

Append one snapshot when it differs from the latest entry.

redo(current_snapshot: EditorHistorySnapshot) EditorHistorySnapshot | None

Return the next snapshot if one is available.

reset(snapshot: EditorHistorySnapshot) None

Replace the complete history with one baseline snapshot.

undo(current_snapshot: EditorHistorySnapshot) EditorHistorySnapshot | None

Return the previous snapshot if one is available.

class yasmin_editor.editor_gui.history.EditorHistorySnapshot(root_model: StateMachine, container_path: tuple[str, ...] = (), current_file_path: str | None = None)

Bases: object

Serializable editor state used by the history stack.

container_path: tuple[str, ...]
current_file_path: str | None
root_model: StateMachine
yasmin_editor.editor_gui.history.container_path_names(container_path: list[StateMachine | Concurrence]) tuple[str, ...]

Return the nested container path relative to the root container.

yasmin_editor.editor_gui.history.resolve_container_path(root_model: StateMachine, path_names: tuple[str, ...]) list[StateMachine | Concurrence]

Resolve one nested container path against the provided root model.