Skip to content

Project save improvements #401

Closed
Closed

Description

@rozyczko

We need a way to notify users about the project state being dirtied and in need of save.
Additionally, saving prtoject should be improved:

  • floppy disc icon should have its color changed when the project is dirty
  • the icon should be grayed for clean state
  • user should get some information about the project having been saved (status bar?)

Activity

  1. added
    [priority] ⚠️ label needed
    [scope] ⚠️ label needed
    on Sep 1, 2026
  2. added
    [priority] medium
    on Sep 1, 2026
  3. removed
    [priority] ⚠️ label needed
    on Sep 1, 2026
  4. added
    [scope] enhancement
    on Sep 1, 2026
  5. removed
    [scope] ⚠️ label needed
    on Sep 1, 2026
  6. rozyczko commented on Sep 1, 2026

    @rozyczko
    MemberAuthor

    Project save feedback — analysis and design proposal

    Context: Saving the project (floppy disk icon, top-left of the main window) succeeds but gives
    the user no confirmation. Question: is anything wired but not shown, or is nothing included at all?

    Currently: nothing is wired. Failures are silent

    The whole chain from the floppy button down is fire-and-forget:

    1. Gui/ApplicationWindow.qml:37 → projectSave() →
      Gui/Globals/BackendWrapper.qml:79 → the save() slot in
      Backends/Py/project.py (Project.save) → ProjectLogic.save() → the lib's
      save_as_json(overwrite=True). No signal is emitted anywhere, nothing returns a result, and no
      QML element listens.

    2. It is actually worse than "no confirmation": the lib's save_as_json
      (reflectometry-lib, project.py) wraps the write in
      except Exception as exception: print(exception) — a failed save (locked file,
      permissions, and notably the documented ValueError that as_dict() raises when a constraint
      depends on a parameter not reachable from the models) prints to a console the GUI user never
      sees. Today "saved silently" and "failed silently" look identical.

    3. There is no dirty/unsaved-changes tracking anywhere (lib or app), so the app also cannot tell
      whether saving was even needed, and the reset/close paths can discard unsaved work without
      warning.

    One reusable asset exists:
    Gui/Pages/Summary/Sidebar/Basic/Groups/SaveConfirmationDialog.qml — the modal success/failure
    dialog the Summary export already uses. EasyApp has no toast/snackbar component.

    Proposed design

    Phase 1 — honest feedback (small, recommended)

    • Lib: stop swallowing exceptions in save_as_json (let them propagate, or return success).
      Without this, any confirmation the GUI shows would be a guess.
    • Backend: Project.save() catches, then emits a new projectSaved(success, path, message)
      signal, plus a lastSaved timestamp property (notify-backed).
    • UI, asymmetric by severity:
      • Failure → modal dialog (reuse the SaveConfirmationDialog pattern with the error message).
        A failed save must not be missable.
      • Success → no modal. A dialog on every routine save is friction; instead:
        1. flash the floppy icon to a check mark for ~2 s (in-place, exactly where the user just
          clicked), and
        2. a status-bar item "Saved · 14:32" showing the last save time persistently. The status bar
          already shows project/models/experiments, so it fits naturally and stays inspectable after
          the flash is gone.

    Phase 2 — dirty tracking (bigger, best long-term)

    A hasUnsavedChanges flag set from the existing change funnels in py_backend
    (externalSampleChanged, parametersChanged, constraints/experiment signals all pass through one
    place), cleared on save/load/create. That buys:

    • an asterisk on the window title or a dot badge on the save button,
    • save button disabled when clean (making "it saved" implicit),
    • an "unsaved changes" prompt on Reset and on window close: the reset dialog currently says
      "cannot be undone" without knowing whether anything would be lost.
  7. added a commit that references this issue on Sep 9, 2026
  8. added a commit that references this issue on Sep 18, 2026
  9. added a commit that references this issue on Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    [priority] medium[scope] enhancementenhancement

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions