diff options
| author | Christian Kolset <christian.kolset@gmail.com> | 2026-06-09 20:14:54 -0600 |
|---|---|---|
| committer | Christian Kolset <christian.kolset@gmail.com> | 2026-06-09 20:14:54 -0600 |
| commit | 0fa0568c06fd770ad104b464197b3bb03123f38e (patch) | |
| tree | 7706a8a8145ea6f595b641cdfabaaa3f851d30ae /ui/add_device_dialog.py | |
| parent | b776e70b4cd94c5d1f53dde39b2e46f6447cac3e (diff) | |
UI: streamline Add Device dialog and serial config widget
Add Device dialog:
- Replace Available Devices QGroupBox with plain devWindowTitle label
to match Configuration section style β no box/border
- Auto-scan on open via QTimer.singleShot(0)
- Rename Scan All β Refresh
Serial config widget:
- Fix gap between protocol panel and Available Serial Ports: introduce
_AdaptiveStack (QStackedWidget subclass) that reports only the current
panel's sizeHint; set Fixed vertical size policy so the stack never
expands beyond its content regardless of window size
- Stretch added between Available Serial Ports and Apply & Reconnect so
the button stays pinned to the bottom
- Rename Channels β Signals in _GenericPanel and _SCPIPanel (Signal Queries)
Config dialog (device info tab):
- Rename Channels β Signals
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'ui/add_device_dialog.py')
| -rw-r--r-- | ui/add_device_dialog.py | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/ui/add_device_dialog.py b/ui/add_device_dialog.py index f0cbde1..2956a96 100644 --- a/ui/add_device_dialog.py +++ b/ui/add_device_dialog.py @@ -8,7 +8,7 @@ from PyQt6.QtWidgets import ( QDialog, QVBoxLayout, QHBoxLayout, QFormLayout, QComboBox, QLineEdit, QSpinBox, QDoubleSpinBox, QCheckBox, QPushButton, QLabel, QMessageBox, - QStackedWidget, QWidget, QGroupBox, QListWidget, + QStackedWidget, QWidget, QListWidget, QListWidgetItem, QFrame, QSizePolicy, ) from PyQt6.QtCore import Qt, QThread, pyqtSignal @@ -58,10 +58,10 @@ class _DeviceListScanner(QWidget): lay.setSpacing(4) top = QHBoxLayout() - self._scan_btn = QPushButton("π Scan All") + self._scan_btn = QPushButton("π Refresh") self._scan_btn.setObjectName("addTraceBtn") self._scan_btn.clicked.connect(self.scan_all) - self._status = QLabel("Click Scan to detect devices") + self._status = QLabel("Scanningβ¦") self._status.setObjectName("traceSource") top.addWidget(self._scan_btn) top.addWidget(self._status, 1) @@ -248,13 +248,13 @@ class AddDeviceDialog(QDialog): root.addWidget(_divider()) # ββ Available Devices βββββββββββββββββββββββββββββββββββββββββββββ - avail_grp = QGroupBox("Available Devices") - avail_lay = QVBoxLayout(avail_grp) - avail_lay.setSpacing(6) + avail_hdr = QLabel("Available Devices") + avail_hdr.setObjectName("devWindowTitle") + root.addWidget(avail_hdr) self._scanner = _DeviceListScanner() self._scanner.device_selected.connect(self._on_device_selected) - avail_lay.addWidget(self._scanner) + root.addWidget(self._scanner) conn_form = QFormLayout() conn_form.setSpacing(6) @@ -278,8 +278,7 @@ class AddDeviceDialog(QDialog): self._sim_chk = QCheckBox("Simulation mode") conn_form.addRow(self._sim_chk) - avail_lay.addLayout(conn_form) - root.addWidget(avail_grp) + root.addLayout(conn_form) root.addWidget(_divider()) @@ -331,6 +330,9 @@ class AddDeviceDialog(QDialog): self._on_type_changed(0) + from PyQt6.QtCore import QTimer + QTimer.singleShot(0, self._scanner.scan_all) + # ββ Handlers ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ def _on_device_selected(self, kind: str, value): |
