Skip to content

feat(clean): usable clean-tubings dialog + status-bar step progress - #71

Merged
Heerpa merged 3 commits into
developfrom
feature/clean-dialog-usability
Dec 2, 2026
Merged

Heerpa merged 3 commits into
developfrom
feature/clean-dialog-usability

Conversation

@Heerpa

@Heerpa Heerpa commented Dec 2, 2026

Copy link
Copy Markdown
Collaborator

Four usability fixes to the tubing-cleaning procedure, ahead of a release.

1. Dialog opened too small

It opened at the tiny QTableWidget size hint — you always had to resize to read it. It now sizes to its content (820 wide, height scaled to the table + liquids, capped), so it opens readable.

2. Default view wasn't runnable

A meaningful clean pumps a cleaning liquid through the tubing; the pre-empty (retract) is just an optional preliminary. With no cleaning_rounds configured, the Clean button was disabled unless you switched to Custom and set a >0 pre-empty — wrong for a start-of-experiment rinse where you don't want to retract.

The dialog now always offers the setup's flush/wash buffer (flushbuffer_a, e.g. PBS) as a selectable rinse liquid, checked by default when no dedicated cleaning rounds exist. So a rinse runs straight from the Default view (0 pre-empty, no retraction). cleaning_plan() exposes the wash buffer (only when it's wired and not already a cleaning tank); rigs that configure their own cleaning rounds are unchanged — the buffer is offered unchecked there.

3. Preamble

A short note at the top explains what the procedure does (pumps the selected liquid through each selected reservoir's path and out the needle; Default = just rinse).

4. Status-bar step progress

clean_tubings takes a progress(msg) callback, threaded through the pre-empty / chain / individual helpers with friendly reservoir labels ("Pre-emptying PBS…", "Cleaning with PBS…", "Flushing out to waste…"). The Fluid tab marshals it to the main-window status bar via a queued Qt signal, so each step shows while the clean runs (and a self-clearing "done" at the end).

Screenshot

A no-cleaning-rounds rig: readable size, preamble, full table, and "Wash buffer: PBS" checked → Clean enabled in Default view.

Tests

  • Dialog: wash buffer makes the Default view actionable (0 pre-empty, rinse with PBS); offered-but-unchecked when cleaning rounds exist; opens at a usable size.
  • cleaning_plan() exposes a wired wash buffer; SystemService.clean_tubings forwards progress; clean_tubings reports step messages.

Full suite passes bar the known monet dev-container flake.

🤖 Generated with Claude Code

Heerpa and others added 3 commits December 2, 2026 14:45
…atus-bar progress

Four usability fixes to the tubing-cleaning procedure (ahead of a release):

1. Dialog size: it opened at the tiny QTableWidget size hint, needing a manual
   resize to read the content. It now sizes to its content (capped), so it
   opens readable.
2. Actionable default: a meaningful clean needs a liquid to flush with, so with
   no cleaning_rounds configured the Clean button was disabled unless you
   switched to Custom and set a >0 pre-empty. The dialog now always offers the
   setup's flush/wash buffer (flushbuffer_a) as a selectable rinse liquid —
   checked by default when there are no dedicated cleaning rounds — so a
   start-of-experiment rinse runs straight from the Default view (0 pre-empty,
   no retraction). cleaning_plan() exposes the wash buffer; rigs that configure
   their own cleaning rounds are unchanged (the buffer is offered unchecked).
3. Preamble: a short note at the top explaining what the procedure does.
4. Status-bar progress: clean_tubings takes a `progress` callback (threaded
   through the pre-empty / chain / individual helpers, with friendly reservoir
   labels); the Fluid tab marshals it to the main-window status bar via a Qt
   signal so each step shows while the clean runs.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Mirror the clean-tubings usability pass for fill:

- Clicking "Fill tubings" now first shows a short confirmation explaining what
  it does (prime each reservoir's tubing up to its valve, then flush the
  central tubing with the flush buffer), so it never moves liquid unannounced.
- fill_tubings() takes a `progress` callback and reports each step ("Filling
  from <reservoir>…", "Filling central tubing with flush buffer…") with
  friendly reservoir labels; the Fluid tab marshals it to the main-window
  status bar.

The per-op status plumbing added for clean is generalized (_op_step signal +
_op_progress(what) helper), so clean and fill share one thread-safe status-bar
path.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… hardware

`cleaning_plan()` tested `wash_id in reservoir_a`, but on a connected rig
`reservoir_a` is a `ReservoirDict`, which has no `__contains__` — so the `in`
raised `TypeError`. `_on_clean` swallows plan errors (`except: plan = None`),
so the whole new per-reservoir clean dialog (table, wash-buffer rinse option,
proper sizing) silently never appeared on real hardware; the app fell back to
the old whole-system confirm. The unit test missed it because its fake used a
plain dict.

Test membership against `reservoir_a.keys()` instead, and make the regression
test use a real `ReservoirDict` so the production shape is exercised.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Heerpa

Heerpa commented Dec 2, 2026

Copy link
Copy Markdown
Collaborator Author

Code review (high-effort, correctness + cross-file + removed-behavior + cleanup/altitude) → fixed in 4b1a2a8

🐛 Confirmed & fixed (would have broken the feature on real hardware):
cleaning_plan() tested wash_id in reservoir_a, but on a connected rig reservoir_a is a ReservoirDict, which has no __contains__ — so in raised TypeError. _on_clean swallows plan errors (except: plan = None), so the entire new clean dialog (table, wash-buffer option, sizing) would have silently never appeared on hardware, falling back to the old confirm. The unit test missed it because its fake reservoir_a was a plain dict. Now tests membership via reservoir_a.keys(), and the regression test uses a real ReservoirDict (reproduces the TypeError without the fix).

Reviewed and verified safe (no change):

  • Threading: _op_progress/_op_step.emit is the standard queued cross-thread pattern; the lambda captures only what/self. The "status could be stale on a fast op" concern is a non-issue — Qt delivers the step signals FIFO before the worker's finished callback, so _on_op_done always sees the final step and replaces it with a self-clearing "done".
  • _on_op_error's startswith(what) — every _run(call, what) caller passes a non-None string; no None path.
  • _status_bar() guards self.window()/statusBar correctly; _res_label guards special_names/_reservoir_names.
  • _build_liquids_group wash-only path validates correctly; the wash reservoir is filtered out of res_to_clean by the backend.
  • _on_fill cancel returns before _run (no stuck-busy); _op_step is per-instance (PyQt binds signals per instance).

Low-severity notes left as-is (minimal-change): _res_label ~5-line id→name dup across layers; _size_to_content pixel heuristic (capped, fixes the tiny-default complaint); fill is always-ask (matches the requested preamble — no design waive, unlike clean's require_confirm).

Full suite 1094 passed (only the known monet dev-container flake).

@Heerpa
Heerpa merged commit f0c3765 into develop Dec 2, 2026
6 checks passed
@Heerpa
Heerpa deleted the feature/clean-dialog-usability branch December 2, 2026 15:30
This was referenced Dec 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant