From 48a96769d7b99d5b8421a2825c0185e429375040 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 2 Jan 2011 16:42:30 +0000 Subject: [PATCH] Add YAS for closure --- openlp/core/ui/advancedtab.py | 25 ++++++++++++++++++------- openlp/core/ui/mainwindow.py | 27 ++++++++++++++++----------- 2 files changed, 34 insertions(+), 18 deletions(-) diff --git a/openlp/core/ui/advancedtab.py b/openlp/core/ui/advancedtab.py index 0a8547837..e2cfa72bf 100644 --- a/openlp/core/ui/advancedtab.py +++ b/openlp/core/ui/advancedtab.py @@ -90,6 +90,10 @@ class AdvancedTab(SettingsTab): self.expandServiceItemCheckBox.setObjectName( u'expandServiceItemCheckBox') self.uiLayout.addWidget(self.expandServiceItemCheckBox) + self.enableAutoCloseCheckBox = QtGui.QCheckBox(self.uiGroupBox) + self.enableAutoCloseCheckBox.setObjectName( + u'enableAutoCloseCheckBox') + self.uiLayout.addWidget(self.enableAutoCloseCheckBox) # self.sharedDirGroupBox = QtGui.QGroupBox(self.leftWidget) # self.sharedDirGroupBox.setObjectName(u'sharedDirGroupBox') # self.sharedDirGroupBox.setGeometry(QtCore.QRect(0, 65, 500, 85)) @@ -150,6 +154,8 @@ class AdvancedTab(SettingsTab): 'Double-click to send items straight to live')) self.expandServiceItemCheckBox.setText(translate('OpenLP.AdvancedTab', 'Expand new service items on creation')) + self.enableAutoCloseCheckBox.setText(translate('OpenLP.AdvancedTab', + 'Enable confirm on closure')) # self.sharedDirGroupBox.setTitle( # translate('AdvancedTab', 'Central Data Store')) # self.sharedCheckBox.setText( @@ -180,6 +186,9 @@ class AdvancedTab(SettingsTab): self.expandServiceItemCheckBox.setChecked( settings.value(u'expand service item', QtCore.QVariant(False)).toBool()) + self.enableAutoCloseCheckBox.setChecked( + settings.value(u'enable auto close', + QtCore.QVariant(True)).toBool()) settings.endGroup() def save(self): @@ -196,12 +205,14 @@ class AdvancedTab(SettingsTab): QtCore.QVariant(self.doubleClickLiveCheckBox.isChecked())) settings.setValue(u'expand service item', QtCore.QVariant(self.expandServiceItemCheckBox.isChecked())) + settings.setValue(u'enable auto close', + QtCore.QVariant(self.enableAutoCloseCheckBox.isChecked())) settings.endGroup() - def onSharedCheckBoxChanged(self, checked): - """ - Enables the widgets to allow a shared data location - """ - self.sharedLabel.setEnabled(checked) - self.sharedTextEdit.setEnabled(checked) - self.sharedPushButton.setEnabled(checked) \ No newline at end of file +# def onSharedCheckBoxChanged(self, checked): +# """ +# Enables the widgets to allow a shared data location +# """ +# self.sharedLabel.setEnabled(checked) +# self.sharedTextEdit.setEnabled(checked) +# self.sharedPushButton.setEnabled(checked) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 8c6117955..5c30fdc71 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -842,7 +842,6 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): QtGui.QMessageBox.Save), QtGui.QMessageBox.Save) if ret == QtGui.QMessageBox.Save: - #self.ServiceManagerContents.onSaveService(True) if self.ServiceManagerContents.saveFile(): self.cleanUp() event.accept() @@ -854,18 +853,24 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): else: event.ignore() else: - ret = QtGui.QMessageBox.question(self, - translate('OpenLP.MainWindow', 'Close OpenLP'), - translate('OpenLP.MainWindow', 'Are you sure you want to close OpenLP?'), - QtGui.QMessageBox.StandardButtons( - QtGui.QMessageBox.Yes | - QtGui.QMessageBox.No), - QtGui.QMessageBox.Yes) - if ret == QtGui.QMessageBox.Yes: + if QtCore.QSettings().value(u'advanced/enable auto close', + QtCore.QVariant(True)).toBool(): + ret = QtGui.QMessageBox.question(self, + translate('OpenLP.MainWindow', 'Close OpenLP'), + translate('OpenLP.MainWindow', 'Are you sure you want to close OpenLP?'), + QtGui.QMessageBox.StandardButtons( + QtGui.QMessageBox.Yes | + QtGui.QMessageBox.No), + QtGui.QMessageBox.Yes) + if ret == QtGui.QMessageBox.Yes: + self.cleanUp() + event.accept() + else: + event.ignore() + else: self.cleanUp() event.accept() - else: - event.ignore() + def cleanUp(self): """