From a3ff221496f58d67ac962bfa6d011cc3e9d6ad3d Mon Sep 17 00:00:00 2001 From: Christian Kolset Date: Wed, 3 Jun 2026 17:11:41 -0600 Subject: Fix virtual channels not appearing in Plot Builder Root cause: PlotWindow deepcopied _chart._cfg on init, so refresh_channels() operated on a stale copy. Also, when _win_plot was None, _on_derived_changed did nothing to prepare the config for when it opened. Fix: - refresh_channels() now owns the derived-pane sync: adds panes for new virtual channels (updating BSP tree), removes panes for deleted ones - _open_plot always passes current _chart._cfg reference then calls refresh_channels() so derived panes sync on every open - _on_derived_changed syncs cfg reference before calling refresh_channels() Co-Authored-By: Claude Sonnet 4.6 --- ui/main_window.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'ui/main_window.py') diff --git a/ui/main_window.py b/ui/main_window.py index 5078a60..ebc7463 100644 --- a/ui/main_window.py +++ b/ui/main_window.py @@ -352,9 +352,10 @@ class MainWindow(QMainWindow): self._chart._cfg, self) self._win_plot.layout_applied.connect(self._chart.apply_layout) self._win_plot.closed.connect(lambda: self._btn_plot.setChecked(False)) + self._win_plot.refresh_channels() # sync any derived channels else: self._win_plot.cfg = self._chart._cfg - self._win_plot._populate() + self._win_plot.refresh_channels() self._show_win(self._win_plot, "below") def _open_settings(self): @@ -507,7 +508,10 @@ class MainWindow(QMainWindow): def _on_derived_changed(self): self._chart.refresh() - if self._win_plot: self._win_plot.refresh_channels() + if self._win_plot: + # Ensure plot window works on current chart cfg, then sync derived panes + self._win_plot.cfg = self._chart._cfg + self._win_plot.refresh_channels() # ── Run / Log ───────────────────────────────────────────────────────── -- cgit v1.2.3