summaryrefslogtreecommitdiff
path: root/ui/strip_chart.py
diff options
context:
space:
mode:
authorChristian Kolset <christian.kolset@gmail.com>2026-09-20 22:30:13 -0600
committerChristian Kolset <christian.kolset@gmail.com>2026-09-20 22:30:13 -0600
commit006366ef8099c8313ae596bf6267e9f98dfbeb5e (patch)
treecc3f76db630c21ec6422a6fd4f3053903a47d186 /ui/strip_chart.py
parentbb8be051ffffa56a01093c9f3aaa80e84748568f (diff)
Make Channel the single source of truth for a reading's name
Device tab stays hardware-only (pins, wiring, may vary per workstation); the Channels window owns the profile-facing identity. Concretely: - Fix a real regression: SerialDevice generic-format Apply & Reconnect nulled out custom channel_names/units every time (no fallback, unlike every other optional field in reconfigure()), silently reverting to sig0/sig1/... ids. - Plot legend now live-tracks the current Signal/Channel name instead of freezing tr.label at add-time, so a rename shows up without re-adding the trace. - Add an inline quick-reconnect (combo + button, pre-selects the actual current source) directly on each Channel block in the Channels window, for the common single-source case — rewiring hardware no longer means touching every Plot/pipeline that referenced it. - Collapse the Channel ID field behind an "ID ▸" advanced toggle; channel_id is already auto-derived from the name (_slug_id) and rarely needs to be seen. - Devices tab's Signal "Name" column relabeled "Label" with a tooltip — de-emphasized now that Channel name is the real identity. - Move "create a Channel from this Signal" from a column on the Devices tab's signal table to a ⊕ button on each Signal row in the Channels tab's Namespace panel — the action now lives where the identity is created, not on the hardware tab. Only that instance opts in (on_create_channel); the read-only Namespace dock on the main window is unaffected. - Floor the Namespace panel's width at its columns' natural size so dragging the Channels-tab splitter narrower can't push the ⊕ column behind the horizontal scrollbar. - Breadcrumb log when a profile-saved Signal override can't be applied because the signal_id no longer exists. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Diffstat (limited to 'ui/strip_chart.py')
-rw-r--r--ui/strip_chart.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/ui/strip_chart.py b/ui/strip_chart.py
index b295a8c..e77c092 100644
--- a/ui/strip_chart.py
+++ b/ui/strip_chart.py
@@ -180,7 +180,7 @@ class StripChartWidget(QWidget):
pen = pg.mkPen(color="#6b7280" if missing else tr.color, width=tr.width,
style=Qt.PenStyle.DashLine if missing
else _STYLES.get(tr.style, Qt.PenStyle.SolidLine))
- label = tr.label or tr.channel_id
+ label = tr.label or self._lookup_channel_name(tr.device_id, tr.channel_id)
curve = plot.plot([], [], pen=pen,
name=f"{label} (missing)" if missing else label)
key = (tr.device_id, tr.channel_id)
@@ -216,6 +216,19 @@ class StripChartWidget(QWidget):
dev = self.registry.get_instance(device_id)
return dev is None or dev.get_signal(channel_id) is None
+ def _lookup_channel_name(self, device_id: str, channel_id: str) -> str:
+ """Live display name for a trace with no user-typed label, so a
+ Signal/Channel rename shows up on the chart without re-adding the
+ trace — mirrors _lookup_channel_unit()."""
+ if device_id == "derived":
+ for dc in self.processor.get_derived():
+ if dc.channel_id == channel_id:
+ return dc.name
+ return channel_id
+ dev = self.registry.get_instance(device_id)
+ ch = dev.get_signal(channel_id) if dev else None
+ return (ch.name if ch and ch.name else channel_id)
+
def _lookup_channel_unit(self, device_id: str, channel_id: str) -> str:
if device_id == "derived":
for dc in self.processor.get_derived():