mirror of
https://github.com/bec-project/bec_widgets.git
synced 2025-07-14 03:31:50 +02:00
fix: monitor.py change import of ConfigDialog from relative to absolute in order to make BECPlotter be able to open it
This commit is contained in:
@ -506,7 +506,7 @@ class BECMonitor(pg.GraphicsLayoutWidget):
|
|||||||
for i, (y_signal, color) in enumerate(zip(y_signals, colors_ys)):
|
for i, (y_signal, color) in enumerate(zip(y_signals, colors_ys)):
|
||||||
y_name = y_signal["name"]
|
y_name = y_signal["name"]
|
||||||
y_entry = y_signal.get("entry", y_name)
|
y_entry = y_signal.get("entry", y_name)
|
||||||
curve_name = f"{y_name} ({y_entry})-{source_type.upper()}"
|
curve_name = f"{y_name} ({y_entry})-{source_type[0].upper()}"
|
||||||
curve_data = self.create_curve(curve_name, color)
|
curve_data = self.create_curve(curve_name, color)
|
||||||
plot.addItem(curve_data)
|
plot.addItem(curve_data)
|
||||||
self.curves_data[source_type][plot_name].append((y_name, y_entry, curve_data))
|
self.curves_data[source_type][plot_name].append((y_name, y_entry, curve_data))
|
||||||
@ -599,7 +599,7 @@ class BECMonitor(pg.GraphicsLayoutWidget):
|
|||||||
|
|
||||||
def show_config_dialog(self):
|
def show_config_dialog(self):
|
||||||
"""Show the configuration dialog."""
|
"""Show the configuration dialog."""
|
||||||
from .config_dialog import ConfigDialog
|
from bec_widgets.widgets import ConfigDialog
|
||||||
|
|
||||||
dialog = ConfigDialog(default_config=self.config)
|
dialog = ConfigDialog(default_config=self.config)
|
||||||
dialog.config_updated.connect(self.on_config_update)
|
dialog.config_updated.connect(self.on_config_update)
|
||||||
@ -631,6 +631,8 @@ class BECMonitor(pg.GraphicsLayoutWidget):
|
|||||||
self.flush()
|
self.flush()
|
||||||
elif action == "close":
|
elif action == "close":
|
||||||
self.close()
|
self.close()
|
||||||
|
elif action == "config_dialog":
|
||||||
|
self.show_config_dialog()
|
||||||
else:
|
else:
|
||||||
print(f"Unknown instruction received: {msg_content}")
|
print(f"Unknown instruction received: {msg_content}")
|
||||||
|
|
||||||
@ -771,6 +773,9 @@ class BECMonitor(pg.GraphicsLayoutWidget):
|
|||||||
msg (dict): Message received with data.
|
msg (dict): Message received with data.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# wait until new config is loaded
|
||||||
|
while "redis" not in self.database:
|
||||||
|
time.sleep(0.1)
|
||||||
self._init_database(
|
self._init_database(
|
||||||
self.plot_data, source_type_to_init="redis"
|
self.plot_data, source_type_to_init="redis"
|
||||||
) # add database entry for redis dataset
|
) # add database entry for redis dataset
|
||||||
@ -790,6 +795,7 @@ class BECMonitor(pg.GraphicsLayoutWidget):
|
|||||||
|
|
||||||
# Trigger plot update
|
# Trigger plot update
|
||||||
self.update_plot(source_type="redis")
|
self.update_plot(source_type="redis")
|
||||||
|
print(f"database after: {self.database}")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__": # pragma: no cover
|
if __name__ == "__main__": # pragma: no cover
|
||||||
@ -810,7 +816,7 @@ if __name__ == "__main__": # pragma: no cover
|
|||||||
# Load config from file
|
# Load config from file
|
||||||
config = load_yaml(args.config_file)
|
config = load_yaml(args.config_file)
|
||||||
else:
|
else:
|
||||||
config = CONFIG_REDIS
|
config = CONFIG_SIMPLE
|
||||||
|
|
||||||
client = bec_dispatcher.client
|
client = bec_dispatcher.client
|
||||||
client.start()
|
client.start()
|
||||||
|
Reference in New Issue
Block a user