diff --git a/mantidimaging/gui/windows/live_viewer/model.py b/mantidimaging/gui/windows/live_viewer/model.py index ed5c9a144b3..d26b5dff2fa 100644 --- a/mantidimaging/gui/windows/live_viewer/model.py +++ b/mantidimaging/gui/windows/live_viewer/model.py @@ -22,13 +22,13 @@ class Image_Data: Attributes ---------- - image_path : str + image_path : Path path to image file image_name : str name of image file image_size : int size of image file - image_modified_time : int + image_modified_time : float last modified time of image file """ @@ -70,7 +70,7 @@ class LiveViewerWindowModel: ---------- presenter : LiveViewerWindowPresenter presenter for the spectrum viewer window - path : str + path : Path path to dataset """ @@ -85,15 +85,15 @@ def __init__(self, presenter: 'LiveViewerWindowPresenter'): """ self.presenter = presenter - self._dataset_path: str | None = None + self._dataset_path: Path | None = None self.image_watcher: ImageWatcher | None = None @property - def path(self) -> str | None: + def path(self) -> Path | None: return self._dataset_path @path.setter - def path(self, path: str) -> None: + def path(self, path: Path) -> None: self._dataset_path = path self.image_watcher = ImageWatcher(path) self.image_watcher.image_changed.connect(self._handle_image_changed_in_list) @@ -123,7 +123,7 @@ class ImageWatcher(QObject): Attributes ---------- - directory : str + directory : Path path to directory to watch watcher : QFileSystemWatcher file system watcher to watch directory @@ -145,13 +145,13 @@ class ImageWatcher(QObject): """ image_changed = pyqtSignal(list) # Signal emitted when an image is added or removed - def __init__(self, directory: str): + def __init__(self, directory: Path): """ Constructor for ImageWatcher class which inherits from QObject. Parameters ---------- - directory : str + directory : Path path to directory to watch """ diff --git a/mantidimaging/gui/windows/live_viewer/presenter.py b/mantidimaging/gui/windows/live_viewer/presenter.py index af3b31c9ecd..8cda33cef65 100644 --- a/mantidimaging/gui/windows/live_viewer/presenter.py +++ b/mantidimaging/gui/windows/live_viewer/presenter.py @@ -1,6 +1,8 @@ # Copyright (C) 2023 ISIS Rutherford Appleton Laboratory UKRI # SPDX - License - Identifier: GPL-3.0-or-later from __future__ import annotations + +from pathlib import Path from typing import TYPE_CHECKING from logging import getLogger @@ -34,7 +36,7 @@ def __init__(self, view: LiveViewerWindowView, main_window: MainWindowView): self.main_window = main_window self.model = LiveViewerWindowModel(self) - def set_dataset_path(self, path: str) -> None: + def set_dataset_path(self, path: Path) -> None: """Set the path to the dataset.""" self.model.path = path diff --git a/mantidimaging/gui/windows/live_viewer/view.py b/mantidimaging/gui/windows/live_viewer/view.py index c0ebf5f42ef..a21541750c7 100644 --- a/mantidimaging/gui/windows/live_viewer/view.py +++ b/mantidimaging/gui/windows/live_viewer/view.py @@ -45,7 +45,7 @@ def show_most_recent_image(self, image: np.ndarray) -> None: def watch_directory(self) -> None: """Show the most recent image arrived in the selected directory""" - self.presenter.set_dataset_path(str(self.path)) + self.presenter.set_dataset_path(self.path) def remove_image(self) -> None: """Remove the image from the view."""