Skip to content

feat(multipoint): add Prev and Set XY to the flexible multipoint tab - #617

Open
jsschwrz wants to merge 1 commit into
Cephla-Lab:masterfrom
jsschwrz:feat/flexible-multipoint-prev-set-xy
Open

feat(multipoint): add Prev and Set XY to the flexible multipoint tab#617
jsschwrz wants to merge 1 commit into
Cephla-Lab:masterfrom
jsschwrz:feat/flexible-multipoint-prev-set-xy

Conversation

@jsschwrz

Copy link
Copy Markdown

Adds a Prev button and a Set XY button to the Flexible Multipoint tab, and numbers the positions on the scan grid.

Why

Stepping through the position list was one-way — Next had no counterpart. And only Z could be corrected on a point already in the list, so fixing a slightly off XY meant deleting the point and adding it again. Nothing on the scan grid indicated which rectangle belonged to which list entry, so pressing Next gave no feedback about where you had landed.

What changed

Prev takes half of Next's cell and walks the list backwards, wrapping the way Next already does.

btn_previous and previous() turned out to already exist, and to already be connected — they had simply never been added to a layout. previous() now guards the empty list, and treats "nothing selected" as the last entry rather than letting (index - 1) % N skip quietly to the second to last.

Set XY takes half of the Update Z cell; both buttons are renamed to fit side by side. It re-tiles the region at the current stage position through the same add_flexible_region* calls that add_location and cell_was_changed use, erasing the old rectangles first, and leaves Z to Set Z.

update_z picked up the same empty-list guard (previously a click with an empty list wrote to location_list[-1]) and now writes the table's z cell, which it had been skipping. Both buttons share one location-string helper, so the dropdown text no longer depends on which button wrote it.

Numbered positions. NavigationViewer labels each position 1..N by list order and highlights the selected one, outlining every FOV of its region so the mark is correct for any NxN grid. The numbers are pg.TextItems rather than text baked into the overlay: they stay upright and legibly sized at any zoom, and are unaffected by the ViewBox's invertX, which is set on builds where the objective is not inverted. clear_overlay drops them, so the tab-switch path that already clears regions cleans up the labels on its own.

Before:  [ Location List            v ][   Update Z   ]
         [ Add ][ Remove ][    Next    ][    Clear     ]

After:   [ Location List            v ][Set XY][Set Z ]
         [ Add ][ Remove ][Prev][Next ][    Clear     ]

Testing

  • Full suite on this branch: 1519 passed, 12 failed. The 12 are pre-existing — upstream/master at e86a608f gives 1518 passed, 13 failed, and this branch's failures are a strict subset. The one extra failure on master (test_job_completion_decrements_backpressure_counters) is flaky and passes in isolation.
  • 20 targeted tests were written against the real methods and all pass: Prev/Next are exact inverses at every index, wrap-around, empty-list safety on all four buttons, Set XY re-tiling while leaving Z alone, overlap vs step-size modes, labels renumbering after a deletion, and the highlight tracking selection. Happy to include them in this PR if wanted — they are not committed here.
  • Rendered the widget offscreen to confirm geometry: Prev and Next measure 87px each and together span exactly the 180px Next alone used to hold; Set XY/Set Z share the right end and still align with Clear's edge.
  • Rendered a real NavigationViewer: scan boxes drawn with the selected one highlighted, labels confirmed as ['1','2','3','4'] with only the current one bold, and clear_overlay() drops them to zero.

One caveat: the offscreen Qt platform used for these checks does not rasterize glyphs (button text renders blank too), so while the label objects are verified correct in text, color, boldness and position, the drawn numbers have not been visually confirmed on a real display.

🤖 Generated with Claude Code

Stepping through the position list was one-way. Next had no counterpart, and
only Z could be corrected on a point already in the list, so fixing a slightly
off XY meant deleting the point and adding it again. Nothing on the scan grid
said which rectangle belonged to which list entry either, so pressing Next gave
no feedback about where in the list you had landed.

Prev takes half of Next's cell and walks the list backwards, wrapping the way
Next already does. btn_previous and previous() turned out to exist already, and
to be connected already - they had simply never been added to a layout.
previous() now guards the empty list, and treats "nothing selected" as the last
entry rather than letting (index - 1) % N skip quietly to the second to last.

Set XY takes half of the Update Z cell; both buttons are renamed to fit side by
side. It re-tiles the region at the current stage position through the same
add_flexible_region* calls add_location and cell_was_changed use, erasing the
old rectangles first, and leaves Z to Set Z. update_z picked up the same
empty-list guard and now writes the table's z cell, which it had been skipping.
Both share one location-string helper, so the dropdown text no longer depends
on which button wrote it.

NavigationViewer numbers each position 1..N by list order and highlights the
selected one, outlining every FOV of its region so the mark is right for any
NxN grid. The numbers are pg.TextItems rather than text baked into the overlay:
they stay upright and legibly sized whatever the zoom, and are unaffected by
the ViewBox's invertX, which is set on builds where the objective is not
inverted. clear_overlay drops them, so the tab-switch path that already clears
regions cleans up the labels on its own.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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