From 289ce0de5f4f9cc44860afe2fae6c39abf0e6bf3 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 26 Feb 2011 20:52:26 +0000 Subject: [PATCH] Start of Langauges --- openlp.pyw | 19 ++----- openlp/core/ui/firsttimeform.py | 33 ++++++++++-- resources/forms/firsttimewizard.ui | 80 +++++++++++++++--------------- 3 files changed, 73 insertions(+), 59 deletions(-) diff --git a/openlp.pyw b/openlp.pyw index c5568e201..393a1331b 100755 --- a/openlp.pyw +++ b/openlp.pyw @@ -151,10 +151,6 @@ class OpenLP(QtGui.QApplication): log.info(u'Openlp version %s' % app_version[u'version']) return app_version -# def notify(self, obj, evt): -# #TODO needed for presentation exceptions -# return QtGui.QApplication.notify(self, obj, evt) - def run(self): """ Run the OpenLP application. @@ -173,13 +169,6 @@ class OpenLP(QtGui.QApplication): self.setApplicationVersion(app_version[u'version']) if os.name == u'nt': self.setStyleSheet(application_stylesheet) - print "1" - # First time checks in settings - if QtCore.QSettings().value( - u'general/first time', QtCore.QVariant(True)).toBool(): - FirstTimeForm().exec_() - # make sure Qt really display the splash screen - self.processEvents() show_splash = QtCore.QSettings().value( u'general/show splash', QtCore.QVariant(True)).toBool() if show_splash: @@ -210,17 +199,13 @@ class OpenLP(QtGui.QApplication): return self.exec_() def hookException(self, exctype, value, traceback): - print "a" if not hasattr(self, u'mainWindow'): log.exception(''.join(format_exception(exctype, value, traceback))) return - print "b" if not hasattr(self, u'exceptionForm'): self.exceptionForm = ExceptionForm(self.mainWindow) - print "c" self.exceptionForm.exceptionTextEdit.setPlainText( ''.join(format_exception(exctype, value, traceback))) - print "d" self.setNormalCursor() self.exceptionForm.exec_() @@ -287,6 +272,10 @@ def main(): app = OpenLP(qt_args) # Define the settings environment QtCore.QSettings(u'OpenLP', u'OpenLP') + # First time checks in settings + if QtCore.QSettings().value( + u'general/first time', QtCore.QVariant(True)).toBool(): + FirstTimeForm().exec_() # i18n Set Language language = LanguageManager.get_language() appTranslator = LanguageManager.get_translator(language) diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py index 0ca078e66..88220ed33 100644 --- a/openlp/core/ui/firsttimeform.py +++ b/openlp/core/ui/firsttimeform.py @@ -31,7 +31,7 @@ from PyQt4 import QtCore, QtGui from firsttimewizard import Ui_FirstTimeWizard from openlp.core.lib import translate, PluginStatus -from openlp.core.utils import get_web_page +from openlp.core.utils import get_web_page, LanguageManager log = logging.getLogger(__name__) @@ -44,12 +44,35 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): def __init__(self, parent=None): # check to see if we have web access - self.WebAccess = get_web_page(u'http://openlp.org1') - print self.WebAccess + self.webAccess = get_web_page(u'http://openlp.org1') + print self.webAccess QtGui.QWizard.__init__(self, parent) self.setupUi(self) #self.registerFields() + def exec_(self, edit=False): + """ + Run the wizard. + """ + self.setDefaults() + return QtGui.QWizard.exec_(self) + + def setDefaults(self): + """ + Set up display at start of theme edit. + """ + self.restart() + # Sort out internet access + if self.webAccess: + self.internetGroupBox.setVisible(True) + self.noInternetLabel.setVisible(False) + else: + self.internetGroupBox.setVisible(False) + self.noInternetLabel.setVisible(True) + self.qmList = LanguageManager.get_qm_list() + for key in sorted(self.qmList.keys()): + self.LanguageComboBox.addItem(key) + def accept(self): self.__pluginStatus(self.songsCheckBox, u'songs/status') self.__pluginStatus(self.bibleCheckBox, u'bibles/status') @@ -59,7 +82,9 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): self.__pluginStatus(self.remoteCheckBox, u'remote/status') self.__pluginStatus(self.customCheckBox, u'custom/status') self.__pluginStatus(self.songUsageCheckBox, u'songusage/status') - #self.__pluginStatus(self.alertsCheckBox, u'alerts/status') + self.__pluginStatus(self.alertCheckBox, u'alerts/status') + + print self.qmList[unicode(self.LanguageComboBox.currentText())] return QtGui.QWizard.accept(self) def __pluginStatus(self, field, tag): diff --git a/resources/forms/firsttimewizard.ui b/resources/forms/firsttimewizard.ui index b4442e9f0..305fd66a0 100644 --- a/resources/forms/firsttimewizard.ui +++ b/resources/forms/firsttimewizard.ui @@ -199,7 +199,7 @@ p, li { white-space: pre-wrap; } - Remote Control + Allow remote access @@ -213,6 +213,16 @@ p, li { white-space: pre-wrap; } + + + + Allow Alerts + + + true + + + @@ -229,12 +239,12 @@ p, li { white-space: pre-wrap; } 20 20 - 416 + 461 17 - No Internet connection found so unable to download any defaults + No Internet connection found so unable to download any default files. @@ -247,7 +257,7 @@ p, li { white-space: pre-wrap; } - Download Samples + Download Example Files @@ -280,18 +290,18 @@ p, li { white-space: pre-wrap; } - Configure Settings + Default Settings - Configure the initial value for settings + Set up default values to be used by OpenLP - + 20 20 252 - 58 + 88 @@ -329,45 +339,35 @@ p, li { white-space: pre-wrap; } + + + + Select default language + + + + + + - - - - Apply Updates - - - Press Finish to apply requested updates. - - - - 8 + + + + 40 + 190 + 471 + 17 + - - 20 + + Press Finish to apply all you changes and start OpenLP - + - - - FirstTimeWizard - accepted() - FirstTimeWizard - accept() - - - 455 - 368 - - - 483 - 401 - - - - +