From 6236d947e8a4aabfc498fec57eed6c1cc7ea2583 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Sun, 20 Mar 2011 14:13:03 +0200 Subject: [PATCH 1/4] Set the application information immediately after the application has been instantiated, to resolve bug #738642. --- openlp.pyw | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/openlp.pyw b/openlp.pyw index 04f65a5dd..d20dc3e41 100755 --- a/openlp.pyw +++ b/openlp.pyw @@ -73,7 +73,7 @@ class OpenLP(QtGui.QApplication): """ log.info(u'OpenLP Application Loaded') - def _get_version(self): + def get_version(self): """ Load and store current Application Version """ @@ -163,10 +163,6 @@ class OpenLP(QtGui.QApplication): QtCore.SIGNAL(u'cursor_busy'), self.setBusyCursor) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'cursor_normal'), self.setNormalCursor) - self.setOrganizationName(u'OpenLP') - self.setOrganizationDomain(u'openlp.org') - self.setApplicationName(u'OpenLP') - self.setApplicationVersion(app_version[u'version']) # Decide how many screens we have and their size screens = ScreenList(self.desktop()) # First time checks in settings @@ -271,11 +267,12 @@ def main(): qInitResources() # Now create and actually run the application. app = OpenLP(qt_args) - # Define the settings environment - settings = QtCore.QSettings(u'OpenLP', u'OpenLP') + app.setOrganizationName(u'OpenLP') + app.setOrganizationDomain(u'openlp.org') + app.setApplicationName(u'OpenLP') + app.setApplicationVersion(app.get_version()[u'version']) # First time checks in settings - # Use explicit reference as not inside a QT environment yet - if not settings.value(u'general/has run wizard', + if not QSettings().value(u'general/has run wizard', QtCore.QVariant(False)).toBool(): if not FirstTimeLanguageForm().exec_(): # if cancel then stop processing From 9b8b5c821a839e48d8f8d610c5125e92f1bcacb6 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Thu, 24 Mar 2011 19:18:28 +0200 Subject: [PATCH 2/4] Optimised the app_version usage. --- openlp.pyw | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/openlp.pyw b/openlp.pyw index d20dc3e41..a21efb5fd 100755 --- a/openlp.pyw +++ b/openlp.pyw @@ -71,12 +71,14 @@ class OpenLP(QtGui.QApplication): The core application class. This class inherits from Qt's QApplication class in order to provide the core of the application. """ - log.info(u'OpenLP Application Loaded') + app_version = None def get_version(self): """ Load and store current Application Version """ + if self.app_version: + return self.app_version if u'--dev-version' in sys.argv or u'-d' in sys.argv: # If we're running the dev version, let's use bzr to get the version try: @@ -136,12 +138,12 @@ class OpenLP(QtGui.QApplication): if fversion: fversion.close() bits = full_version.split(u'-') - app_version = { + self.app_version = { u'full': full_version, u'version': bits[0], u'build': bits[1] if len(bits) > 1 else None } - if app_version[u'build']: + if self.app_version[u'build']: log.info( u'Openlp version %s build %s', app_version[u'version'], @@ -149,13 +151,12 @@ class OpenLP(QtGui.QApplication): ) else: log.info(u'Openlp version %s' % app_version[u'version']) - return app_version + return self.app_version def run(self): """ Run the OpenLP application. """ - app_version = self._get_version() # provide a listener for widgets to reqest a screen update. QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'openlp_process_events'), self.processEvents) @@ -180,7 +181,8 @@ class OpenLP(QtGui.QApplication): # make sure Qt really display the splash screen self.processEvents() # start the main app window - self.mainWindow = MainWindow(screens, app_version, self.clipboard()) + self.mainWindow = MainWindow(screens, self.app_version, + self.clipboard()) self.mainWindow.show() if show_splash: # now kill the splashscreen @@ -192,7 +194,7 @@ class OpenLP(QtGui.QApplication): update_check = QtCore.QSettings().value( u'general/update check', QtCore.QVariant(True)).toBool() if update_check: - VersionThread(self.mainWindow, app_version).start() + VersionThread(self.mainWindow, self.app_version).start() return self.exec_() def hookException(self, exctype, value, traceback): @@ -272,7 +274,7 @@ def main(): app.setApplicationName(u'OpenLP') app.setApplicationVersion(app.get_version()[u'version']) # First time checks in settings - if not QSettings().value(u'general/has run wizard', + if not QtCore.QSettings().value(u'general/has run wizard', QtCore.QVariant(False)).toBool(): if not FirstTimeLanguageForm().exec_(): # if cancel then stop processing From 4bfc1ec20802393b58b71ab3b79348bda008df41 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Thu, 24 Mar 2011 19:23:39 +0200 Subject: [PATCH 3/4] Possibly found the cause of our double-config-file problems. --- openlp/core/utils/languagemanager.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/openlp/core/utils/languagemanager.py b/openlp/core/utils/languagemanager.py index 8e5ab1f54..f39fb890e 100644 --- a/openlp/core/utils/languagemanager.py +++ b/openlp/core/utils/languagemanager.py @@ -123,9 +123,7 @@ class LanguageManager(object): language = unicode(qm_list[action_name]) if LanguageManager.auto_language: language = u'[%s]' % language - # This needs to be here for the setValue to work - settings = QtCore.QSettings(u'OpenLP', u'OpenLP') - settings.setValue( + QtCore.QSettings().setValue( u'general/language', QtCore.QVariant(language)) log.info(u'Language file: \'%s\' written to conf file' % language) if message: From 62d662fa560b084bc56af5c4982e68e7df247feb Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Fri, 25 Mar 2011 06:53:20 +0200 Subject: [PATCH 4/4] Fixed up last few references to app_version. --- openlp.pyw | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/openlp.pyw b/openlp.pyw index 34f71ed38..96db3d20f 100755 --- a/openlp.pyw +++ b/openlp.pyw @@ -146,11 +146,11 @@ class OpenLP(QtGui.QApplication): if self.app_version[u'build']: log.info( u'Openlp version %s build %s', - app_version[u'version'], - app_version[u'build'] + self.app_version[u'version'], + self.app_version[u'build'] ) else: - log.info(u'Openlp version %s' % app_version[u'version']) + log.info(u'Openlp version %s' % self.app_version[u'version']) return self.app_version def run(self):