Clean up registry for application

This commit is contained in:
Tim Bentley 2013-06-21 06:16:35 +01:00
parent f901a0312f
commit 4d1061f723
16 changed files with 147 additions and 75 deletions

View File

@ -728,10 +728,14 @@ class MediaManagerItem(QtGui.QWidget):
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)

View File

@ -103,9 +103,6 @@ class Registry(object):
``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]

View File

@ -484,10 +484,14 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
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)

View File

@ -494,11 +494,15 @@ class MainDisplay(Display):
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)

View File

@ -1064,6 +1064,9 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
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 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
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)

View File

@ -153,10 +153,14 @@ class MediaPlayer(object):
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)

View File

@ -166,10 +166,14 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog):
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)

View File

@ -1588,10 +1588,14 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
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)

View File

@ -836,10 +836,14 @@ class ThemeManager(QtGui.QWidget):
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)

View File

@ -320,10 +320,14 @@ class OpenLPWizard(QtGui.QWizard):
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)

View File

@ -191,10 +191,14 @@ class EditBibleForm(QtGui.QDialog, Ui_EditBibleDialog):
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)

View File

@ -544,11 +544,15 @@ class BibleDB(QtCore.QObject, Manager):
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)

View File

@ -301,11 +301,15 @@ class BGExtract(object):
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 +381,15 @@ class BSExtract(object):
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 +485,15 @@ class CWExtract(object):
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,11 +679,15 @@ class HTTPBible(BibleDB):
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)

View File

@ -349,10 +349,14 @@ class DuplicateSongRemovalForm(OpenLPWizard):
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)

View File

@ -525,10 +525,14 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
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)

View File

@ -84,10 +84,14 @@ class OpenLyricsExport(object):
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)