← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~trb143/openlp/junefixes into lp:openlp

 

Tim Bentley has proposed merging lp:~trb143/openlp/junefixes into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)

For more details, see:
https://code.launchpad.net/~trb143/openlp/junefixes/+merge/170989

Correct the application code so windows can invalidate application on exit.
Removed in Registry migration.
-- 
https://code.launchpad.net/~trb143/openlp/junefixes/+merge/170989
Your team OpenLP Core is requested to review the proposed merge of lp:~trb143/openlp/junefixes into lp:openlp.
=== modified file 'openlp/core/lib/mediamanageritem.py'
--- openlp/core/lib/mediamanageritem.py	2013-05-23 07:31:12 +0000
+++ openlp/core/lib/mediamanageritem.py	2013-06-23 19:53:26 +0000
@@ -728,10 +728,14 @@
 
     def _get_application(self):
         """
-        Adds the openlp to the class dynamically
+        Adds the openlp to the class dynamically.
+        Windows needs to access the application in a dynamic manner.
         """
-        if not hasattr(self, u'_application'):
-            self._application = Registry().get(u'application')
-        return self._application
+        if os.name == u'nt':
+            Registry().get(u'application')
+        else:
+            if not hasattr(self, u'_application'):
+                self._application = Registry().get(u'application')
+            return self._application
 
     application = property(_get_application)

=== modified file 'openlp/core/lib/plugin.py'
--- openlp/core/lib/plugin.py	2013-04-05 19:37:15 +0000
+++ openlp/core/lib/plugin.py	2013-06-23 19:53:26 +0000
@@ -30,6 +30,7 @@
 Provide the generic plugin functionality for OpenLP plugins.
 """
 import logging
+import os
 
 from PyQt4 import QtCore
 
@@ -424,8 +425,11 @@
         """
         Adds the openlp to the class dynamically
         """
-        if not hasattr(self, u'_application'):
-            self._application = Registry().get(u'application')
-        return self._application
+        if os.name == u'nt':
+            Registry().get(u'application')
+        else:
+            if not hasattr(self, u'_application'):
+                self._application = Registry().get(u'application')
+            return self._application
 
     application = property(_get_application)

=== modified file 'openlp/core/lib/registry.py'
--- openlp/core/lib/registry.py	2013-03-17 09:21:18 +0000
+++ openlp/core/lib/registry.py	2013-06-23 19:53:26 +0000
@@ -103,9 +103,6 @@
         ``key``
             The service to be deleted.
         """
-        if self.running_under_test is False:
-            log.error(u'Invalid Method call for key %s' % key)
-            raise KeyError(u'Invalid Method call for key %s' % key)
         if key in self.service_list:
             del self.service_list[key]
 

=== modified file 'openlp/core/ui/firsttimeform.py'
--- openlp/core/ui/firsttimeform.py	2013-03-26 11:35:29 +0000
+++ openlp/core/ui/firsttimeform.py	2013-06-23 19:53:26 +0000
@@ -484,10 +484,14 @@
 
     def _get_application(self):
         """
-        Adds the openlp to the class dynamically
+        Adds the openlp to the class dynamically.
+        Windows needs to access the application in a dynamic manner.
         """
-        if not hasattr(self, u'_application'):
-            self._application = Registry().get(u'application')
-        return self._application
+        if os.name == u'nt':
+            Registry().get(u'application')
+        else:
+            if not hasattr(self, u'_application'):
+                self._application = Registry().get(u'application')
+            return self._application
 
     application = property(_get_application)

=== modified file 'openlp/core/ui/maindisplay.py'
--- openlp/core/ui/maindisplay.py	2013-06-16 07:54:16 +0000
+++ openlp/core/ui/maindisplay.py	2013-06-23 19:53:26 +0000
@@ -38,6 +38,7 @@
 from __future__ import division
 import cgi
 import logging
+import os
 import sys
 
 from PyQt4 import QtCore, QtGui, QtWebKit, QtOpenGL
@@ -494,11 +495,15 @@
 
     def _get_application(self):
         """
-        Adds the openlp to the class dynamically
+        Adds the openlp to the class dynamically.
+        Windows needs to access the application in a dynamic manner.
         """
