Skip to content

Target Selection: fully disable buttons during placement; lock selection + disable Add/Import during Edit #644

Description

@peterhollender

Two UX issues on Target Selection from smoke-testing SlicerOpenLIFU#643.

1. Placement mode leaves Edit / Remove clickable

Currently refresh_action_buttons() uses:

placing = self.placement_node is not None
...
self.add_button.enabled = loaded and not placing
self.import_button.enabled = loaded and not placing
self.edit_button.enabled = loaded          # <- still enabled during placement
self.remove_button.enabled = loaded and has_selection  # <- also still enabled

Add Target and Import correctly disable while the user is picking a slice-view location, but Edit and Remove don't -- clicking either mid-placement leaves the placement in a weird half-alive state.

Fix: placing should disable all four buttons. The only way out of placement mode is Escape (which fires EndPlacementEvent with 0 control points and cleans up).

2. Edit mode leaves Add / Import enabled and row selection free

Once the page is in Edit mode focused on one target (either because the user clicked Edit, or because they just placed a new one and were auto-dropped into Edit mode), the user can:

  • Still click Add Target -- starts a new placement while another edit is in progress.
  • Still click Import -- same problem.
  • Click other rows in the table -- switches Edit focus away from the currently-locked-open target.

Each of those breaks the "you are editing ONE target at a time" contract that the fiducial lock model relies on.

Fix:

  • While in Edit mode (is_in_edit_mode == True), disable Add Target and Import. The user must click Done first.
  • Lock the table row selection to the row that Edit mode focused on. Programmatic + Done-click selection changes are OK; user click on another row silently reverts. Simplest implementation: track edit_focus_row at Edit toggle time, and on selection-change while in edit mode, if the new row differs, revert with a SignalBlocker and re-apply edit focus.
  • Edit button itself stays enabled (says "Done") so the user can exit.
  • Remove stays enabled during Edit mode -- keeps the current confirmation-dialog behaviour. (The user considered turning Remove into a no-confirm "Cancel" for freshly-placed targets specifically; they were fine deferring that if it adds branchy state. Skipping.)

Non-goals

  • No change to placement lifecycle beyond disabling more buttons.
  • No change to the confirmation dialog on Remove.
  • No new "Cancel Placement" button. Escape mid-placement remains the sole cancel path.

Acceptance

  1. Click Add Target in Target Selection. Add / Import / Edit / Remove are all disabled while the page waits for the slice-view click.
  2. Press Escape → placement cancels; buttons return to normal (Add / Import / Edit enabled; Remove enabled if a row is selected).
  3. Click Add Target → click a slice view. The new target is placed. Edit toggles ON, focused on the new row.
  4. In this Edit mode, verify: Add and Import are disabled. Edit button says Done. Remove is enabled.
  5. Click another row in the table. Selection reverts to the just-placed row; that row's fiducial stays the unlocked one.
  6. Click Done. Edit exits, Add / Import / Edit return to enabled, Remove enabled iff a row is selected.
  7. Select an existing target row, click Edit. Same lock behaviour: Add / Import disabled, selection locked to that row.

Relates to SlicerOpenLIFU#643, SlicerOpenLIFU#641, SlicerOpenLIFU#640.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions