mirror of
https://github.com/bec-project/bec_widgets.git
synced 2026-01-01 03:21:19 +01:00
feat: emit the full bec message to slots
* some widgets will require metadata for their operation
This commit is contained in:
@@ -11,9 +11,9 @@ from .scan_plot import BECScanPlot
|
||||
|
||||
|
||||
class BEC_UI(QMainWindow):
|
||||
new_scan_data = pyqtSignal(dict)
|
||||
new_scan_data = pyqtSignal("PyQt_PyObject")
|
||||
new_dap_data = pyqtSignal(dict) # signal per proc instance?
|
||||
new_scan = pyqtSignal()
|
||||
new_scan = pyqtSignal("PyQt_PyObject")
|
||||
|
||||
def __init__(self, uipath):
|
||||
super().__init__()
|
||||
@@ -47,13 +47,13 @@ class BEC_UI(QMainWindow):
|
||||
scan_lock = RLock()
|
||||
|
||||
def _scan_cb(msg):
|
||||
msg = BECMessage.ScanMessage.loads(msg.value)
|
||||
msg = BECMessage.ScanMessage.loads(msg.value)[0]
|
||||
with scan_lock:
|
||||
scan_id = msg[0].content["scanID"]
|
||||
scan_id = msg.content["scanID"]
|
||||
if self._scan_id != scan_id:
|
||||
self._scan_id = scan_id
|
||||
self.new_scan.emit()
|
||||
self.new_scan_data.emit(msg[0].content["data"])
|
||||
self.new_scan.emit(msg)
|
||||
self.new_scan_data.emit(msg)
|
||||
|
||||
bec_connector = RedisConnector("localhost:6379")
|
||||
|
||||
|
||||
@@ -41,16 +41,18 @@ class BECScanPlot(pg.PlotWidget):
|
||||
if len(self.scan_curves) == 1:
|
||||
plot_item.setLabel("left", next(iter(self.scan_curves)))
|
||||
|
||||
@pyqtSlot()
|
||||
def clearData(self):
|
||||
@pyqtSlot("PyQt_PyObject")
|
||||
def clearData(self, _msg):
|
||||
for plot_curve in {**self.scan_curves, **self.dap_curves}.values():
|
||||
plot_curve.setData(x=[], y=[])
|
||||
|
||||
@pyqtSlot(dict)
|
||||
def redraw_scan(self, data):
|
||||
@pyqtSlot("PyQt_PyObject")
|
||||
def redraw_scan(self, msg):
|
||||
if not self.x_channel:
|
||||
return
|
||||
|
||||
data = msg.content["data"]
|
||||
|
||||
if self.x_channel not in data:
|
||||
logger.warning(f"Unknown channel `{self.x_channel}` for X data in {self.objectName()}")
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user