App crash recovery - #76
Merged
Merged
Conversation
When an unhandled exception occurs, the app now saves each open package to a recovery file in the settings directory. On the next launch, if a recovery file is found for a previously opened file, the user is asked whether to restore the auto-saved version or discard it and open the original. Recovery files are cleaned up after a successful manual save. - aas_editor/settings/app_settings.py: add RECOVERY_DIR constant - aas_editor/utils/recovery.py: new helper to scan for recovery index files - aas_editor/package.py: add write_recovery(), delete_recovery(), recovery_path() - aas_editor/utils/exceptionhook.py: activate hook, add set_crash_callback() - main.py: uncomment exceptionhook import so hook is registered at startup - aas_editor/editorApp.py: register crash callback, prompt user to restore on open - aas_editor/treeviews/treeview_pack.py: delete recovery files after successful save https://claude.ai/code/session_01UFxYCRhX5pM18utUMv55rP
…ng delete_recovery_file function and updating related methods
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request implements a robust crash recovery system for the editor, ensuring that unsaved changes are not lost in the event of an unexpected crash. The main changes introduce automatic recovery file management, prompt users to restore unsaved work, and ensure cleanup of recovery data after successful saves. Additionally, it improves exception handling to trigger recovery logic on crashes.
Crash Recovery System:
Added a mechanism to auto-save recovery files for open packages when the application crashes, and prompt the user to restore unsaved changes on the next startup. This includes functions to find, write, and delete recovery files, as well as logic to remap recovered files to their original paths. (
aas_editor/editorApp.py,aas_editor/package.py,aas_editor/utils/recovery.py,aas_editor/settings/app_settings.py, [1] [2] [3] [4] [5]Ensured that recovery files and associated metadata are deleted after a successful save, preventing unnecessary accumulation of recovery data. (
aas_editor/treeviews/treeview_pack.py, aas_editor/treeviews/treeview_pack.pyR655-R658)Exception Handling Improvements:
aas_editor/utils/exceptionhook.py, [1] [2] [3]Other Improvements:
RECOVERY_DIRfor storing recovery data. (aas_editor/editorApp.py,aas_editor/settings/app_settings.py, [1] [2] [3] [4]These changes significantly improve the reliability of the editor by safeguarding user data against crashes and providing a user-friendly recovery experience.