summaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
Diffstat (limited to 'ui')
-rw-r--r--ui/main_window.py1
-rw-r--r--ui/windows/config_window.py6
-rw-r--r--ui/windows/plot_window.py29
3 files changed, 10 insertions, 26 deletions
diff --git a/ui/main_window.py b/ui/main_window.py
index 19d4c69..012d6f5 100644
--- a/ui/main_window.py
+++ b/ui/main_window.py
@@ -731,6 +731,7 @@ class MainWindow(QMainWindow):
self._status.setText(f"Device '{dev_id}' removed.")
def _on_device_reconfigured(self, dev_id: str):
+ self.engine.on_device_reconfigured(dev_id)
self._chart.refresh()
if self._win_config:
self._win_config.on_device_reconfigured(dev_id)
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)