wip ids camera subscription callback

This commit is contained in:
2025-11-12 12:05:43 +01:00
parent e2e30a2803
commit 369c6c405e

View File

@@ -87,6 +87,7 @@ class IDSCamera(PSIDeviceBase):
self.image.num_rotation_90 = num_rotation_90
self.image.transpose = transpose
self._force_monochrome = force_monochrome
self.live_mode_enabled.subscribe(self.on_live_mode_changed)
############## Live Mode Methods ##############
@@ -121,13 +122,17 @@ class IDSCamera(PSIDeviceBase):
def live_mode(self, value: bool):
"""Set the live mode for the camera."""
if value != bool(self.live_mode_enabled.get()):
if self.cam._connected is False: # $ pylint: disable=protected-access
self.cam.on_connect()
self.live_mode_enabled.put(bool(value))
if value:
self._start_live()
else:
self._stop_live()
def on_live_mode_changed(self, *args, value, **kwargs):
"""Callback for when live mode is changed."""
if self.cam._connected is False: # $ pylint: disable=protected-access
self.cam.on_connect()
self.live_mode_enabled.put(bool(value))
if value:
self._start_live()
else:
self._stop_live()
def set_rect_roi(self, x: int, y: int, width: int, height: int):
"""Set the rectangular region of interest (ROI) for the camera."""