diff options
Diffstat (limited to 'ui/strip_chart.py')
| -rw-r--r-- | ui/strip_chart.py | 15 |
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(): |