-        if not hasattr(self, u'_application'):
-            self._application = Registry().get(u'application')
-        return self._application
+        if os.name == u'nt':
+            Registry().get(u'application')
+        else:
+            if not hasattr(self, u'_application'):
+                self._application = Registry().get(u'application')
+            return self._application
 
     application = property(_get_application)
 

=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py	2013-06-16 07:54:16 +0000
+++ openlp/core/ui/mainwindow.py	2013-06-23 19:53:26 +0000
@@ -1064,6 +1064,9 @@
         if self.live_controller.display:
             self.live_controller.display.close()
             self.live_controller.display = None
+        if os.name == u'nt':
+            # Needed for Windows to stop crashes on exit
+            Registry.remove(u'application')
 
     def service_changed(self, reset=False, serviceName=None):
         """
@@ -1374,10 +1377,14 @@
 
     def _get_application(self):
         """
-        Adds the openlp to the class dynamically
+        Adds the openlp to the class dynamically.
+        Windows needs to access the application in a dynamic manner.
         """
-        if not hasattr(self, u'_application'):
-            self._application = Registry().get(u'application')
-        return self._application
+        if os.name == u'nt':
+            Registry().get(u'application')
+        else:
+            if not hasattr(self, u'_application'):
+                self._application = Registry().get(u'application')
+            return self._application
 
     application = property(_get_application)

=== modified file 'openlp/core/ui/media/mediaplayer.py'
--- openlp/core/ui/media/mediaplayer.py	2013-03-23 07:28:24 +0000
+++ openlp/core/ui/media/mediaplayer.py	2013-06-23 19:53:26 +0000
@@ -29,6 +29,8 @@
 """
 The :mod:`~openlp.core.ui.media.mediaplayer` module contains the MediaPlayer class.
 """
+import os
+
 from openlp.core.lib import Registry
 from openlp.core.ui.media import MediaState
 
@@ -153,10 +155,14 @@
 
     def _get_application(self):
         """
-        Adds the openlp to the class dynamically
+        Adds the openlp to the class dynamically.
+        Windows needs to access the application in a dynamic manner.
         """
-        if not hasattr(self, u'_application'):
-            self._application = Registry().get(u'application')
-        return self._application
+        if os.name == u'nt':
+            Registry().get(u'application')
+        else:
+            if not hasattr(self, u'_application'):
+                self._application = Registry().get(u'application')
+            return self._application
 
     application = property(_get_application)
\ No newline at end of file

=== modified file 'openlp/core/ui/pluginform.py'
--- openlp/core/ui/pluginform.py	2013-06-18 09:09:54 +0000
+++ openlp/core/ui/pluginform.py	2013-06-23 19:53:26 +0000
@@ -30,6 +30,7 @@
 The actual plugin view form
 """
 import logging
+import os
 
 from PyQt4 import QtGui
 
@@ -166,10 +167,14 @@
 
     def _get_application(self):
         """
-        Adds the openlp to the class dynamically
+        Adds the openlp to the class dynamically.
+        Windows needs to access the application in a dynamic manner.
         """
-        if not hasattr(self, u'_application'):
-            self._application = Registry().get(u'application')
-        return self._application
+        if os.name == u'nt':
+            Registry().get(u'application')
+        else:
+            if not hasattr(self, u'_application'):
+                self._application = Registry().get(u'application')
+            return self._application
 
     application = property(_get_application)

=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py	2013-06-16 07:54:16 +0000
+++ openlp/core/ui/servicemanager.py	2013-06-23 19:53:26 +0000
@@ -1588,10 +1588,14 @@
 
     def _get_application(self):
         """
-        Adds the openlp to the class dynamically
+        Adds the openlp to the class dynamically.
+        Windows needs to access the application in a dynamic manner.
         """
-        if not hasattr(self, u'_application'):
-            self._application = Registry().get(u'application')
-        return self._application
+        if os.name == u'nt':
+            Registry().get(u'application')
+        else:
+            if not hasattr(self, u'_application'):
+                self._application = Registry().get(u'application')
+            return self._application
 
     application = property(_get_application)

=== modified file 'openlp/core/ui/thememanager.py'
--- openlp/core/ui/thememanager.py	2013-04-05 17:41:01 +0000
+++ openlp/core/ui/thememanager.py	2013-06-23 19:53:26 +0000
@@ -836,10 +836,14 @@
 
     def _get_application(self):
         """
-        Adds the openlp to the class dynamically
+        Adds the openlp to the class dynamically.
+        Windows needs to access the application in a dynamic manner.
         """
