Browse Source

Add confirmation dialog for Remove All and New File (#662)

* Add confirmation dialog for Remove All

* Show Remove All confirmation dialog only when clicking the action

* Add confirmation dialog for New File as well

* Simplify slot_fileNew

* Tweak return indentation

* Remove slot_ prefix and decoration
tags/v1.9.9
Patrick Desaulniers Filipe Coelho <falktx@falktx.com> 6 years ago
parent
commit
8836e41c57
1 changed files with 20 additions and 4 deletions
  1. +20
    -4
      source/carla_host.py

+ 20
- 4
source/carla_host.py View File

@@ -416,7 +416,7 @@ class HostWindow(QMainWindow):

self.ui.act_plugin_add.triggered.connect(self.slot_pluginAdd)
self.ui.act_plugin_add2.triggered.connect(self.slot_pluginAdd)
self.ui.act_plugin_remove_all.triggered.connect(self.slot_pluginRemoveAll)
self.ui.act_plugin_remove_all.triggered.connect(self.slot_confirmRemoveAll)

self.ui.act_add_jack.triggered.connect(self.slot_jackAppAdd)

@@ -670,7 +670,12 @@ class HostWindow(QMainWindow):

@pyqtSlot()
def slot_fileNew(self):
self.slot_pluginRemoveAll()
if self.fPluginCount > 0 and QMessageBox.question(self, self.tr("New File"),
self.tr("Plugins that are currently loaded will be removed. Are you sure?"),
QMessageBox.Yes|QMessageBox.No) == QMessageBox.No:
return

self.pluginRemoveAll()
self.fProjectFilename = ""
self.setProperWindowTitle()

@@ -692,7 +697,7 @@ class HostWindow(QMainWindow):
newFile = (ask == QMessageBox.Yes)

if newFile:
self.slot_pluginRemoveAll()
self.pluginRemoveAll()
self.fProjectFilename = filename
self.setProperWindowTitle()
self.loadProjectNow()
@@ -1004,7 +1009,18 @@ class HostWindow(QMainWindow):
CustomMessageBox(self, QMessageBox.Critical, self.tr("Error"), self.tr("Failed to load plugin"), self.host.get_last_error(), QMessageBox.Ok, QMessageBox.Ok)

@pyqtSlot()
def slot_pluginRemoveAll(self):
def slot_confirmRemoveAll(self):
if self.fPluginCount == 0:
return

if QMessageBox.question(self, self.tr("Remove All"),
self.tr("Are you sure you want to remove all plugins?"),
QMessageBox.Yes|QMessageBox.No) == QMessageBox.No:
return

self.pluginRemoveAll()

def pluginRemoveAll(self):
if self.fPluginCount == 0:
return



Loading…
Cancel
Save