Follow-up to SlicerOpenLIFU#634 (Session Overview simplification) and part of the split-session refactor tracked by SlicerOpenLIFU#631 / SESSION_SPLIT_DESIGN.md.
Problem
The v2 Home page currently shows read-only status labels and a single "Open Data Manager" button. Two regressions vs. the legacy app:
- No auto-connect to the last-used database. In the legacy app,
OpenLIFU/databaseDirectory was persisted in QSettings when a database loaded, and read back at Slicer startup so users didn't have to re-open the Database dialog every launch. The v2 Data Manager writes nothing to QSettings and reads nothing on startup.
- Data Manager is being used as the "launching point" for sessions, but that's not its job. Data Manager is the admin panel for managing subjects / planning sessions / plans / sonication sessions / solutions / protocols / transducers / users. It's fine for it to also be able to jump into a session, but the primary entry point for a clinical workflow should be big, obvious buttons on the landing page.
Proposed fix
A. Auto-connect
- When
DatabaseLogic.load_database(path) succeeds, persist path to QSettings("OpenLIFU/databaseDirectory").
- When
DatabaseLogic.unload_database() runs, clear the setting so the user's explicit disconnect sticks across restarts.
- Add
DatabaseLogic.try_auto_connect() -> bool that reads the setting, validates it with sample_data.path_is_openlifu_database_root(path), and calls load_database(path). Returns True on success. All errors swallowed + logged.
OpenLIFUHomeWidget.enter() calls try_auto_connect() before refresh_status(), but only if no DB is currently loaded.
- Auto-connect is a Home-only trigger. No other page should invoke it. Database connect/disconnect stays user-driven from the Data Manager.
Design decision: the auto-connect is a single-shot on landing on Home, not a Slicer-startup hook. That keeps the connect/disconnect model app-wide (single source of truth: DatabaseLogic.db) without adding startup-timing hooks, and matches user expectation ("I opened OpenLIFU → my last database is there").
B. Launch buttons on Home
Replace the current single "Open Data Manager" button with a set of prominent action buttons:
- New Planning Session — opens a New PlanningSession dialog (the same one Data Manager uses), writes to the database, loads the new session into app state, navigates to
OpenLIFUPlanningSessionOverview.
- Continue Planning Session — opens a picker (subject combo + planning session list), loads the chosen session, navigates to overview.
- New Sonication Session — opens a New SonicationSession dialog (requires an existing Plan for the chosen subject), writes to the database, loads, navigates to
OpenLIFUSonicationSessionOverview.
- Continue Sonication Session — opens a picker (subject combo + sonication session list), loads the chosen session, navigates to overview.
Plus a smaller "Open Data Manager" link at the bottom for admin access.
Scope hygiene
- Shared session-lifecycle actions currently baked into
OpenLIFUDataManagerLogic (create_planning_session, create_sonication_session, load_planning_session, load_sonication_session, close_loaded_sessions) get pulled into OpenLIFUApp/logic/session_actions.py module-level functions. DataManagerLogic delegates. Home calls the module functions directly. This keeps Rule 6 (no cross-page reach-ins into another page's logic).
- Shared dialogs
NewPlanningSessionDialog / NewSonicationSessionDialog get moved from data_manager_page.py into OpenLIFUApp/dialogs/session_dialogs.py (Rule 7 — any dialog used from >1 page moves to dialogs/). New ContinuePlanningSessionDialog / ContinueSonicationSessionDialog live in the same file.
Non-goals
- No sign-in / hardware-connect / cloud-sync gating on Home. (Separate features, later.)
- No timeline navigation on Home — the timeline is a within-workflow footer, not a landing-page element.
- No auto-connect anywhere except Home.
Acceptance
- Launch Slicer, load a database from the Data Manager, exit. Re-launch. Home shows the database as already-connected, labels populated.
- Click Disconnect (via Data Manager). Exit. Re-launch. Home shows no database and the "New / Continue" buttons show a "Load a database first" hint.
- From Home, click "New Planning Session" → dialog opens → fill out → OK → Planning Session Overview page appears with the new session loaded.
- Similar for the other three buttons.
- Data Manager still works from its own "Load…" button; auto-connect does not fire while navigating between pages.
Relates to SlicerOpenLIFU#631, SlicerOpenLIFU#634.
Follow-up to SlicerOpenLIFU#634 (Session Overview simplification) and part of the split-session refactor tracked by SlicerOpenLIFU#631 /
SESSION_SPLIT_DESIGN.md.Problem
The v2 Home page currently shows read-only status labels and a single "Open Data Manager" button. Two regressions vs. the legacy app:
OpenLIFU/databaseDirectorywas persisted inQSettingswhen a database loaded, and read back at Slicer startup so users didn't have to re-open the Database dialog every launch. The v2 Data Manager writes nothing toQSettingsand reads nothing on startup.Proposed fix
A. Auto-connect
DatabaseLogic.load_database(path)succeeds, persistpathtoQSettings("OpenLIFU/databaseDirectory").DatabaseLogic.unload_database()runs, clear the setting so the user's explicit disconnect sticks across restarts.DatabaseLogic.try_auto_connect() -> boolthat reads the setting, validates it withsample_data.path_is_openlifu_database_root(path), and callsload_database(path). Returns True on success. All errors swallowed + logged.OpenLIFUHomeWidget.enter()callstry_auto_connect()beforerefresh_status(), but only if no DB is currently loaded.Design decision: the auto-connect is a single-shot on landing on Home, not a Slicer-startup hook. That keeps the connect/disconnect model app-wide (single source of truth:
DatabaseLogic.db) without adding startup-timing hooks, and matches user expectation ("I opened OpenLIFU → my last database is there").B. Launch buttons on Home
Replace the current single "Open Data Manager" button with a set of prominent action buttons:
OpenLIFUPlanningSessionOverview.OpenLIFUSonicationSessionOverview.Plus a smaller "Open Data Manager" link at the bottom for admin access.
Scope hygiene
OpenLIFUDataManagerLogic(create_planning_session,create_sonication_session,load_planning_session,load_sonication_session,close_loaded_sessions) get pulled intoOpenLIFUApp/logic/session_actions.pymodule-level functions.DataManagerLogicdelegates. Home calls the module functions directly. This keeps Rule 6 (no cross-page reach-ins into another page's logic).NewPlanningSessionDialog/NewSonicationSessionDialogget moved fromdata_manager_page.pyintoOpenLIFUApp/dialogs/session_dialogs.py(Rule 7 — any dialog used from >1 page moves todialogs/). NewContinuePlanningSessionDialog/ContinueSonicationSessionDialoglive in the same file.Non-goals
Acceptance
Relates to SlicerOpenLIFU#631, SlicerOpenLIFU#634.