-        if not hasattr(self, u'_application'):
-            self._application = Registry().get(u'application')
-        return self._application
+        if os.name == u'nt':
+            Registry().get(u'application')
+        else:
+            if not hasattr(self, u'_application'):
+                self._application = Registry().get(u'application')
+            return self._application
 
     application = property(_get_application)

=== modified file 'openlp/core/ui/wizard.py'
--- openlp/core/ui/wizard.py	2013-04-29 18:23:06 +0000
+++ openlp/core/ui/wizard.py	2013-06-23 19:53:26 +0000
@@ -320,10 +320,14 @@
 
     def _get_application(self):
         """
-        Adds the openlp to the class dynamically
+        Adds the openlp to the class dynamically.
+        Windows needs to access the application in a dynamic manner.
         """
-        if not hasattr(self, u'_application'):
-            self._application = Registry().get(u'application')
-        return self._application
+        if os.name == u'nt':
+            Registry().get(u'application')
+        else:
+            if not hasattr(self, u'_application'):
+                self._application = Registry().get(u'application')
+            return self._application
 
     application = property(_get_application)

=== modified file 'openlp/plugins/bibles/forms/editbibleform.py'
--- openlp/plugins/bibles/forms/editbibleform.py	2013-04-18 17:45:14 +0000
+++ openlp/plugins/bibles/forms/editbibleform.py	2013-06-23 19:53:26 +0000
@@ -28,6 +28,7 @@
 ###############################################################################
 
 import logging
+import os
 import re
 
 from PyQt4 import QtGui
@@ -191,10 +192,14 @@
 
     def _get_application(self):
         """
-        Adds the openlp to the class dynamically
+        Adds the openlp to the class dynamically.
+        Windows needs to access the application in a dynamic manner.
         """
-        if not hasattr(self, u'_application'):
-            self._application = Registry().get(u'application')
-        return self._application
+        if os.name == u'nt':
+            Registry().get(u'application')
+        else:
+            if not hasattr(self, u'_application'):
+                self._application = Registry().get(u'application')
+            return self._application
 
     application = property(_get_application)

=== modified file 'openlp/plugins/bibles/lib/db.py'
--- openlp/plugins/bibles/lib/db.py	2013-04-18 17:45:14 +0000
+++ openlp/plugins/bibles/lib/db.py	2013-06-23 19:53:26 +0000
@@ -544,11 +544,15 @@
 
     def _get_application(self):
         """
-        Adds the openlp to the class dynamically
+        Adds the openlp to the class dynamically.
+        Windows needs to access the application in a dynamic manner.
         """
-        if not hasattr(self, u'_application'):
-            self._application = Registry().get(u'application')
-        return self._application
+        if os.name == u'nt':
+            Registry().get(u'application')
+        else:
+            if not hasattr(self, u'_application'):
+                self._application = Registry().get(u'application')
+            return self._application
 
     application = property(_get_application)
 

=== modified file 'openlp/plugins/bibles/lib/http.py'
--- openlp/plugins/bibles/lib/http.py	2013-04-23 21:46:07 +0000
+++ openlp/plugins/bibles/lib/http.py	2013-06-23 19:53:26 +0000
@@ -29,6 +29,7 @@
 """
 The :mod:`http` module enables OpenLP to retrieve scripture from bible websites.
 """
+import os
 import logging
 import re
 import socket
@@ -301,11 +302,15 @@
 
     def _get_application(self):
         """
-        Adds the openlp to the class dynamically
+        Adds the openlp to the class dynamically.
+        Windows needs to access the application in a dynamic manner.
         """
-        if not hasattr(self, u'_application'):
-            self._application = Registry().get(u'application')
-        return self._application
+        if os.name == u'nt':
+            Registry().get(u'application')
+        else:
+            if not hasattr(self, u'_application'):
+                self._application = Registry().get(u'application')
+            return self._application
 
     application = property(_get_application)
 
@@ -377,11 +382,15 @@
 
     def _get_application(self):
         """
-        Adds the openlp to the class dynamically
+        Adds the openlp to the class dynamically.
+        Windows needs to access the application in a dynamic manner.
         """
