fix(x_ray_eye): remove camera shutdown during cleanup
This commit is contained in:
@@ -789,7 +789,8 @@ class XRayEye(BECWidget, QWidget):
|
||||
self.dev.omny_xray_gui.submit.set(1)
|
||||
|
||||
def cleanup(self):
|
||||
"""Cleanup connections on widget close -> disconnect slots and stop live mode of camera."""
|
||||
"""Cleanup connections on widget close."""
|
||||
|
||||
self._queue_idle_timer.stop()
|
||||
self._closing = True
|
||||
if self._connected_motor is not None:
|
||||
@@ -810,24 +811,17 @@ class XRayEye(BECWidget, QWidget):
|
||||
self.getting_xray_gui_readback, MessageEndpoints.device_readback("omny_xray_gui")
|
||||
)
|
||||
|
||||
self._run_device_action_async(
|
||||
getattr(self.dev, CAMERA[0]).stop_live_mode,
|
||||
"stop camera live mode",
|
||||
allow_during_cleanup=True,
|
||||
)
|
||||
self._join_device_actions(timeout=1.0)
|
||||
super().cleanup()
|
||||
|
||||
def _run_device_action_async(
|
||||
self, action, description: str, *, allow_during_cleanup: bool = False
|
||||
) -> threading.Thread | None:
|
||||
if self._closing and not allow_during_cleanup:
|
||||
def _run_device_action_async(self, action, description: str) -> threading.Thread | None:
|
||||
if self._closing:
|
||||
logger.debug(f"Skipping device action during XRayEye cleanup: {description}")
|
||||
return None
|
||||
|
||||
def runner():
|
||||
try:
|
||||
if self._closing and not allow_during_cleanup:
|
||||
if self._closing:
|
||||
return
|
||||
action()
|
||||
except Exception as exc:
|
||||
@@ -838,7 +832,7 @@ class XRayEye(BECWidget, QWidget):
|
||||
|
||||
thread = threading.Thread(target=runner, daemon=True, name=f"XRayEye: {description}")
|
||||
with self._device_action_lock:
|
||||
if self._closing and not allow_during_cleanup:
|
||||
if self._closing:
|
||||
return None
|
||||
self._device_action_threads.add(thread)
|
||||
thread.start()
|
||||
|
||||
Reference in New Issue
Block a user