Skip to content

Commit

Permalink
live viewer eyes tests fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeSullivan7 committed Aug 9, 2024
1 parent 77fce5c commit 2f11d90
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions mantidimaging/eyes_tests/live_viewer_window_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down
7 changes: 4 additions & 3 deletions mantidimaging/gui/windows/live_viewer/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down

0 comments on commit 2f11d90

Please sign in to comment.