summaryrefslogtreecommitdiff
path: root/ui/strip_chart.py
diff options
context:
space:
mode:
Diffstat (limited to 'ui/strip_chart.py')
-rw-r--r--ui/strip_chart.py19
1 files changed, 16 insertions, 3 deletions
diff --git a/ui/strip_chart.py b/ui/strip_chart.py
index bdffb91..b295a8c 100644
--- a/ui/strip_chart.py
+++ b/ui/strip_chart.py
@@ -176,9 +176,13 @@ class StripChartWidget(QWidget):
for tr in spec.traces:
if not tr.visible: continue
- pen = pg.mkPen(color=tr.color, width=tr.width,
- style=_STYLES.get(tr.style, Qt.PenStyle.SolidLine))
- curve = plot.plot([], [], pen=pen, name=tr.label or tr.channel_id)
+ missing = self._signal_missing(tr.device_id, tr.channel_id)
+ 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
+ curve = plot.plot([], [], pen=pen,
+ name=f"{label} (missing)" if missing else label)
key = (tr.device_id, tr.channel_id)
self._curves.setdefault(key, []).append(
{"curve": curve, "plot": plot, "spec": spec, "pane": spec})
@@ -203,6 +207,15 @@ class StripChartWidget(QWidget):
for e in self._curves.get(key, []):
e["curve"].setVisible(enabled)
+ def _signal_missing(self, device_id: str, channel_id: str) -> bool:
+ """True if this trace's (device_id, channel_id) no longer resolves —
+ e.g. Apply & Reconnect dropped the pin — so it can be flagged instead
+ of silently freezing with no explanation."""
+ if device_id == "derived":
+ return not any(dc.channel_id == channel_id for dc in self.processor.get_derived())
+ dev = self.registry.get_instance(device_id)
+ return dev is None or dev.get_signal(channel_id) is None
+
def _lookup_channel_unit(self, device_id: str, channel_id: str) -> str:
if device_id == "derived":
for dc in self.processor.get_derived():