From 3ef4abb30d17bcf5f1e47007d820be96f08636cc Mon Sep 17 00:00:00 2001 From: falkTX Date: Wed, 19 Feb 2014 15:48:13 +0000 Subject: [PATCH] progressive remove-all-plugins --- source/carla | 11 +++++++-- source/carla_host.py | 52 ++++++++++++++++++++++++++++++++++------ source/carla_patchbay.py | 7 +++++- source/carla_rack.py | 9 +++++-- 4 files changed, 67 insertions(+), 12 deletions(-) diff --git a/source/carla b/source/carla index 6da4ccb5b..30da0e5d2 100755 --- a/source/carla +++ b/source/carla @@ -144,8 +144,15 @@ class CarlaMultiW(QTabWidget): # ----------------------------------------------------------------- - def projectLoaded(self): - self.fPatchbay.projectLoaded() + def projectLoadingStarted(self): + self.fRack.projectLoadingStarted() + #self.fPatchbay.projectLoadingStarted() + + def projectLoadingFinished(self): + self.fRack.projectLoadingFinished() + self.fPatchbay.projectLoadingFinished() + + # ----------------------------------------------------------------- def saveSettings(self, settings): self.fPatchbay.saveSettings(settings) diff --git a/source/carla_host.py b/source/carla_host.py index b8286e3e5..11c3e4088 100644 --- a/source/carla_host.py +++ b/source/carla_host.py @@ -94,9 +94,14 @@ class CarlaDummyW(object): # ----------------------------------------------------------------- - def projectLoaded(self): + def projectLoadingStarted(self): pass + def projectLoadingFinished(self): + pass + + # ----------------------------------------------------------------- + def saveSettings(self, settings): pass @@ -357,11 +362,13 @@ class HostWindow(QMainWindow): if not self.fProjectFilename: return qCritical("ERROR: loading project without filename set") + self.fContainer.projectLoadingStarted() self.fIsProjectLoading = True + gCarla.host.load_project(self.fProjectFilename) - self.fIsProjectLoading = False - self.fContainer.projectLoaded() + self.fIsProjectLoading = False + self.fContainer.projectLoadingFinished() @pyqtSlot() def slot_loadProjectNow(self): @@ -894,8 +901,23 @@ class HostWindow(QMainWindow): @pyqtSlot() def slot_pluginRemoveAll(self): self.ui.act_plugin_remove_all.setEnabled(False) - self.fContainer.removeAllPlugins() - gCarla.host.remove_all_plugins() + + count = self.fContainer.getPluginCount() + + if count == 0: + return + + self.fContainer.projectLoadingStarted() + + app = QApplication.instance() + for i in range(count): + app.processEvents() + gCarla.host.remove_plugin(count-i-1) + + self.fContainer.projectLoadingFinished() + + #self.fContainer.removeAllPlugins() + #gCarla.host.remove_all_plugins() # ----------------------------------------------------------------- @@ -1125,8 +1147,24 @@ class HostWindow(QMainWindow): if gCarla.host.is_engine_running(): gCarla.host.set_engine_about_to_close() - self.ui.act_plugin_remove_all.setEnabled(False) - self.fContainer.removeAllPlugins() + + count = self.fContainer.getPluginCount() + + if count > 0: + # simulate project loading, to disable container + self.ui.act_plugin_remove_all.setEnabled(False) + self.fContainer.projectLoadingStarted() + + app = QApplication.instance() + for i in range(count): + app.processEvents() + gCarla.host.remove_plugin(count-i-1) + + app.processEvents() + + #self.fContainer.removeAllPlugins() + #gCarla.host.remove_all_plugins() + self.stopEngine() QMainWindow.closeEvent(self, event) diff --git a/source/carla_patchbay.py b/source/carla_patchbay.py index 4fd30174c..50c2168b0 100644 --- a/source/carla_patchbay.py +++ b/source/carla_patchbay.py @@ -320,9 +320,14 @@ class CarlaPatchbayW(QFrame): # ----------------------------------------------------------------- - def projectLoaded(self): + def projectLoadingStarted(self): + pass + + def projectLoadingFinished(self): QTimer.singleShot(1000, self.slot_canvasRefresh) + # ----------------------------------------------------------------- + def saveSettings(self, settings): settings.setValue("ShowMeters", self.fParent.ui.act_settings_show_meters.isChecked()) settings.setValue("ShowKeyboard", self.fParent.ui.act_settings_show_keyboard.isChecked()) diff --git a/source/carla_rack.py b/source/carla_rack.py index 7e4a9019d..38cd29baf 100644 --- a/source/carla_rack.py +++ b/source/carla_rack.py @@ -395,8 +395,13 @@ class CarlaRackW(QFrame): # ----------------------------------------------------------------- - def projectLoaded(self): - pass + def projectLoadingStarted(self): + self.fRack.setEnabled(False) + + def projectLoadingFinished(self): + self.fRack.setEnabled(True) + + # ----------------------------------------------------------------- def saveSettings(self, settings): pass