Push a pre-captured snapshot onto the undo stack.
(self, data)
| 986 | self._push_snapshot(self.to_data()) |
| 987 | |
| 988 | def _push_snapshot(self, data) -> None: |
| 989 | """Push a pre-captured snapshot onto the undo stack.""" |
| 990 | if data is None: |
| 991 | return |
| 992 | self._undo_stack.append(data) |
| 993 | if len(self._undo_stack) > 50: |
| 994 | self._undo_stack.pop(0) |
| 995 | self._redo_stack.clear() |
| 996 | self.data_changed.emit() |
| 997 | |
| 998 | def undo(self) -> None: |
| 999 | if not self._undo_stack: |
no test coverage detected