Don't show buttons for ongoing scans.
This commit is contained in:
parent
29a62a278b
commit
cd6bcd196f
3 changed files with 100 additions and 56 deletions
|
|
@ -17,6 +17,7 @@ from subprocess import SubprocessError
|
|||
from fastapi import HTTPException
|
||||
from fastapi.responses import FileResponse
|
||||
import numpy as np
|
||||
from pydantic import BaseModel
|
||||
|
||||
import labthings_fastapi as lt
|
||||
|
||||
|
|
@ -39,6 +40,16 @@ CSMDep = lt.deps.direct_thing_client_dependency(
|
|||
AutofocusDep = lt.deps.direct_thing_client_dependency(AutofocusThing, "/autofocus/")
|
||||
|
||||
|
||||
class ScanListData(BaseModel):
|
||||
"""The data to be sent to the Scan List tab."""
|
||||
|
||||
scans: list[scan_directories.ScanInfo]
|
||||
"""The list of scans as ScanInfo objects"""
|
||||
|
||||
ongoing: Optional[str]
|
||||
"""The name of the ongoing scan or None"""
|
||||
|
||||
|
||||
class JPEGBlob(lt.blob.Blob):
|
||||
"""A class representing a JPEG image as a LabThings FastAPI Blob."""
|
||||
|
||||
|
|
@ -557,7 +568,7 @@ class SmartScanThing(lt.Thing):
|
|||
"""Whether to run a final stitch at the end of a successful scan."""
|
||||
|
||||
@lt.thing_property
|
||||
def scans(self) -> list[scan_directories.ScanInfo]:
|
||||
def scans(self) -> ScanListData:
|
||||
"""All the available scans.
|
||||
|
||||
Each scan has a name (which can be used to access it), along with
|
||||
|
|
@ -566,7 +577,10 @@ class SmartScanThing(lt.Thing):
|
|||
uses a regular expression, and changes to the naming scheme will
|
||||
break it.
|
||||
"""
|
||||
return self._scan_dir_manager.all_scans_info()
|
||||
return ScanListData(
|
||||
scans=self._scan_dir_manager.all_scans_info(),
|
||||
ongoing=None if self._ongoing_scan is None else self._ongoing_scan.name,
|
||||
)
|
||||
|
||||
@lt.fastapi_endpoint(
|
||||
"get",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue