Disable the Undo/Redo mechanism. Disabling the Undo/Redo mechanism leaves the database in the current state and forgets past and future database states. This makes :meth:`File.mark`, :meth:`File.undo`, :meth:`File.redo` and other methods fail with an UndoRedoError.
(self)
| 2486 | self._undoEnabled = True |
| 2487 | |
| 2488 | def disable_undo(self) -> None: |
| 2489 | """Disable the Undo/Redo mechanism. |
| 2490 | |
| 2491 | Disabling the Undo/Redo mechanism leaves the database in the |
| 2492 | current state and forgets past and future database states. This |
| 2493 | makes :meth:`File.mark`, :meth:`File.undo`, :meth:`File.redo` and other |
| 2494 | methods fail with an UndoRedoError. |
| 2495 | |
| 2496 | Calling this method when the Undo/Redo mechanism is already |
| 2497 | disabled raises an UndoRedoError. |
| 2498 | |
| 2499 | """ |
| 2500 | self._check_open() |
| 2501 | |
| 2502 | if not self.is_undo_enabled(): |
| 2503 | raise UndoRedoError("Undo/Redo feature is already disabled!") |
| 2504 | |
| 2505 | # The file is going to be changed. |
| 2506 | self._check_writable() |
| 2507 | |
| 2508 | del self._markers |
| 2509 | del self._seqmarkers |
| 2510 | del self._curmark |
| 2511 | del self._curaction |
| 2512 | del self._curtransaction |
| 2513 | del self._nmarks |
| 2514 | del self._actionlog |
| 2515 | # Recursively delete the transaction group |
| 2516 | tnode = self.get_node(_trans_group_path) |
| 2517 | tnode._g_remove(recursive=1) |
| 2518 | |
| 2519 | # The Undo/Redo mechanism has been disabled. |
| 2520 | self._undoEnabled = False |
| 2521 | |
| 2522 | def mark(self, name: str | None = None) -> int: |
| 2523 | """Mark the state of the database. |