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,8 +728,12 @@ 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 os.name == u'nt':
Registry().get(u'application')
else:
if not hasattr(self, u'_application'):
self._application = Registry().get(u'application')
return self._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,8 +484,12 @@ 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 os.name == u'nt':
Registry().get(u'application')
else:
if not hasattr(self, u'_application'):
self._application = Registry().get(u'application')
return self._application

View File

@ -494,8 +494,12 @@ 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 os.name == u'nt':
Registry().get(u'application')
else:
if not hasattr(self, u'_application'):
self._application = Registry().get(u'application')
return self._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,8 +1377,12 @@ 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 os.name == u'nt':
Registry().get(u'application')
else:
if not hasattr(self, u'_application'):
self._application = Registry().get(u'application')
return self._application

View File

@ -153,8 +153,12 @@ 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 os.name == u'nt':
Registry().get(u'application')
else:
if not hasattr(self, u'_application'):
self._application = Registry().get(u'application')
return self._application

View File

@ -166,8 +166,12 @@ 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 os.name == u'nt':
Registry().get(u'application')
else:
if not hasattr(self, u'_application'):
self._application = Registry().get(u'application')
return self._application

View File

@ -1588,8 +1588,12 @@ 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 os.name == u'nt':
Registry().get(u'application')
else:
if not hasattr(self, u'_application'):
self._application = Registry().get(u'application')
return self._application

View File

@ -836,8 +836,12 @@ 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 os.name == u'nt':
Registry().get(u'application')
else:
if not hasattr(self, u'_application'):
self._application = Registry().get(u'application')
return self._application

View File

@ -320,8 +320,12 @@ 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 os.name == u'nt':
Registry().get(u'application')
else:
if not hasattr(self, u'_application'):
self._application = Registry().get(u'application')
return self._application

View File

@ -191,8 +191,12 @@ 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 os.name == u'nt':
Registry().get(u'application')
else:
if not hasattr(self, u'_application'):
self._application = Registry().get(u'application')
return self._application

View File

@ -544,8 +544,12 @@ 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 os.name == u'nt':
Registry().get(u'application')
else:
if not hasattr(self, u'_application'):
self._application = Registry().get(u'application')
return self._application

View File

@ -301,8 +301,12 @@ 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 os.name == u'nt':
Registry().get(u'application')
else:
if not hasattr(self, u'_application'):
self._application = Registry().get(u'application')
return self._application
@ -377,8 +381,12 @@ 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 os.name == u'nt':
Registry().get(u'application')
else:
if not hasattr(self, u'_application'):
self._application = Registry().get(u'application')
return self._application
@ -477,8 +485,12 @@ 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 os.name == u'nt':
Registry().get(u'application')
else:
if not hasattr(self, u'_application'):
self._application = Registry().get(u'application')
return self._application
@ -667,8 +679,12 @@ 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 os.name == u'nt':
Registry().get(u'application')
else:
if not hasattr(self, u'_application'):
self._application = Registry().get(u'application')
return self._application

View File

@ -349,8 +349,12 @@ 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 os.name == u'nt':
Registry().get(u'application')
else:
if not hasattr(self, u'_application'):
self._application = Registry().get(u'application')
return self._application

View File

@ -525,8 +525,12 @@ 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 os.name == u'nt':
Registry().get(u'application')
else:
if not hasattr(self, u'_application'):
self._application = Registry().get(u'application')
return self._application

View File

@ -84,8 +84,12 @@ 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 os.name == u'nt':
Registry().get(u'application')
else:
if not hasattr(self, u'_application'):
self._application = Registry().get(u'application')
return self._application