Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolved issues with duplicate ROIs being created when switching sample #2479

Merged
merged 1 commit into from
Jan 28, 2025

Conversation

ashleymeigh2
Copy link
Collaborator

Fix ROI management and synchronization in spectrum viewer

Issue Closes #2473

Description

  • Resolved issues with duplicate ROIs being created when switching samples.
  • Simplified and improved do_remove_roi to ensure proper removal of all ROIs or specific ROIs, keeping the table, model, and view in sync.

Developer Testing

  • I have verified unit tests pass locally: python -m pytest -vs
  • Manually tested ROI removal and addition during sample switching to confirm no duplicates or errors occur.
  • Verified UI behavior when switching export modes (ROI_MODE and IMAGE_MODE).

Acceptance Criteria and Reviewer Testing

  • Unit tests pass locally: python -m pytest -vs
  • Verify no duplicate ROIs are created when switching samples.
  • Ensure no KeyError occurs during ROI visibility updates.
  • Confirm that the ROI table and properties UI are updated properly when ROIs are added or removed.
  • Verify correct behavior when switching between ROI and image export modes.

Documentation and Additional Notes

  • Release Notes have been updated to include fixes to ROI management issues.

@coveralls
Copy link

coveralls commented Jan 27, 2025

Coverage Status

coverage: 73.102% (+0.01%) from 73.088%
when pulling de0a1d5 on 2473_sample_swicth_error
into 7bd8bed on main.

if roi_name is None:
self.view.spectrum_widget.roi_dict.clear()
for name in self.get_roi_names():
for name in list(self.view.spectrum_widget.roi_dict.keys()):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we keep using self.get_roi_names()

@samtygier-stfc samtygier-stfc changed the title Resolved issues with duplicate ROIs being created when switching samp… Resolved issues with duplicate ROIs being created when switching sample Jan 28, 2025
@samtygier-stfc samtygier-stfc force-pushed the 2473_sample_swicth_error branch from 249c511 to de0a1d5 Compare January 28, 2025 09:47
Copy link
Collaborator

@samtygier-stfc samtygier-stfc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes the issue for me.

(I squashed the commits)

@samtygier-stfc samtygier-stfc added this pull request to the merge queue Jan 28, 2025
Merged via the queue into main with commit 9469b60 Jan 28, 2025
8 checks passed
@samtygier-stfc samtygier-stfc deleted the 2473_sample_swicth_error branch January 28, 2025 10:42
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.

Switching samples does not clear ROIs
4 participants