-        if not hasattr(self, u'_application'):
-            self._application = Registry().get(u'application')
-        return self._application
+        if os.name == u'nt':
+            Registry().get(u'application')
+        else:
+            if not hasattr(self, u'_application'):
+                self._application = Registry().get(u'application')
+            return self._application
 
     application = property(_get_application)
 
@@ -477,11 +486,15 @@
 
     def _get_application(self):
         """
-        Adds the openlp to the class dynamically
+        Adds the openlp to the class dynamically.
+        Windows needs to access the application in a dynamic manner.
         """
-        if not hasattr(self, u'_application'):
-            self._application = Registry().get(u'application')
-        return self._application
+        if os.name == u'nt':
+            Registry().get(u'application')
+        else:
+            if not hasattr(self, u'_application'):
+                self._application = Registry().get(u'application')
+            return self._application
 
     application = property(_get_application)
 
@@ -667,14 +680,19 @@
 
     def _get_application(self):
         """
-        Adds the openlp to the class dynamically
+        Adds the openlp to the class dynamically.
+        Windows needs to access the application in a dynamic manner.
         """
-        if not hasattr(self, u'_application'):
-            self._application = Registry().get(u'application')
-        return self._application
+        if os.name == u'nt':
+            Registry().get(u'application')
+        else:
+            if not hasattr(self, u'_application'):
+                self._application = Registry().get(u'application')
+            return self._application
 
     application = property(_get_application)
 
+
 def get_soup_for_bible_ref(reference_url, header=None, pre_parse_regex=None, pre_parse_substitute=None):
     """
     Gets a webpage and returns a parsed and optionally cleaned soup or None.

=== modified file 'openlp/plugins/songs/forms/duplicatesongremovalform.py'
--- openlp/plugins/songs/forms/duplicatesongremovalform.py	2013-06-15 10:46:00 +0000
+++ openlp/plugins/songs/forms/duplicatesongremovalform.py	2013-06-23 19:53:26 +0000
@@ -349,10 +349,14 @@
 
     def _get_application(self):
         """
-        Adds the openlp to the class dynamically
+        Adds the openlp to the class dynamically.
+        Windows needs to access the application in a dynamic manner.
         """
-        if not hasattr(self, u'_application'):
-            self._application = Registry().get(u'application')
-        return self._application
+        if os.name == u'nt':
+            Registry().get(u'application')
+        else:
+            if not hasattr(self, u'_application'):
+                self._application = Registry().get(u'application')
+            return self._application
 
     application = property(_get_application)
\ No newline at end of file

=== modified file 'openlp/plugins/songs/forms/songmaintenanceform.py'
--- openlp/plugins/songs/forms/songmaintenanceform.py	2013-03-14 22:22:18 +0000
+++ openlp/plugins/songs/forms/songmaintenanceform.py	2013-06-23 19:53:26 +0000
@@ -27,6 +27,7 @@
 # Temple Place, Suite 330, Boston, MA 02111-1307 USA                          #
 ###############################################################################
 import logging
+import os
 
 from PyQt4 import QtGui, QtCore
 from sqlalchemy.sql import and_
@@ -525,10 +526,14 @@
 
     def _get_application(self):
         """
-        Adds the application to the class dynamically
+        Adds the openlp to the class dynamically.
+        Windows needs to access the application in a dynamic manner.
         """
-        if not hasattr(self, u'_application'):
-            self._application = Registry().get(u'application')
-        return self._application
+        if os.name == u'nt':
+            Registry().get(u'application')
+        else:
+            if not hasattr(self, u'_application'):
+                self._application = Registry().get(u'application')
+            return self._application
 
     application = property(_get_application)

=== modified file 'openlp/plugins/songs/lib/openlyricsexport.py'
--- openlp/plugins/songs/lib/openlyricsexport.py	2013-03-08 08:14:39 +0000
+++ openlp/plugins/songs/lib/openlyricsexport.py	2013-06-23 19:53:26 +0000
@@ -84,10 +84,14 @@
 
     def _get_application(self):
         """
-        Adds the openlp to the class dynamically
+        Adds the openlp to the class dynamically.
+        Windows needs to access the application in a dynamic manner.
         """
-        if not hasattr(self, u'_application'):
-            self._application = Registry().get(u'application')
-        return self._application
+        if os.name == u'nt':
+            Registry().get(u'application')
+        else:
+            if not hasattr(self, u'_application'):
+                self._application = Registry().get(u'application')
+            return self._application
 
     application = property(_get_application)