Skip to content

Commit

Permalink
Resolved issues with duplicate ROIs being created when switching samp…
Browse files Browse the repository at this point in the history
…le (#2479)
  • Loading branch information
samtygier-stfc authored Jan 28, 2025
2 parents 7bd8bed + de0a1d5 commit 9469b60
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions docs/release_notes/next/fix-2473-sample-swicth-error
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2473: Resolved issues with duplicate ROIs being created when switching sample
6 changes: 3 additions & 3 deletions mantidimaging/gui/windows/spectrum_viewer/presenter.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ def handle_sample_change(self, uuid: UUID | None) -> None:
self.model.set_stack(self.main_window.get_stack(uuid))
self.model.set_tof_unit_mode_for_stack()
self.reset_units_menu()

self.handle_tof_unit_change()
normalise_uuid = self.view.get_normalise_stack()
if normalise_uuid is not None:
Expand All @@ -118,7 +117,6 @@ def handle_sample_change(self, uuid: UUID | None) -> None:
except RuntimeError:
norm_stack = None
self.model.set_normalise_stack(norm_stack)

self.do_add_roi()
self.add_rits_roi()
self.view.set_normalise_error(self.model.normalise_issue())
Expand Down Expand Up @@ -383,12 +381,14 @@ def do_remove_roi(self, roi_name: str | None = None) -> None:
"""
Remove a given ROI from the table by ROI name or all ROIs from
the table if no name is passed as an argument
@param roi_name: Name of the ROI to remove
"""
if roi_name is None:
self.view.spectrum_widget.roi_dict.clear()
for name in self.get_roi_names():
self.view.spectrum_widget.remove_roi(name)
self.view.spectrum_widget.roi_dict.clear()
self.view.roi_table_model.clear_table()
self.model.remove_all_roi()
else:
self.view.spectrum_widget.remove_roi(roi_name)
Expand Down

0 comments on commit 9469b60

Please sign in to comment.