Skip to content

Commit

Permalink
fixed test
Browse files Browse the repository at this point in the history
  • Loading branch information
ashmeigh committed Dec 3, 2024
1 parent ebd1d10 commit 5e942f3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion mantidimaging/gui/test/gui_system_spectrum_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def test_adjust_roi(self):
roi_widget.movePoint(handle_index, new_position)
QTest.qWait(SHORT_DELAY)

updated_roi = self.spectrum_window.presenter.model.get_roi(roi_name)
updated_roi = self.spectrum_window.presenter.view.spectrum_widget.get_roi(roi_name)
self.assertEqual(updated_roi.right, new_position[0])
self.assertEqual(updated_roi.bottom, new_position[1])
self.assertEqual(updated_roi.top, 0)
Expand Down
5 changes: 0 additions & 5 deletions mantidimaging/gui/windows/spectrum_viewer/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -567,8 +567,3 @@ def set_tof_unit_mode_for_stack(self) -> None:
else:
self.tof_mode = ToFUnitMode.WAVELENGTH
self.presenter.change_selected_menu_option("Wavelength")

def get_roi(self, roi_name: str) -> SensibleROI:
if roi_name not in self._roi_ranges.keys():
raise KeyError(f"ROI {roi_name} does not exist in roi_ranges {self._roi_ranges.keys()}")
return self._roi_ranges[roi_name]
6 changes: 4 additions & 2 deletions mantidimaging/gui/windows/spectrum_viewer/presenter.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,9 @@ def do_add_roi(self) -> None:
if roi_name in self.view.spectrum_widget.roi_dict:
raise ValueError(f"ROI name already exists: {roi_name}")
self.model.set_new_roi(roi_name)
roi = self.model.get_roi(roi_name)
roi = self.model._roi_ranges.get(roi_name)
if roi is None:
raise ValueError(f"ROI for {roi_name} is not valid.")
self.view.spectrum_widget.add_roi(roi, roi_name)
spectrum = self.model.get_spectrum(roi, self.spectrum_mode, self.view.shuttercount_norm_enabled())
self.view.set_spectrum(roi_name, spectrum)
Expand Down Expand Up @@ -456,4 +458,4 @@ def check_action(action: QAction, param: bool) -> None:
def convert_spinbox_roi_to_SensibleROI(self, spinboxes: dict[str, QSpinBox]) -> SensibleROI:
roi_iter_order = ["Left", "Top", "Right", "Bottom"]
new_points = [spinboxes[prop].value() for prop in roi_iter_order]
return SensibleROI.from_list(new_points)
return SensibleROI.from_list(new_points)

0 comments on commit 5e942f3

Please sign in to comment.