diff --git a/bec_widgets/examples/modular_app/modular_app.py b/bec_widgets/examples/modular_app/modular_app.py index f380b2a6..e64fef5f 100644 --- a/bec_widgets/examples/modular_app/modular_app.py +++ b/bec_widgets/examples/modular_app/modular_app.py @@ -68,6 +68,17 @@ config_2 = { "signals": [{"name": "gauss_adc1", "entry": "gauss_adc1"}], }, }, + { + "plot_name": "Plot 3", + "x": { + "label": "Motor X", + "signals": [{"name": "samx", "entry": "samx"}], + }, + "y": { + "label": "Gauss ADC", + "signals": [{"name": "gauss_adc3", "entry": "gauss_adc3"}], + }, + }, ], } config_scan_mode = config = { @@ -171,37 +182,39 @@ class ModularApp(QMainWindow): self._init_plots() - # Config Dialog - self.config_dialog = ConfigDialog() - self.pushButton_setting_1.clicked.connect( - lambda: self.show_config_dialog(config_1, self.bec_device_monitor_1) - ) - self.pushButton_setting_2.clicked.connect( - lambda: self.show_config_dialog(config_2, self.bec_device_monitor_2) - ) - self.pushButton_setting_3.clicked.connect( - lambda: self.show_config_dialog(config_scan_mode, self.bec_device_monitor_3) - ) - def _init_plots(self): self.glw_1_layout = QVBoxLayout(self.glw_1) # Create a new QVBoxLayout self.bec_device_monitor_1 = BECDeviceMonitor(parent=self, config=config_1) + self.config_dialog_1 = ConfigDialog() self.glw_1_layout.addWidget(self.bec_device_monitor_1) # Add BECDeviceMonitor to the layout + self.pushButton_setting_1.clicked.connect( + lambda: self.show_config_dialog(self.bec_device_monitor_1, self.config_dialog_1) + ) self.glw_2_layout = QVBoxLayout(self.glw_2) # Create a new QVBoxLayout self.bec_device_monitor_2 = BECDeviceMonitor(parent=self, config=config_2) + self.config_dialog_2 = ConfigDialog() self.glw_2_layout.addWidget(self.bec_device_monitor_2) # Add BECDeviceMonitor to the layout + self.pushButton_setting_2.clicked.connect( + lambda: self.show_config_dialog(self.bec_device_monitor_2, self.config_dialog_2) + ) self.glw_3_layout = QVBoxLayout(self.glw_3) # Create a new QVBoxLayout self.bec_device_monitor_3 = BECDeviceMonitor(parent=self, config=config_scan_mode) + self.config_dialog_3 = ConfigDialog() self.glw_3_layout.addWidget(self.bec_device_monitor_3) # Add BECDeviceMonitor to the layout + self.pushButton_setting_3.clicked.connect( + lambda: self.show_config_dialog(self.bec_device_monitor_3, self.config_dialog_3) + ) - def show_config_dialog(self, config, monitor): - self.config_dialog.load_config(config) # Load the configuration into the dialog - self.config_dialog.config_updated.connect( + def show_config_dialog(self, monitor, config_dialog): + config = monitor.get_config() + + config_dialog.load_config(config) # Load the configuration into the dialog + config_dialog.config_updated.connect( monitor.update_config ) # Connect the signal to the monitor's slot - self.config_dialog.show() # Show the dialog + config_dialog.show() # Show the dialog if __name__ == "__main__": diff --git a/bec_widgets/widgets/monitor/device_monitor.py b/bec_widgets/widgets/monitor/device_monitor.py index b6b27641..b9407d4a 100644 --- a/bec_widgets/widgets/monitor/device_monitor.py +++ b/bec_widgets/widgets/monitor/device_monitor.py @@ -228,6 +228,9 @@ class BECDeviceMonitor(pg.GraphicsLayoutWidget): curve.setData(data_x, data_y) + def get_config(self): + return self.config + @pyqtSlot(dict) def update_config(self, config): self.config = config