organoid_tracker.gui.undo_redo module

class organoid_tracker.gui.undo_redo.CombinedAction(actions: List[UndoableAction], *, do_message: str, undo_message: str)

Bases: UndoableAction

Combines multiple actions into one. It works by calling the do and undo methods of the actions in the order they were added.

do(experiment: Experiment)

Performs the action. The scratch links in the experiment will be initialized. Returns an user-friendly message of what just happened.

undo(experiment: Experiment)

Undoes the action. The scratch links in the experiment will be initialized. Returns an user-friendly message of what just happened.

class organoid_tracker.gui.undo_redo.ReversedAction(action: UndoableAction)

Bases: UndoableAction

Does exactly the opposite of another action. It works by switching the do and undo methods.

do(experiment: Experiment)

Performs the action. The scratch links in the experiment will be initialized. Returns an user-friendly message of what just happened.

inverse: UndoableAction
undo(experiment: Experiment)

Undoes the action. The scratch links in the experiment will be initialized. Returns an user-friendly message of what just happened.

class organoid_tracker.gui.undo_redo.UndoRedo

Bases: object

clear()

Clears both the undo and redo queue. THis is useful if you just performed a big action that cannot be undone.

do(action: UndoableAction, experiment: Experiment) str

Performs an action, and stores it so that we can undo it

has_unsaved_changes() bool

Returns True if there are any unsaved changes, False otherwise.

mark_everything_saved()

Marks that at this moment in time, everything was saved. has_unsaved_changes() will return True after calling this method. However, after an action is done (see do(…) or redo(…), has_unsaved_changes() will return True again. If you then undo that action again, has_unsaved_changes() will return False gain. Clever, isn’t it?

mark_unsaved_changes()

Forces a resave. Useful if you changed some data in the experiment that cannot be undone.

redo(experiment: Experiment) str
undo(experiment: Experiment) str
class organoid_tracker.gui.undo_redo.UndoableAction

Bases: object

do(experiment: Experiment) str

Performs the action. The scratch links in the experiment will be initialized. Returns an user-friendly message of what just happened.

needs_saving: bool = True
undo(experiment: Experiment) str

Undoes the action. The scratch links in the experiment will be initialized. Returns an user-friendly message of what just happened.