Move more of scan workflow UI into the server
This commit is contained in:
parent
ca21ab03c6
commit
bfef998300
2 changed files with 26 additions and 30 deletions
|
|
@ -42,6 +42,7 @@ from openflexure_microscope_server.things.stage import BaseStage
|
||||||
from openflexure_microscope_server.ui import (
|
from openflexure_microscope_server.ui import (
|
||||||
UI_ELEMENT_RESPONSE,
|
UI_ELEMENT_RESPONSE,
|
||||||
Accordion,
|
Accordion,
|
||||||
|
HTMLBlock,
|
||||||
UIElementList,
|
UIElementList,
|
||||||
property_control_for,
|
property_control_for,
|
||||||
)
|
)
|
||||||
|
|
@ -562,12 +563,8 @@ class HistoScanWorkflow(RectGridWorkflow[HistoScanSettingsModel]):
|
||||||
@lt.endpoint("get", "settings_ui", responses=UI_ELEMENT_RESPONSE)
|
@lt.endpoint("get", "settings_ui", responses=UI_ELEMENT_RESPONSE)
|
||||||
def settings_ui(self) -> UIElementList:
|
def settings_ui(self) -> UIElementList:
|
||||||
"""Return the UI for the workflow's settings in the scan tab."""
|
"""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(
|
property_control_for(
|
||||||
self, "overlap", label="Image Overlap (0.1-0.7)", step=0.05
|
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):
|
class RegularGridSettingsModel(RectGridSettingsModel):
|
||||||
|
|
@ -682,7 +692,7 @@ class RegularGridWorkflow(RectGridWorkflow[RegularGridSettingsModel]):
|
||||||
@lt.endpoint("get", "settings_ui", responses=UI_ELEMENT_RESPONSE)
|
@lt.endpoint("get", "settings_ui", responses=UI_ELEMENT_RESPONSE)
|
||||||
def settings_ui(self) -> UIElementList:
|
def settings_ui(self) -> UIElementList:
|
||||||
"""Return the UI for the workflow's settings in the scan tab."""
|
"""Return the UI for the workflow's settings in the scan tab."""
|
||||||
return UIElementList(
|
scan_settings = UIElementList(
|
||||||
[
|
[
|
||||||
property_control_for(
|
property_control_for(
|
||||||
self, "overlap", label="Image Overlap (0.1-0.7)", step=0.05
|
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):
|
class SnakeWorkflow(RegularGridWorkflow):
|
||||||
|
|
|
||||||
|
|
@ -16,17 +16,8 @@
|
||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<h4 v-if="workflowDisplayName" class="workflow-name">
|
<server-specified-interface :elements="workflowSettings" />
|
||||||
{{ workflowDisplayName }}
|
|
||||||
</h4>
|
|
||||||
<p class="workflow-blurb">{{ workflowBlurb }}</p>
|
|
||||||
<ul uk-accordion="multiple: true">
|
<ul uk-accordion="multiple: true">
|
||||||
<li>
|
|
||||||
<a class="uk-accordion-title" href="#">Scan Settings</a>
|
|
||||||
<div class="uk-accordion-content">
|
|
||||||
<server-specified-interface :elements="workflowSettings" />
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
<li class="uk-open">
|
<li class="uk-open">
|
||||||
<a class="uk-accordion-title" href="#">Stitching Settings</a>
|
<a class="uk-accordion-title" href="#">Stitching Settings</a>
|
||||||
<div class="uk-accordion-content">
|
<div class="uk-accordion-content">
|
||||||
|
|
@ -152,8 +143,6 @@ export default {
|
||||||
scan_name: "",
|
scan_name: "",
|
||||||
workflowName: undefined,
|
workflowName: undefined,
|
||||||
workflowSettings: [],
|
workflowSettings: [],
|
||||||
workflowDisplayName: undefined,
|
|
||||||
workflowBlurb: undefined,
|
|
||||||
workflowOptions: [],
|
workflowOptions: [],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
@ -206,12 +195,6 @@ export default {
|
||||||
this.ready = await this.readThingProperty(this.workflowName, "ready", true);
|
this.ready = await this.readThingProperty(this.workflowName, "ready", true);
|
||||||
this.workflowSettings =
|
this.workflowSettings =
|
||||||
(await this.getThingEndpoint(this.workflowName, "settings_ui")) || [];
|
(await this.getThingEndpoint(this.workflowName, "settings_ui")) || [];
|
||||||
this.workflowDisplayName = await this.readThingProperty(
|
|
||||||
this.workflowName,
|
|
||||||
"display_name",
|
|
||||||
true,
|
|
||||||
);
|
|
||||||
this.workflowBlurb = await this.readThingProperty(this.workflowName, "ui_blurb", true);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onScanError: function (error) {
|
onScanError: function (error) {
|
||||||
|
|
@ -290,10 +273,4 @@ export default {
|
||||||
.control-component {
|
.control-component {
|
||||||
width: 33%;
|
width: 33%;
|
||||||
}
|
}
|
||||||
.workflow-name {
|
|
||||||
margin-bottom: 0.5rem;
|
|
||||||
}
|
|
||||||
.workflow-blurb {
|
|
||||||
color: #a2a2a2;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue