From 41646fe1281bdeaa2fe224120fdf7d209b29a8d6 Mon Sep 17 00:00:00 2001 From: Mike Sullivan Date: Mon, 8 Jul 2024 16:22:42 +0100 Subject: [PATCH 1/3] Export table disables upon no available stacks in SV --- mantidimaging/gui/windows/spectrum_viewer/presenter.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mantidimaging/gui/windows/spectrum_viewer/presenter.py b/mantidimaging/gui/windows/spectrum_viewer/presenter.py index ea054b8805c..b53d9450c54 100644 --- a/mantidimaging/gui/windows/spectrum_viewer/presenter.py +++ b/mantidimaging/gui/windows/spectrum_viewer/presenter.py @@ -85,6 +85,11 @@ def handle_sample_change(self, uuid: UUID | None) -> None: """ Called when the stack has been changed in the stack selector. """ + print("handle_sample_change") + if len(self.main_window.presenter.model.datasets) == 0: + self.view.exportTabs.setDisabled(True) + else: + self.view.exportTabs.setDisabled(False) if uuid == self.current_stack_uuid: return else: From 96d26afd7724907ed4ec7009a410a3612e1aae62 Mon Sep 17 00:00:00 2001 From: Mike Sullivan Date: Mon, 8 Jul 2024 16:39:21 +0100 Subject: [PATCH 2/3] Spectrum Viewer Presenter tests fix --- mantidimaging/gui/windows/spectrum_viewer/presenter.py | 1 - .../gui/windows/spectrum_viewer/test/presenter_test.py | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mantidimaging/gui/windows/spectrum_viewer/presenter.py b/mantidimaging/gui/windows/spectrum_viewer/presenter.py index b53d9450c54..5c74f325188 100644 --- a/mantidimaging/gui/windows/spectrum_viewer/presenter.py +++ b/mantidimaging/gui/windows/spectrum_viewer/presenter.py @@ -85,7 +85,6 @@ def handle_sample_change(self, uuid: UUID | None) -> None: """ Called when the stack has been changed in the stack selector. """ - print("handle_sample_change") if len(self.main_window.presenter.model.datasets) == 0: self.view.exportTabs.setDisabled(True) else: diff --git a/mantidimaging/gui/windows/spectrum_viewer/test/presenter_test.py b/mantidimaging/gui/windows/spectrum_viewer/test/presenter_test.py index e59f4e857b2..e1c281df14d 100644 --- a/mantidimaging/gui/windows/spectrum_viewer/test/presenter_test.py +++ b/mantidimaging/gui/windows/spectrum_viewer/test/presenter_test.py @@ -7,7 +7,7 @@ from unittest import mock import numpy as np -from PyQt5.QtWidgets import QPushButton, QActionGroup, QGroupBox, QAction, QCheckBox +from PyQt5.QtWidgets import QPushButton, QActionGroup, QGroupBox, QAction, QCheckBox, QTabWidget from parameterized import parameterized from mantidimaging.core.data.dataset import StrictDataset, MixedDataset @@ -38,6 +38,7 @@ def setUp(self) -> None: self.view.exportButtonRITS = mock.create_autospec(QPushButton) self.view.normalise_ShutterCount_CheckBox = mock.create_autospec(QCheckBox) self.view.addBtn = mock.create_autospec(QPushButton) + self.view.exportTabs = mock.create_autospec(QTabWidget) self.view.tof_mode_select_group = mock.create_autospec(QActionGroup) self.view.tofPropertiesGroupBox = mock.create_autospec(QGroupBox) self.presenter = SpectrumViewerWindowPresenter(self.view, self.main_window) From 5912722bc3385b6ded5afdf995493803b73e2a92 Mon Sep 17 00:00:00 2001 From: Mike Sullivan Date: Mon, 8 Jul 2024 16:51:52 +0100 Subject: [PATCH 3/3] release note --- docs/release_notes/2.8.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/release_notes/2.8.rst b/docs/release_notes/2.8.rst index c01f096d494..32a58642d4d 100644 --- a/docs/release_notes/2.8.rst +++ b/docs/release_notes/2.8.rst @@ -31,6 +31,7 @@ Fixes - #2219: Live viewer: informative error if live directory deleted - #2246: Don't duplicate ROI names after stack modification - #2250: A bug where a lock object was trying to be pickled has not been fixed, the median filter is now functional. +- #2242: In the Spectrum Viewer, the Export Tabs now disable when no image stacks are available to prevent a KeyError Developer Changes ----------------- @@ -49,4 +50,4 @@ Developer Changes - #2183 : Update CIL to 24.0, numpy 1.23, scipy 1.8 - #2196 : Cancel in progress test runs when new commit pushed - #2213 : unit tests have been added to check that the Time of Flight modes behave correctly when switching between stacks -- #2250 : Make systems tests stricter to catch operations errors \ No newline at end of file +- #2250 : Make systems tests stricter to catch operations errors