mirror of
https://github.com/bec-project/bec_widgets.git
synced 2026-08-07 18:52:39 +02:00
fix: adapt code to BEC 1.0
This commit is contained in:
@@ -102,7 +102,7 @@ class StreamApp(QWidget):
|
||||
|
||||
@staticmethod
|
||||
def _streamer_cb(msg, *, parent, **_kwargs) -> None:
|
||||
msgMCS = messages.DeviceMessage.loads(msg.value)
|
||||
msgMCS = msg.value
|
||||
print(msgMCS)
|
||||
row = msgMCS.content["signals"][parent.sub_device]
|
||||
metadata = msgMCS.metadata
|
||||
@@ -123,7 +123,7 @@ class StreamApp(QWidget):
|
||||
def _device_cv(msg, *, parent, **_kwargs) -> None:
|
||||
print("Getting ScanID")
|
||||
|
||||
msgDEV = messages.ScanStatusMessage.loads(msg.value)
|
||||
msgDEV = msg.value
|
||||
|
||||
current_scanID = msgDEV.content["scanID"]
|
||||
|
||||
|
||||
@@ -1297,7 +1297,7 @@ class MotorControl(QThread):
|
||||
|
||||
@staticmethod
|
||||
def _device_status_callback_motors(msg, *, parent, **_kwargs) -> None:
|
||||
deviceMSG = messages.DeviceMessage.loads(msg.value)
|
||||
deviceMSG = msg.value
|
||||
if parent.motor_x.name in deviceMSG.content["signals"]:
|
||||
parent.current_x = deviceMSG.content["signals"][parent.motor_x.name]["value"]
|
||||
elif parent.motor_y.name in deviceMSG.content["signals"]:
|
||||
|
||||
@@ -271,7 +271,7 @@ class StreamPlot(QtWidgets.QWidget):
|
||||
continue
|
||||
endpoint = f"px_stream/projection_{self._current_proj}/data"
|
||||
msgs = self.client.producer.lrange(topic=endpoint, start=-1, end=-1)
|
||||
data = [messages.DeviceMessage.loads(msg) for msg in msgs]
|
||||
data = msgs
|
||||
if not data:
|
||||
continue
|
||||
with np.errstate(divide="ignore", invalid="ignore"):
|
||||
|
||||
@@ -10,7 +10,7 @@ import os
|
||||
from collections.abc import Callable
|
||||
from typing import Union
|
||||
|
||||
from bec_lib import BECClient, messages, ServiceConfig
|
||||
from bec_lib import BECClient, ServiceConfig
|
||||
from bec_lib.redis_connector import RedisConsumerThreaded
|
||||
from qtpy.QtCore import QObject, Signal as pyqtSignal
|
||||
|
||||
@@ -76,7 +76,7 @@ class _BECDispatcher(QObject):
|
||||
"""Creates a new connection for given topics."""
|
||||
|
||||
def cb(msg):
|
||||
msg = messages.MessageReader.loads(msg.value)
|
||||
msg = msg.value
|
||||
if not isinstance(msg, list):
|
||||
msg = [msg]
|
||||
for msg_i in msg:
|
||||
|
||||
@@ -119,8 +119,7 @@ class ScanControl(QWidget):
|
||||
|
||||
def populate_scans(self):
|
||||
"""Populates the scan selection combo box with available scans"""
|
||||
msg = self.client.producer.get(MessageEndpoints.available_scans())
|
||||
self.available_scans = msgpack.loads(msg)
|
||||
self.available_scans = self.client.producer.get(MessageEndpoints.available_scans()).resource
|
||||
if self.allowed_scans is None:
|
||||
allowed_scans = self.available_scans.keys()
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user