From 23ab8231593f0505af3702cf41324d8978ea71c0 Mon Sep 17 00:00:00 2001 From: Mike Sullivan Date: Fri, 23 Feb 2024 15:40:43 +0000 Subject: [PATCH 1/2] reset properties table on removing roi --- mantidimaging/gui/windows/spectrum_viewer/view.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mantidimaging/gui/windows/spectrum_viewer/view.py b/mantidimaging/gui/windows/spectrum_viewer/view.py index 74041e15ea0..78c0a6e0724 100644 --- a/mantidimaging/gui/windows/spectrum_viewer/view.py +++ b/mantidimaging/gui/windows/spectrum_viewer/view.py @@ -421,6 +421,10 @@ def remove_roi(self) -> None: if self.roi_table_model.rowCount() == 0: self.removeBtn.setEnabled(False) self.disable_roi_properties() + else: + self.set_old_table_names() + self.current_roi = self.roi_table_model.row_data(self.selected_row)[0] + self.set_roi_properties() def clear_all_rois(self) -> None: """ From 81197be29059e4c8e08b6d3adad4ec81129ef5ea Mon Sep 17 00:00:00 2001 From: Mike Sullivan Date: Mon, 26 Feb 2024 11:32:35 +0000 Subject: [PATCH 2/2] Fixed inconsistent state on visibilty change --- mantidimaging/gui/windows/spectrum_viewer/view.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mantidimaging/gui/windows/spectrum_viewer/view.py b/mantidimaging/gui/windows/spectrum_viewer/view.py index 78c0a6e0724..45eb1187d14 100644 --- a/mantidimaging/gui/windows/spectrum_viewer/view.py +++ b/mantidimaging/gui/windows/spectrum_viewer/view.py @@ -220,8 +220,12 @@ def on_visibility_change(self) -> None: if self.presenter.export_mode == ExportMode.ROI_MODE: if self.current_roi in self.old_table_names and self.last_clicked_roi in self.old_table_names: pass - else: + elif self.current_roi == ROI_RITS and self.last_clicked_roi in self.old_table_names: self.current_roi = self.last_clicked_roi + elif self.current_roi == ROI_RITS and self.last_clicked_roi not in self.old_table_names: + self.current_roi = self.roi_table_model.row_data(self.selected_row)[0] + else: + self.last_clicked_roi = self.current_roi if self.roi_table_model.rowCount() == 0: self.disable_roi_properties() if not self.roi_table_model.rowCount() == 0: