Skip to content

Commit

Permalink
Backport: spectrum viewer keyerror no stacks (#2261)
Browse files Browse the repository at this point in the history
  • Loading branch information
samtygier-stfc authored Jul 9, 2024
2 parents 5093060 + 5912722 commit c4bfb59
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion docs/release_notes/2.8.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
-----------------
Expand All @@ -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
- #2250 : Make systems tests stricter to catch operations errors
4 changes: 4 additions & 0 deletions mantidimaging/gui/windows/spectrum_viewer/presenter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit c4bfb59

Please sign in to comment.