From 2f11d90eff3a73117cc5b74c096c445ed47265d7 Mon Sep 17 00:00:00 2001 From: Mike Sullivan Date: Fri, 9 Aug 2024 13:00:10 +0100 Subject: [PATCH] live viewer eyes tests fixes --- mantidimaging/eyes_tests/live_viewer_window_test.py | 6 +++--- mantidimaging/gui/windows/live_viewer/model.py | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/mantidimaging/eyes_tests/live_viewer_window_test.py b/mantidimaging/eyes_tests/live_viewer_window_test.py index 7d9b49bea06..89855459049 100644 --- a/mantidimaging/eyes_tests/live_viewer_window_test.py +++ b/mantidimaging/eyes_tests/live_viewer_window_test.py @@ -61,7 +61,7 @@ def test_live_view_opens_without_data(self, _mock_time, _mock_image_watcher): @mock.patch("time.time", return_value=4000.0) def test_live_view_opens_with_data(self, _mock_time, _mock_image_watcher, mock_load_image): file_list = self._make_simple_dir(self.live_directory) - image_list = [Image_Data(path) for path in file_list] + image_list = [Image_Data(path, create_delayed_array=False) for path in file_list] mock_load_image.return_value = self._generate_image() self.imaging.show_live_viewer(self.live_directory) self.imaging.live_viewer.presenter.model._handle_image_changed_in_list(image_list) @@ -72,7 +72,7 @@ def test_live_view_opens_with_data(self, _mock_time, _mock_image_watcher, mock_l @mock.patch("time.time", return_value=4000.0) def test_live_view_opens_with_bad_data(self, _mock_time, _mock_image_watcher, mock_load_image): file_list = self._make_simple_dir(self.live_directory) - image_list = [Image_Data(path) for path in file_list] + image_list = [Image_Data(path, create_delayed_array=False) for path in file_list] mock_load_image.side_effect = ValueError self.imaging.show_live_viewer(self.live_directory) self.imaging.live_viewer.presenter.model._handle_image_changed_in_list(image_list) @@ -83,7 +83,7 @@ def test_live_view_opens_with_bad_data(self, _mock_time, _mock_image_watcher, mo @mock.patch("time.time", return_value=4000.0) def test_rotate_operation_rotates_image(self, _mock_time, _mock_image_watcher, mock_load_image): file_list = self._make_simple_dir(self.live_directory) - image_list = [Image_Data(path) for path in file_list] + image_list = [Image_Data(path, create_delayed_array=False) for path in file_list] mock_load_image.return_value = self._generate_image() self.imaging.show_live_viewer(self.live_directory) self.imaging.live_viewer.presenter.model._handle_image_changed_in_list(image_list) diff --git a/mantidimaging/gui/windows/live_viewer/model.py b/mantidimaging/gui/windows/live_viewer/model.py index 9a90444c48a..23153b33f36 100644 --- a/mantidimaging/gui/windows/live_viewer/model.py +++ b/mantidimaging/gui/windows/live_viewer/model.py @@ -145,7 +145,7 @@ def __init__(self, presenter: LiveViewerWindowPresenter): self._dataset_path: Path | None = None self.image_watcher: ImageWatcher | None = None self.images: list[Image_Data] = [] - self.image_stack: DaskImageDataStack + self.image_stack: DaskImageDataStack | None @property def path(self) -> Path | None: @@ -159,8 +159,9 @@ def path(self, path: Path) -> None: self.image_watcher.recent_image_changed.connect(self.handle_image_modified) self.image_watcher._handle_notified_of_directry_change(str(path)) - def _handle_image_changed_in_list(self, image_files: list[Image_Data], - dask_image_stack: DaskImageDataStack) -> None: + def _handle_image_changed_in_list(self, + image_files: list[Image_Data], + dask_image_stack: DaskImageDataStack | None = None) -> None: """ Handle an image changed event. Update the image in the view. This method is called when the image_watcher detects a change