Browse Source

Don't show quit confirmation dialog when running as plugin

tags/v1.9.9
falkTX 6 years ago
parent
commit
549124aadd
1 changed files with 14 additions and 8 deletions
  1. +14
    -8
      source/carla_host.py

+ 14
- 8
source/carla_host.py View File

@@ -2301,15 +2301,21 @@ class HostWindow(QMainWindow):
# --------------------------------------------------------------------------------------------------------
# close event

def closeEvent(self, event):
if self.fCustomStopAction != self.CUSTOM_ACTION_APP_CLOSE and self.fSavedSettings[CARLA_KEY_MAIN_CONFIRM_EXIT]:
ask = QMessageBox.question(self, self.tr("Quit"),
self.tr("Are you sure you want to quit Carla?"),
QMessageBox.Yes|QMessageBox.No)
def shouldIgnoreClose(self):
if self.host.isControl or self.host.isPlugin:
return False
if self.fCustomStopAction == self.CUSTOM_ACTION_APP_CLOSE:
return False
if self.fSavedSettings[CARLA_KEY_MAIN_CONFIRM_EXIT]:
return QMessageBox.question(self, self.tr("Quit"),
self.tr("Are you sure you want to quit Carla?"),
QMessageBox.Yes|QMessageBox.No) == QMessageBox.No
return False

if ask == QMessageBox.No:
event.ignore()
return
def closeEvent(self, event):
if self.shouldIgnoreClose():
event.ignore()
return

self.killTimers()
self.saveSettings()


Loading…
Cancel
Save