summaryrefslogtreecommitdiff
path: root/ui/add_device_dialog.py
diff options
context:
space:
mode:
authorChristian Kolset <ckolset@colostate.edu>2026-08-10 16:12:05 -0600
committerChristian Kolset <ckolset@colostate.edu>2026-08-10 16:12:05 -0600
commit5d5bcaed8639a162fda85c8cd0d340c296a054b8 (patch)
treea7a1a62fb607c9c85127dab4aab17ccf8e22c906 /ui/add_device_dialog.py
parent46231c00994cd681d598961f2056dbda31c3e483 (diff)
Unify Signals/Channels around auto-naming, plot-by-channel, and shared vars
Devices: auto-name from OS-reported port description (Device Manager / udev string) instead of a generic label; default Serial #Channels 1; consistent simulate-mode checkbox across backends; inline device rename. Channels: calibration/filters move out of Signals into a Channel "Operation" (adds Scale/Offset alongside the existing math kinds); single-physical-source Channels get an embedded Filters block; new Channels auto-name/auto-ID from their source and reject duplicate names/IDs on apply; "Create Channel" button on each Signal row; renamed "Sources" -> "Signals" in the Channels UI; Signals' READ/WRITE dir badge (was silently-broken IN/OUT) now reflects the real writable flag. Plot: default layout is one pane per Channel (not per device, not raw Signals) titled by channel name; "+ Add Channel" is a checkbox dialog instead of an inline dropdown; traces get up/down reorder; live unit changes (e.g. a Mark-10 gauge switching lb/kgF/N/ozF) propagate to an open pane's axis label without clobbering a manually-typed one. Control Panel: hardware assignment now picks from the same writable- Signals list instead of a separate device/channel combo with a hardcoded Arduino pin list; stale visual indicator when a control's target device/channel disconnects or disappears; documented the `vars` bridge (Control Panel On Action Script <-> Channel scripts) in both directions' help text and script templates. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Diffstat (limited to 'ui/add_device_dialog.py')
-rw-r--r--ui/add_device_dialog.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/ui/add_device_dialog.py b/ui/add_device_dialog.py
index 2bf0233..719c5a2 100644
--- a/ui/add_device_dialog.py
+++ b/ui/add_device_dialog.py
@@ -152,13 +152,20 @@ class _DeviceListScanner(QWidget):
class SerialPanel(QWidget):
def __init__(self):
super().__init__()
- lay = QVBoxLayout(self)
+ lay = QFormLayout(self)
lay.setContentsMargins(0, 4, 0, 4)
- note = QLabel("Additional protocol settings available in the device config dialog.")
+
+ self.ch_spin = QSpinBox()
+ self.ch_spin.setRange(1, 32)
+ self.ch_spin.setValue(1)
+ lay.addRow("#Channels:", self.ch_spin)
+
+ note = QLabel("Applies to Key:Value / CSV / JSON formats. "
+ "SCPI / Modbus / Mark-10 / CML define channels via their own protocol tables "
+ "(available in the device config dialog after adding).")
note.setObjectName("traceSource")
note.setWordWrap(True)
- lay.addWidget(note)
- lay.addStretch()
+ lay.addRow(note)
class ArduinoPanel(QWidget):
@@ -302,7 +309,7 @@ class AddDeviceDialog(QDialog):
cfg_form.addRow("Device ID:", self._id_edit)
self._name_edit = QLineEdit()
- self._name_edit.setPlaceholderText("Leave blank to use the default type name")
+ self._name_edit.setPlaceholderText("Leave blank to auto-name from device + port")
cfg_form.addRow("Display Name:", self._name_edit)
self._fmt_cb = QComboBox()
@@ -429,6 +436,7 @@ class AddDeviceDialog(QDialog):
dev = SerialDevice(
device_id=dev_id, port=port, baud_rate=baud,
parse_format=fmt, simulate=sim,
+ num_channels=panel.ch_spin.value(),
)
elif type_name == "Arduino":
from devices.arduino_device import _parse_pin_edit, _parse_analog_pin_edit