diff options
Diffstat (limited to 'ui/main_window.py')
| -rw-r--r-- | ui/main_window.py | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/ui/main_window.py b/ui/main_window.py index 1e863ee..ec0f39d 100644 --- a/ui/main_window.py +++ b/ui/main_window.py @@ -245,10 +245,33 @@ class MainWindow(QMainWindow): def _profile_new(self): """Reset to a blank slate.""" - self._ctrl.clear_widgets() + # Clear devices + for dev in list(self.registry.all_instances()): + try: + dev.disconnect() + except Exception: + pass + self.registry.remove_instance(dev.info.device_id) + self.engine.remove_device(dev.info.device_id) + + # Clear signal pipelines + self.processor._pipelines.clear() + # Clear derived channels - for dc in self.processor.get_derived(): + for dc in list(self.processor.get_derived()): self.processor.remove_derived(dc.channel_id) + + # Clear controls + self._ctrl.clear_widgets() + + # Refresh open windows + if self._win_devices: + self._win_devices.refresh() + if self._win_signals: + self._win_signals.refresh_derived() + if self._win_plot: + self._win_plot.refresh_channels() + self._chart.refresh() self._status.setText("New profile — blank slate.") @@ -280,6 +303,8 @@ class MainWindow(QMainWindow): # Refresh open windows if self._win_devices: self._win_devices.refresh() + if self._win_signals: + self._win_signals.refresh_derived() if self._win_plot: self._win_plot.refresh_channels() self._status.setText(f"Profile loaded: {profile.name}") |
