summaryrefslogtreecommitdiff
path: root/ui/config_dialog.py
diff options
context:
space:
mode:
Diffstat (limited to 'ui/config_dialog.py')
-rw-r--r--ui/config_dialog.py35
1 files changed, 17 insertions, 18 deletions
diff --git a/ui/config_dialog.py b/ui/config_dialog.py
index 7d87772..4976b36 100644
--- a/ui/config_dialog.py
+++ b/ui/config_dialog.py
@@ -16,7 +16,8 @@ class DeviceConfigDialog(QDialog):
super().__init__(parent)
self.device = device
self.setWindowTitle(f"Configure — {device.info.name} [{device.info.device_id}]")
- self.setMinimumSize(520, 460)
+ self.setMinimumSize(580, 520)
+ self.resize(640, 580)
self._build()
def _build(self):
@@ -26,13 +27,18 @@ class DeviceConfigDialog(QDialog):
tabs = QTabWidget()
# ── Tab 1: Device-specific widget ────────────────────────────
+ cfg_widget = self.device.get_config_widget()
scroll = QScrollArea()
scroll.setWidgetResizable(True)
- scroll.setWidget(self.device.get_config_widget())
+ scroll.setHorizontalScrollBarPolicy(
+ __import__("PyQt6.QtCore", fromlist=["Qt"]).Qt.ScrollBarPolicy.ScrollBarAsNeeded
+ )
+ scroll.setMinimumWidth(460)
+ scroll.setWidget(cfg_widget)
tabs.addTab(scroll, "Hardware / Backend")
# ── Tab 2: Channel settings ───────────────────────────────────
- tabs.addTab(self._channel_tab(), "Channels & Alarms")
+ tabs.addTab(self._channel_tab(), "Channels")
# ── Tab 3: Device info ────────────────────────────────────────
tabs.addTab(self._info_tab(), "Info")
@@ -62,28 +68,21 @@ class DeviceConfigDialog(QDialog):
en_chk = QCheckBox()
en_chk.setChecked(ch.enabled)
- lo = QDoubleSpinBox(); lo.setRange(-1e9, 1e9); lo.setValue(ch.alarm_low or 0.0)
- hi = QDoubleSpinBox(); hi.setRange(-1e9, 1e9); hi.setValue(ch.alarm_high or 100.0)
-
- form.addRow("Name:", name_e)
- form.addRow("Unit:", unit_e)
- form.addRow("Enabled:", en_chk)
- form.addRow("Alarm Low:", lo)
- form.addRow("Alarm High:", hi)
+ form.addRow("Name:", name_e)
+ form.addRow("Unit:", unit_e)
+ form.addRow("Enabled:", en_chk)
apply = QPushButton("Apply")
apply.setObjectName("applyButton")
- def _make_apply(c, ne, ue, ec, ls, hs):
+ def _make_apply(c, ne, ue, ec):
def _do():
- c.name = ne.text()
- c.unit = ue.text()
- c.enabled = ec.isChecked()
- c.alarm_low = ls.value()
- c.alarm_high = hs.value()
+ c.name = ne.text()
+ c.unit = ue.text()
+ c.enabled = ec.isChecked()
return _do
- apply.clicked.connect(_make_apply(ch, name_e, unit_e, en_chk, lo, hi))
+ apply.clicked.connect(_make_apply(ch, name_e, unit_e, en_chk))
form.addRow(apply)
layout.addWidget(grp)