Move more of scan workflow UI into the server

This commit is contained in:
Julian Stirling 2026-03-08 12:26:18 +00:00
parent ca21ab03c6
commit bfef998300
2 changed files with 26 additions and 30 deletions

View file

@ -42,6 +42,7 @@ from openflexure_microscope_server.things.stage import BaseStage
from openflexure_microscope_server.ui import (
UI_ELEMENT_RESPONSE,
Accordion,
HTMLBlock,
UIElementList,
property_control_for,
)
@ -562,12 +563,8 @@ class HistoScanWorkflow(RectGridWorkflow[HistoScanSettingsModel]):
@lt.endpoint("get", "settings_ui", responses=UI_ELEMENT_RESPONSE)
def settings_ui(self) -> UIElementList:
"""Return the UI for the workflow's settings in the scan tab."""
return UIElementList(
scan_settings = UIElementList(
[
Accordion(
title="Background Detect",
children=self._background_detector.settings_ui(),
),
property_control_for(
self, "overlap", label="Image Overlap (0.1-0.7)", step=0.05
),
@ -596,6 +593,19 @@ class HistoScanWorkflow(RectGridWorkflow[HistoScanSettingsModel]):
),
]
)
return UIElementList(
[
HTMLBlock(html=f"<h4>{self.display_name}</h4><p>{self.ui_blurb}<p>"),
Accordion(
title="Background Detect",
children=self._background_detector.settings_ui(),
),
Accordion(
title="Scan Settings",
children=scan_settings,
),
]
)
class RegularGridSettingsModel(RectGridSettingsModel):
@ -682,7 +692,7 @@ class RegularGridWorkflow(RectGridWorkflow[RegularGridSettingsModel]):
@lt.endpoint("get", "settings_ui", responses=UI_ELEMENT_RESPONSE)
def settings_ui(self) -> UIElementList:
"""Return the UI for the workflow's settings in the scan tab."""
return UIElementList(
scan_settings = UIElementList(
[
property_control_for(
self, "overlap", label="Image Overlap (0.1-0.7)", step=0.05
@ -694,6 +704,15 @@ class RegularGridWorkflow(RectGridWorkflow[RegularGridSettingsModel]):
),
]
)
return UIElementList(
[
HTMLBlock(html=f"<h4>{self.display_name}</h4><p>{self.ui_blurb}<p>"),
Accordion(
title="Scan Settings",
children=scan_settings,
),
]
)
class SnakeWorkflow(RegularGridWorkflow):