Apply suggestions from code review of branch flash-led-sim
Co-authored-by: Julian Stirling <julian@julianstirling.co.uk>
This commit is contained in:
parent
f05cb396c8
commit
676d34842a
4 changed files with 16 additions and 7 deletions
|
|
@ -340,7 +340,7 @@ class SimulatedCamera(BaseCamera):
|
||||||
pl_img = Image.fromarray(np_img.astype("uint8"))
|
pl_img = Image.fromarray(np_img.astype("uint8"))
|
||||||
return pl_img.resize((self.shape[1], self.shape[0]), Image.Resampling.BILINEAR)
|
return pl_img.resize((self.shape[1], self.shape[0]), Image.Resampling.BILINEAR)
|
||||||
|
|
||||||
@lt.action
|
def set_led(self, led_on: bool = True) -> None:
|
||||||
def set_led(self, led_on: bool = True, led_channel: str = None) -> None: # noqa: ARG002
|
def set_led(self, led_on: bool = True, led_channel: str = None) -> None: # noqa: ARG002
|
||||||
"""Set the simulated LED to on or off."""
|
"""Set the simulated LED to on or off."""
|
||||||
if led_on:
|
if led_on:
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,8 @@ from typing import Literal
|
||||||
|
|
||||||
import labthings_fastapi as lt
|
import labthings_fastapi as lt
|
||||||
|
|
||||||
from .camera import BaseCamera
|
from .camera import SimulatedCamera
|
||||||
from .stage import BaseStage
|
from .stage import SangaboardThing
|
||||||
|
|
||||||
|
|
||||||
class Illumination(lt.Thing):
|
class Illumination(lt.Thing):
|
||||||
|
|
@ -27,7 +27,7 @@ class Illumination(lt.Thing):
|
||||||
class SangaIllumination(Illumination):
|
class SangaIllumination(Illumination):
|
||||||
"""Illumination driven by a Sangaboard."""
|
"""Illumination driven by a Sangaboard."""
|
||||||
|
|
||||||
_stage: BaseStage = lt.thing_slot()
|
_stage: SangaboardThing = lt.thing_slot()
|
||||||
|
|
||||||
@lt.action
|
@lt.action
|
||||||
def flash(
|
def flash(
|
||||||
|
|
@ -51,7 +51,7 @@ class SangaIllumination(Illumination):
|
||||||
class SimulatorIllumination(Illumination):
|
class SimulatorIllumination(Illumination):
|
||||||
"""Illumination control in the simulator."""
|
"""Illumination control in the simulator."""
|
||||||
|
|
||||||
_cam: BaseCamera = lt.thing_slot()
|
_cam: SimulatedCamera = lt.thing_slot()
|
||||||
|
|
||||||
@lt.action
|
@lt.action
|
||||||
def flash(
|
def flash(
|
||||||
|
|
|
||||||
|
|
@ -173,7 +173,6 @@ class SangaboardThing(BaseStage):
|
||||||
sb.zero_position()
|
sb.zero_position()
|
||||||
self.update_position()
|
self.update_position()
|
||||||
|
|
||||||
@lt.action
|
|
||||||
def set_led(
|
def set_led(
|
||||||
self,
|
self,
|
||||||
led_on: bool = True,
|
led_on: bool = True,
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
{{ $store.state.origin }}
|
{{ $store.state.origin }}
|
||||||
</div>
|
</div>
|
||||||
<action-button
|
<action-button
|
||||||
v-if="stageType"
|
v-if="illuminationType"
|
||||||
thing="illumination"
|
thing="illumination"
|
||||||
action="flash"
|
action="flash"
|
||||||
submit-label="Flash Illumination"
|
submit-label="Flash Illumination"
|
||||||
|
|
@ -46,6 +46,13 @@
|
||||||
{{ stageType }}
|
{{ stageType }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div v-if="illuminationType">
|
||||||
|
<b>Illumination:</b>
|
||||||
|
<br />
|
||||||
|
<div>
|
||||||
|
{{ illuminationType }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<hr />
|
<hr />
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -77,6 +84,9 @@ export default {
|
||||||
stageType() {
|
stageType() {
|
||||||
return this.thingAvailable("stage") ? this.thingDescription("stage").title : undefined;
|
return this.thingAvailable("stage") ? this.thingDescription("stage").title : undefined;
|
||||||
},
|
},
|
||||||
|
illuminationType() {
|
||||||
|
return this.thingAvailable("illumination") ? this.thingDescription("illumination").title : undefined;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
async mounted() {
|
async mounted() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue