gui_client: clear plot data on connect/reconnect
Add PlotTab.clear_data() which resets _series and _units, then redraws. Called in MainWindow._connect() before opening the socket so stale data from a previous session never mingles with fresh history from the server. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+7
-1
@@ -518,7 +518,12 @@ class PlotTab(QWidget):
|
||||
for j, key in enumerate(self._traces[plot_idx]):
|
||||
self._add_chip(plot_idx, key, j)
|
||||
|
||||
# ── public update called on every new snapshot ────────────────────────────
|
||||
# ── public API ────────────────────────────────────────────────────────────
|
||||
|
||||
def clear_data(self):
|
||||
self._series.clear()
|
||||
self._units.clear()
|
||||
self._redraw()
|
||||
|
||||
def update(self, snapshot: dict):
|
||||
ts_raw = snapshot.get("ts", "")
|
||||
@@ -680,6 +685,7 @@ class MainWindow(QMainWindow):
|
||||
self._record_count = 0
|
||||
|
||||
def _connect(self, host: str, port: int):
|
||||
self._plot.clear_data()
|
||||
err = self._reader.connect_to(host, port)
|
||||
if err:
|
||||
self._connector.set_disconnected(err)
|
||||
|
||||
Reference in New Issue
Block a user