Change the classes for gallery cards information to be XxxGalleryInfo

ScanInfo -> ScanGalleryInfo
CaptureInfo -> CaptureGalleryInfo - note there were two classes
called CaptureInfo, only one has been changed to deduplicate the names
This commit is contained in:
Julian Stirling 2026-07-02 16:38:18 +01:00
parent d7421ccea5
commit 90f106c87d
5 changed files with 23 additions and 23 deletions

View file

@ -45,7 +45,7 @@ class NotEnoughFreeSpaceError(InvocationError):
"""An exception raised if there is not enough free space on disk to scan."""
class ScanInfo(BaseModel):
class ScanGalleryInfo(BaseModel):
"""Summary information for the UI about a scan folder."""
name: str
@ -71,8 +71,8 @@ class BaseScanData(BaseModel):
Separating historic and active data allows workflows to use any BaseModel for its
settings, but for the data to be reloaded even if that model has updated or is not
available. Historic scan data loaded from disk is used for stitching and for
creating a ScanInfo object for communicating with the UI. These uses are clearly
typed by this model.
creating a ScanGalleryInfo object for communicating with the UI. These uses are
clearly typed by this model.
This serialises into a human readable format where possible with
@ -339,16 +339,16 @@ class ScanDirectoryManager:
@requires_lock
def all_scans_info(
self, *, ongoing: Optional[str] = None, include_ongoing: bool = True
) -> list[ScanInfo]:
"""Return a lists of ScanInfo objects for each scan.
) -> list[ScanGalleryInfo]:
"""Return a lists of ScanGalleryInfo objects for each scan.
:param ongoing: The name of the ongoing scan (or None if no scan is ongoing).
:param include_ongoing: True (dfault) to include the scan info of the ongoing
scan in the return. False to exclude it.
:return: A list of ScanInfo objects for each scan.
:return: A list of ScanGalleryInfo objects for each scan.
"""
all_info: list[ScanInfo] = []
all_info: list[ScanGalleryInfo] = []
for scan_name in self.all_scans:
scan_is_ongoing = scan_name == ongoing
if scan_is_ongoing and not include_ongoing:
@ -591,7 +591,7 @@ class ScanDirectory:
LOGGER.warning(f"Could not validate scan data for {self.name}.")
return None
def scan_info(self, skip_json: bool = False) -> ScanInfo:
def scan_info(self, skip_json: bool = False) -> ScanGalleryInfo:
"""Return the information to be used in the UI for the scan."""
scan_files = self.get_scan_files()
scan_images = self._extract_scan_images(scan_files)
@ -608,7 +608,7 @@ class ScanDirectory:
else scan_data.duration.total_seconds()
)
return ScanInfo(
return ScanGalleryInfo(
name=self.name,
created=self.created_time,
modified=self.get_modified_time(),

View file

@ -206,7 +206,7 @@ class CaptureMode(BaseModel):
"""The resolution to save the image. Use None to save as captured."""
class CaptureInfo(BaseModel):
class CaptureGalleryInfo(BaseModel):
"""Summary information for the UI about an image."""
name: str
@ -296,9 +296,9 @@ class BaseCamera(OFMThing, ABC):
_show_data_in_gallery = True
@property
def gallery_data_schema(self) -> type[CaptureInfo]:
def gallery_data_schema(self) -> type[CaptureGalleryInfo]:
"""The schema (BaseModel) for passing data to the gallery."""
return CaptureInfo
return CaptureGalleryInfo
def _all_captures(self) -> list[str]:
"""Return the full path for all captures on disk."""
@ -310,10 +310,10 @@ class BaseCamera(OFMThing, ABC):
captures.append(full_path)
return captures
def get_data_for_gallery(self) -> list[CaptureInfo]:
def get_data_for_gallery(self) -> list[CaptureGalleryInfo]:
"""Return all the information about the saved captures."""
return [
CaptureInfo(
CaptureGalleryInfo(
name=os.path.basename(capture),
created=os.path.getctime(capture),
modified=os.path.getmtime(capture),

View file

@ -172,11 +172,11 @@ class SmartScanThing(OFMThing):
_show_data_in_gallery = True
@property
def gallery_data_schema(self) -> type[scan_directories.ScanInfo]:
def gallery_data_schema(self) -> type[scan_directories.ScanGalleryInfo]:
"""The schema (BaseModel) for passing data to the gallery."""
return scan_directories.ScanInfo
return scan_directories.ScanGalleryInfo
def get_data_for_gallery(self) -> list[scan_directories.ScanInfo]:
def get_data_for_gallery(self) -> list[scan_directories.ScanGalleryInfo]:
"""Return all the information from the scan directories.
It is preferable to use the method rather than calling