wip ids camera subscription callback

This commit is contained in:
2025-11-12 12:05:43 +01:00
parent 4e52e40da0
commit 4defa6da84
+11 -6
View File
@@ -81,6 +81,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 ##############
@@ -115,13 +116,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."""