From 012a1093e3cb9a1b376fc3beee4df859ccfb8da5 Mon Sep 17 00:00:00 2001 From: Christian Kolset Date: Thu, 13 Aug 2026 10:59:25 -0600 Subject: Fixed loading profiles data retention and display. --- ui/windows/config_window.py | 6 +++++- ui/windows/plot_window.py | 29 ++++------------------------- 2 files changed, 9 insertions(+), 26 deletions(-) (limited to 'ui/windows') diff --git a/ui/windows/config_window.py b/ui/windows/config_window.py index 64c669d..52612fc 100644 --- a/ui/windows/config_window.py +++ b/ui/windows/config_window.py @@ -347,6 +347,8 @@ class ConfigWindow(QWidget): row.name_changed.connect(self._on_device_renamed) self._dev_inner.insertWidget(self._dev_inner.count() - 1, row) self._dev_rows[dev.info.device_id] = row + if hasattr(self, "_signals_tab"): + self._signals_tab.refresh() def _refresh_device_status(self): for row in self._dev_rows.values(): @@ -375,7 +377,7 @@ class ConfigWindow(QWidget): dev = self.registry.get_instance(device_id) if dev: DeviceConfigDialog(dev, self).exec() - self._signals_tab.refresh() + self.refresh_devices() # rebuilds device rows — picks up new channel count self._pipeline_tab.on_device_reconfigured(device_id) self.device_reconfigured.emit(device_id) @@ -429,6 +431,8 @@ class ConfigWindow(QWidget): self._pipeline_tab = PipelineTab(self.registry, self.processor) self._pipeline_tab.changed.connect(self.pipeline_changed) self._pipeline_tab.derived_changed.connect(self.derived_changed) + self._pipeline_tab.refresh_derived() # load derived channels already in processor + # (e.g. window built fresh after profile load) inner_splitters = self._pipeline_tab.findChildren(QSplitter) if inner_splitters: inner_splitters[0].widget(0).setVisible(False) diff --git a/ui/windows/plot_window.py b/ui/windows/plot_window.py index 119efab..dc1617b 100644 --- a/ui/windows/plot_window.py +++ b/ui/windows/plot_window.py @@ -1092,33 +1092,12 @@ class PlotWindow(QWidget): QMessageBox.critical(self, "Import failed", str(e)) def refresh_channels(self): - """Sync virtual channel panes then rebuild UI.""" - existing = { - tr.channel_id - for p in self.cfg.panes - for tr in p.traces if tr.device_id == "derived" - } + """Drop panes whose sole trace is a deleted virtual channel, then rebuild UI. + Does NOT auto-add panes for new virtual channels — the operator adds those + explicitly via "+ Add Pane" / "+ Add Channel", so the plot layout only ever + shows what was deliberately built.""" current_ids = {dc.channel_id for dc in self.processor.get_derived()} - # Add panes for new virtual channels - for dc in self.processor.get_derived(): - if dc.channel_id not in existing: - new_idx = len(self.cfg.panes) - spec = PaneSpec(title=dc.name, y_label=dc.unit) - spec.traces.append(TraceSpec( - device_id="derived", channel_id=dc.channel_id, - label=dc.name, color=dc.color, - )) - self.cfg.panes.append(spec) - if self.cfg.tree is None: - self.cfg.tree = {"kind": "leaf", "pane": 0} - else: - self.cfg.tree = _tree_equalize_ratios({ - "kind": "vsplit", "ratio": 0.5, - "first": self.cfg.tree, - "second": {"kind": "leaf", "pane": new_idx}, - }) - # Remove panes whose sole trace is a deleted virtual channel removed = [ i for i, p in enumerate(self.cfg.panes) -- cgit v1.2.3