summaryrefslogtreecommitdiff
path: root/ui/windows/devices_window.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/windows/devices_window.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/windows/devices_window.py')
-rw-r--r--ui/windows/devices_window.py20
1 files changed, 17 insertions, 3 deletions
diff --git a/ui/windows/devices_window.py b/ui/windows/devices_window.py
index eec65c8..ae88c6b 100644
--- a/ui/windows/devices_window.py
+++ b/ui/windows/devices_window.py
@@ -41,6 +41,7 @@ _STATUS_TEXT = {
class DeviceRow(QFrame):
configure_clicked = pyqtSignal(str)
remove_clicked = pyqtSignal(str)
+ name_changed = pyqtSignal(str)
def __init__(self, device):
super().__init__()
@@ -66,11 +67,14 @@ class DeviceRow(QFrame):
info_col = QVBoxLayout()
info_col.setSpacing(1)
- name = QLabel(self.device.info.name)
- name.setObjectName("deviceName")
+ self._name_edit = QLineEdit(self.device.info.name)
+ self._name_edit.setObjectName("deviceName")
+ self._name_edit.setFrame(False)
+ self._name_edit.setToolTip("Click to rename")
+ self._name_edit.editingFinished.connect(self._on_name_edited)
id_lbl = QLabel(f"{self.device.info.device_id} ยท {self.device.info.device_type}")
id_lbl.setObjectName("deviceSub")
- info_col.addWidget(name)
+ info_col.addWidget(self._name_edit)
info_col.addWidget(id_lbl)
lay.addLayout(info_col, 1)
@@ -103,6 +107,16 @@ class DeviceRow(QFrame):
self._status_lbl.setText(_STATUS_TEXT.get(self.device.status, "?"))
self._set_status_style()
+ def _on_name_edited(self):
+ new_name = self._name_edit.text().strip()
+ if not new_name:
+ self._name_edit.setText(self.device.info.name)
+ return
+ if new_name == self.device.info.name:
+ return
+ self.device.info.name = new_name
+ self.name_changed.emit(self.device.info.device_id)
+
def _set_dot_color(self):
c = _DOT_COLOR.get(self.device.status, "#475569")
self._dot.setStyleSheet(f"color:{c}; font-size:10px;")