From 806f8ed6dcef4ba141852b2be264553f89e45d08 Mon Sep 17 00:00:00 2001 From: Mike Sullivan Date: Thu, 7 Mar 2024 14:07:13 +0000 Subject: [PATCH 1/3] current and normalised stack synced with Main Window --- .../gui/windows/spectrum_viewer/presenter.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/mantidimaging/gui/windows/spectrum_viewer/presenter.py b/mantidimaging/gui/windows/spectrum_viewer/presenter.py index 812b7dc8baa..cd8f0e037cd 100644 --- a/mantidimaging/gui/windows/spectrum_viewer/presenter.py +++ b/mantidimaging/gui/windows/spectrum_viewer/presenter.py @@ -48,6 +48,18 @@ def __init__(self, view: 'SpectrumViewerWindowView', main_window: 'MainWindowVie self.main_window = main_window self.model = SpectrumViewerWindowModel(self) self.export_mode = ExportMode.ROI_MODE + self.main_window.stack_changed.connect(self.handle_stack_changed) + + def handle_stack_changed(self): + self.model.set_stack(self.main_window.get_stack(self.current_stack_uuid)) + normalise_uuid = self.view.get_normalise_stack() + if normalise_uuid is not None: + try: + norm_stack: Optional['ImageStack'] = self.main_window.get_stack(normalise_uuid) + except RuntimeError: + norm_stack = None + self.model.set_normalise_stack(norm_stack) + self.redraw_all_rois() def handle_sample_change(self, uuid: Optional['UUID']) -> None: if uuid == self.current_stack_uuid: From 6f1a8b0186d92ac231866fb19218350982487402 Mon Sep 17 00:00:00 2001 From: Mike Sullivan Date: Thu, 7 Mar 2024 14:26:49 +0000 Subject: [PATCH 2/3] release note --- docs/release_notes/next/fix-2113-spectrum-viewer-sync-stacks | 1 + 1 file changed, 1 insertion(+) create mode 100644 docs/release_notes/next/fix-2113-spectrum-viewer-sync-stacks diff --git a/docs/release_notes/next/fix-2113-spectrum-viewer-sync-stacks b/docs/release_notes/next/fix-2113-spectrum-viewer-sync-stacks new file mode 100644 index 00000000000..f957191ec6e --- /dev/null +++ b/docs/release_notes/next/fix-2113-spectrum-viewer-sync-stacks @@ -0,0 +1 @@ +#2113: Spectrum Viewer stacks now update with Main Window after operation applied \ No newline at end of file From 0155304e69fe9889cdd3bf258b9073ee4d30f466 Mon Sep 17 00:00:00 2001 From: Mike Sullivan Date: Thu, 7 Mar 2024 16:19:41 +0000 Subject: [PATCH 3/3] Spectrum Viewer imageview updates correctly --- mantidimaging/gui/windows/spectrum_viewer/presenter.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mantidimaging/gui/windows/spectrum_viewer/presenter.py b/mantidimaging/gui/windows/spectrum_viewer/presenter.py index cd8f0e037cd..03c12a449f5 100644 --- a/mantidimaging/gui/windows/spectrum_viewer/presenter.py +++ b/mantidimaging/gui/windows/spectrum_viewer/presenter.py @@ -50,8 +50,11 @@ def __init__(self, view: 'SpectrumViewerWindowView', main_window: 'MainWindowVie self.export_mode = ExportMode.ROI_MODE self.main_window.stack_changed.connect(self.handle_stack_changed) - def handle_stack_changed(self): - self.model.set_stack(self.main_window.get_stack(self.current_stack_uuid)) + def handle_stack_changed(self) -> None: + if self.current_stack_uuid: + self.model.set_stack(self.main_window.get_stack(self.current_stack_uuid)) + else: + return normalise_uuid = self.view.get_normalise_stack() if normalise_uuid is not None: try: @@ -59,6 +62,7 @@ def handle_stack_changed(self): except RuntimeError: norm_stack = None self.model.set_normalise_stack(norm_stack) + self.show_new_sample() self.redraw_all_rois() def handle_sample_change(self, uuid: Optional['UUID']) -> None: