now showing motor positions
CI for csaxs_bec / test (push) Successful in 1m31s

This commit is contained in:
x12sa
2026-07-01 12:25:44 +02:00
parent 23a81cd67e
commit 74c9a71819
@@ -5,7 +5,6 @@ from bec_lib.endpoints import MessageEndpoints
from bec_widgets import BECWidget, SafeSlot
from bec_widgets.utils.rpc_decorator import rpc_timeout
from qtpy.QtCore import Qt
from qtpy.QtGui import QDoubleValidator
from qtpy.QtWidgets import (
QButtonGroup,
QDoubleSpinBox,
@@ -27,10 +26,10 @@ _UP = "\u2191" # ↑
_DOWN = "\u2193" # ↓
_LEFT = "\u2190" # ←
_RIGHT = "\u2192" # →
_SHRINK_X = "\u2192\u2190" # →← decrease x size
_GROW_X = "\u2190\u2192" # ←→ increase x size
_SHRINK_Y = "\u2191\u2193" # ↑↓ decrease y size
_GROW_Y = "\u2193\u2191" # ↓↑ increase y size
_SHRINK_X = "\u2192\u2190" # →← decrease x size (inward)
_GROW_X = "\u2190\u2192" # ←→ increase x size (outward)
_GROW_Y = "\u2191\u2193" # ↑↓ outward (90° rotation of ←→)
_SHRINK_Y = "\u2193\u2191" # ↓↑ inward (90° rotation of →←)
def _separator() -> QFrame:
@@ -53,9 +52,8 @@ class SlitControlWidget(BECWidget, QWidget):
- Readback table: horizontal / vertical rows × center / size columns,
updated live via Redis subscription
Movement is dispatched through ``scans.umvr``, exactly as in the CLI
macros, keeping the same queue / callback path used everywhere else at
cSAXS.
Movement reads the current position via ``device.read()`` then dispatches
an absolute ``scans.umv`` — the same path used by the CLI macros.
"""
PLUGIN = True
@@ -282,9 +280,9 @@ class SlitControlWidget(BECWidget, QWidget):
):
dev_name = self._dev_name(suffix)
try:
device = self.device_manager.devices[dev_name]
device = getattr(self.dev, dev_name)
reading = device.read()
value = reading[dev_name]["value"]
value = float(reading[dev_name]["value"])
label.setText(f"{value:.4f}")
except Exception:
label.setText("---")
@@ -337,9 +335,14 @@ class SlitControlWidget(BECWidget, QWidget):
def _move_relative(self, axis_suffix: str, delta: float):
dev_name = self._dev_name(axis_suffix)
device = self.device_manager.devices[dev_name]
# Mirror the umvr call path used in the CLI macros.
self.scans.umvr(device, delta)
try:
device = getattr(self.dev, dev_name)
reading = device.read()
current = float(reading[dev_name]["value"])
target = current + delta
self.scans.umv(device, target)
except Exception as exc:
logger.warning(f"SlitControlWidget: failed to move {dev_name}: {exc}")
def set_step(self, value: float):
"""Set the shared step size in mm (clamped to 0.005 2.0 mm)."""
@@ -370,4 +373,4 @@ class SlitControlWidget(BECWidget, QWidget):
def cleanup(self):
self._unsubscribe_readbacks()
super().cleanup()
super().cleanup()