mirror of
https://github.com/bec-project/bec_widgets.git
synced 2025-07-14 11:41:49 +02:00
feat: modular_app.py, device_monitor.py, config_dialog.py linked together, plot configuration can be done through GUI
This commit is contained in:
@ -15,16 +15,40 @@
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="2" column="1">
|
||||
<widget class="QGraphicsView" name="glw_2"/>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<item row="1" column="2">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Plot Config 2</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QGraphicsView" name="glw_1"/>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QPushButton" name="pushButton_setting_2">
|
||||
<property name="text">
|
||||
<string>Setting Plot 2</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2" colspan="2">
|
||||
<widget class="QGraphicsView" name="glw_2"/>
|
||||
</item>
|
||||
<item row="1" column="4">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Plot Scan Types = True</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="pushButton_setting_1">
|
||||
<property name="text">
|
||||
<string>Setting Plot 1</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
@ -32,19 +56,16 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QGraphicsView" name="glw_1"/>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QGraphicsView" name="glw_3"/>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<item row="1" column="5">
|
||||
<widget class="QPushButton" name="pushButton_setting_3">
|
||||
<property name="text">
|
||||
<string>Plot Scan Types = True</string>
|
||||
<string>Setting Plot 3</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="4" colspan="2">
|
||||
<widget class="QGraphicsView" name="glw_3"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menubar">
|
||||
@ -53,7 +74,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1433</width>
|
||||
<height>24</height>
|
||||
<height>37</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuSettings">
|
||||
|
@ -3,7 +3,7 @@ import os
|
||||
from PyQt5 import uic
|
||||
from PyQt5.QtWidgets import QMainWindow, QApplication, QVBoxLayout
|
||||
|
||||
from bec_widgets.widgets.monitor.device_monitor import BECDeviceMonitor
|
||||
from bec_widgets.widgets.monitor import BECDeviceMonitor, ConfigDialog
|
||||
|
||||
config_1 = {
|
||||
"plot_settings": {
|
||||
@ -171,6 +171,18 @@ 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)
|
||||
@ -184,6 +196,13 @@ class ModularApp(QMainWindow):
|
||||
self.bec_device_monitor_3 = BECDeviceMonitor(parent=self, config=config_scan_mode)
|
||||
self.glw_3_layout.addWidget(self.bec_device_monitor_3) # Add BECDeviceMonitor to the layout
|
||||
|
||||
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(
|
||||
monitor.update_config
|
||||
) # Connect the signal to the monitor's slot
|
||||
self.config_dialog.show() # Show the dialog
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
from bec_widgets.bec_dispatcher import bec_dispatcher
|
||||
|
Reference in New Issue
Block a user