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 diff --git a/mantidimaging/gui/windows/spectrum_viewer/presenter.py b/mantidimaging/gui/windows/spectrum_viewer/presenter.py index ea054b8805c..5c74f325188 100644 --- a/mantidimaging/gui/windows/spectrum_viewer/presenter.py +++ b/mantidimaging/gui/windows/spectrum_viewer/presenter.py @@ -85,6 +85,10 @@ def handle_sample_change(self, uuid: UUID | None) -> None: """ Called when the stack has been changed in the stack selector. """ + 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: 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)