fix: make admin reset delete gui.db and restart the app - #148
Conversation
Previously 'Empty Database & Restart' would delete and recreate gui.db, then only quit the application — requiring a manual relaunch. Now it deletes gui.db and uses os.execv to atomically restart the process. The startup logic in main.py handles recreating gui.db from the current schema spec. Project folders and data are unaffected — users can re-attach them via 'Add Existing Project' on startup.
|
Documentation reminder The following view file(s) were modified in this PR: Please review and update the relevant pages in If the UI has visually changed, capture a new screenshot for the affected screen(s) and commit it to |
There was a problem hiding this comment.
Pull request overview
This PR fixes the Empty Database & Restart admin action so that it actually restarts the application after resetting gui.db, relying on main.py startup bootstrapping to recreate the DB. It also updates the admin UI copy to better explain what data is affected by the reset.
Changes:
- Update the admin reset flow to delete
gui.dband restart the process viaos.execv(...)(instead of quitting only). - Update the admin reset description text to clarify that project folders/data on disk are unaffected and can be re-attached on startup.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/openstan/presenters/admin_presenter.py | Deletes gui.db, closes the Qt DB, and restarts the process instead of only quitting |
| src/openstan/views/admin_view.py | Updates the reset UI description text to clarify impact and recovery path |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Jason Farrar <farrar.jason1@gmail.com>
Summary
Previously Empty Database & Restart would delete and recreate
gui.db, then onlyQApplication.quit()— requiring a manual relaunch.Now it deletes
gui.dband usesos.execvto atomically restart the process. The startup logic inmain.pyhandles recreatinggui.dbfrom the current schema spec.Changes
admin_presenter.py: Removedcreate_gui_dbimport.empty_gui_dbnow deletesgui.dband callsos.execv(sys.executable, [sys.executable] + sys.argv)to restart. Error path falls back toQApplication.quit().admin_view.py: Updated description label to clarify that project folders/data are unaffected and can be re-attached via Add Existing Project on startup.Notes
project.dbdatabases live independently on disk — only thegui.dbrecords (which track known projects) are removed.os.execvworks in both development (python -m openstan) and frozen builds — it atomically replaces the current process.create_gui_dbis still used bymain.py:340for startup; only the redundant call inempty_gui_dbwas removed.