← Back to team overview

openlp-core team mailing list archive

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

 

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

Requested reviews:
  OpenLP Core (openlp-core)

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

Convert trunk to use RegistryProperties
-- 
https://code.launchpad.net/~trb143/openlp/mixins/+merge/211256
Your team OpenLP Core is requested to review the proposed merge of lp:~trb143/openlp/mixins into lp:openlp.
=== modified file 'openlp/core/common/registryproperties.py'
--- openlp/core/common/registryproperties.py	2014-03-13 20:20:42 +0000
+++ openlp/core/common/registryproperties.py	2014-03-17 07:34:01 +0000
@@ -115,3 +115,38 @@
             self._main_window = Registry().get('main_window')
         return self._main_window
 
+    @property
+    def renderer(self):
+        """
+        Adds the Renderer to the class dynamically
+        """
+        if not hasattr(self, '_renderer') or not self._renderer:
+            self._renderer = Registry().get('renderer')
+        return self._renderer
+
+    @property
+    def theme_manager(self):
+        """
+        Adds the theme manager to the class dynamically
+        """
+        if not hasattr(self, '_theme_manager') or not self._theme_manager:
+            self._theme_manager = Registry().get('theme_manager')
+        return self._theme_manager
+
+    @property
+    def settings_form(self):
+        """
+        Adds the settings form to the class dynamically
+        """
+        if not hasattr(self, '_settings_form') or not self._settings_form:
+            self._settings_form = Registry().get('settings_form')
+        return self._settings_form
+
+    @property
+    def alerts_manager(self):
+        """
+        Adds the alerts manager to the class dynamically
+        """
+        if not hasattr(self, '_alerts_manager') or not self._alerts_manager:
+            self._alerts_manager = Registry().get('alerts_manager')
+        return self._alerts_manager
\ No newline at end of file

=== modified file 'openlp/core/lib/mediamanageritem.py'
--- openlp/core/lib/mediamanageritem.py	2014-02-23 15:02:53 +0000
+++ openlp/core/lib/mediamanageritem.py	2014-03-17 07:34:01 +0000
@@ -35,7 +35,7 @@
 
 from PyQt4 import QtCore, QtGui
 
-from openlp.core.common import Registry, Settings, UiStrings, translate
+from openlp.core.common import Registry, RegistryProperties, Settings, UiStrings, translate
 from openlp.core.lib import FileDialog, OpenLPToolbar, ServiceItem, StringContent, ListWidgetWithDnD, \
     ServiceItemContext
 from openlp.core.lib.searchedit import SearchEdit
@@ -44,7 +44,7 @@
 log = logging.getLogger(__name__)
 
 
-class MediaManagerItem(QtGui.QWidget):
+class MediaManagerItem(QtGui.QWidget, RegistryProperties):
     """
     MediaManagerItem is a helper widget for plugins.
 
@@ -684,97 +684,3 @@
         :param show_error: Should the error be shown (True)
         """
         raise NotImplementedError('Plugin.search needs to be defined by the plugin')
-
-    def _get_main_window(self):
-        """
-        Adds the main window to the class dynamically
-        """
-        if not hasattr(self, '_main_window'):
-            self._main_window = Registry().get('main_window')
-        return self._main_window
-
-    main_window = property(_get_main_window)
-
-    def _get_renderer(self):
-        """
-        Adds the Renderer to the class dynamically
-        """
-        if not hasattr(self, '_renderer'):
-            self._renderer = Registry().get('renderer')
-        return self._renderer
-
-    renderer = property(_get_renderer)
-
-    def _get_live_controller(self):
-        """
-        Adds the live controller to the class dynamically
-        """
-        if not hasattr(self, '_live_controller'):
-            self._live_controller = Registry().get('live_controller')
-        return self._live_controller
-
-    live_controller = property(_get_live_controller)
-
-    def _get_preview_controller(self):
-        """
-        Adds the preview controller to the class dynamically
-        """
-        if not hasattr(self, '_preview_controller'):
-            self._preview_controller = Registry().get('preview_controller')
-        return self._preview_controller
-
-    preview_controller = property(_get_preview_controller)
-
-    def _get_plugin_manager(self):
-        """
-        Adds the plugin manager to the class dynamically
-        """
-        if not hasattr(self, '_plugin_manager'):
-            self._plugin_manager = Registry().get('plugin_manager')
-        return self._plugin_manager
-
-    plugin_manager = property(_get_plugin_manager)
-
-    def _get_media_controller(self):
-        """
-        Adds the media controller to the class dynamically
-        """
-        if not hasattr(self, '_media_controller'):
-            self._media_controller = Registry().get('media_controller')
-        return self._media_controller
-
-    media_controller = property(_get_media_controller)
-
-    def _get_service_manager(self):
-        """
-        Adds the service manager to the class dynamically
-        """
-        if not hasattr(self, '_service_manager'):
-            self._service_manager = Registry().get('service_manager')
-        return self._service_manager
-
-    service_manager = property(_get_service_manager)
-
-    def _get_theme_manager(self):
-        """
-        Adds the theme manager to the class dynamically
-        """
-        if not hasattr(self, '_theme_manager'):
-            self._theme_manager = Registry().get('theme_manager')
-        return self._theme_manager
-
-    theme_manager = property(_get_theme_manager)
-
-    def _get_application(self):
-        """
-        Adds the openlp to the class dynamically.
-        Windows needs to access the application in a dynamic manner.
-        """
-        if os.name == 'nt':
-            return Registry().get('application')
-        else:
-            if not hasattr(self, '_application'):
-                self._application = Registry().get('application')
-            return self._application
-
-    application = property(_get_application)

=== modified file 'openlp/core/lib/plugin.py'
--- openlp/core/lib/plugin.py	2013-12-28 21:33:38 +0000
+++ openlp/core/lib/plugin.py	2014-03-17 07:34:01 +0000
@@ -30,11 +30,11 @@
 Provide the generic plugin functionality for OpenLP plugins.
 """
 import logging
-import os
+
 
 from PyQt4 import QtCore
 
-from openlp.core.common import Registry, Settings, UiStrings
+from openlp.core.common import Registry, RegistryProperties, Settings, UiStrings
 from openlp.core.utils import get_application_version
 
 log = logging.getLogger(__name__)
@@ -65,7 +65,7 @@
     VisibleName = 'visible_name'
 
 
-class Plugin(QtCore.QObject):
+class Plugin(QtCore.QObject, RegistryProperties):
     """
     Base class for openlp plugins to inherit from.
 
@@ -409,27 +409,4 @@
         """
         The plugin's needs to handle a new song creation
         """
-        pass
-
-    def _get_main_window(self):
-        """
-        Adds the main window to the class dynamically
-        """
-        if not hasattr(self, '_main_window'):
-            self._main_window = Registry().get('main_window')
-        return self._main_window
-
-    main_window = property(_get_main_window)
-
-    def _get_application(self):
-        """
-        Adds the openlp to the class dynamically
-        """
-        if os.name == 'nt':
-            return Registry().get('application')
-        else:
-            if not hasattr(self, '_application'):
-                self._application = Registry().get('application')
-            return self._application
-
-    application = property(_get_application)
+        pass
\ No newline at end of file

=== modified file 'openlp/core/lib/pluginmanager.py'
--- openlp/core/lib/pluginmanager.py	2013-12-28 21:33:38 +0000
+++ openlp/core/lib/pluginmanager.py	2014-03-17 07:34:01 +0000
@@ -34,10 +34,10 @@
 import imp
 
 from openlp.core.lib import Plugin, PluginStatus
-from openlp.core.common import AppLocation, Registry, OpenLPMixin, RegistryMixin
-
-
-class PluginManager(RegistryMixin, OpenLPMixin):
+from openlp.core.common import AppLocation, RegistryProperties, OpenLPMixin, RegistryMixin
+
+
+class PluginManager(RegistryMixin, OpenLPMixin, RegistryProperties):
     """
     This is the Plugin manager, which loads all the plugins,
     and executes all the hooks, as and when necessary.
@@ -220,23 +220,3 @@
         for plugin in self.plugins:
             if plugin.is_active():
                 plugin.new_service_created()
-
-    def _get_settings_form(self):
-        """
-        Adds the plugin manager to the class dynamically
-        """
-        if not hasattr(self, '_settings_form'):
-            self._settings_form = Registry().get('settings_form')
-        return self._settings_form
-
-    settings_form = property(_get_settings_form)
-
-    def _get_main_window(self):
-        """
-        Adds the main window to the class dynamically
-        """
-        if not hasattr(self, '_main_window'):
-            self._main_window = Registry().get('main_window')
-        return self._main_window
-
-    main_window = property(_get_main_window)

=== modified file 'openlp/core/lib/renderer.py'
--- openlp/core/lib/renderer.py	2014-01-11 22:05:38 +0000
+++ openlp/core/lib/renderer.py	2014-03-17 07:34:01 +0000
@@ -30,7 +30,7 @@
 
 from PyQt4 import QtGui, QtCore, QtWebKit
 
-from openlp.core.common import Registry, OpenLPMixin, RegistryMixin, Settings
+from openlp.core.common import Registry, RegistryProperties, OpenLPMixin, RegistryMixin, Settings
 from openlp.core.lib import FormattingTags, ImageSource, ItemCapabilities, ScreenList, ServiceItem, expand_tags, \
     build_lyrics_format_css, build_lyrics_outline_css
 from openlp.core.common import ThemeLevel
@@ -47,7 +47,7 @@
 FOOTER = ['Arky Arky (Unknown)', 'Public Domain', 'CCLI 123456']
 
 
-class Renderer(OpenLPMixin, RegistryMixin):
+class Renderer(OpenLPMixin, RegistryMixin, RegistryProperties):
     """
     Class to pull all Renderer interactions into one place. The plugins will call helper methods to do the rendering but
     this class will provide display defense code.
@@ -563,23 +563,3 @@
         # this parse we are to be wordy
         line = line.replace('\n', ' ')
         return line.split(' ')
-
-    def _get_image_manager(self):
-        """
-        Adds the image manager to the class dynamically
-        """
-        if not hasattr(self, '_image_manager'):
-            self._image_manager = Registry().get('image_manager')
-        return self._image_manager
-
-    image_manager = property(_get_image_manager)
-
-    def _get_theme_manager(self):
-        """
-        Adds the theme manager to the class dynamically
-        """
-        if not hasattr(self, '_theme_manager') or not self._theme_manager :
-            self._theme_manager = Registry().get('theme_manager')
-        return self._theme_manager
-
-    theme_manager = property(_get_theme_manager)

=== modified file 'openlp/core/lib/serviceitem.py'
--- openlp/core/lib/serviceitem.py	2014-02-25 20:11:48 +0000
+++ openlp/core/lib/serviceitem.py	2014-03-17 07:34:01 +0000
@@ -39,7 +39,7 @@
 
 from PyQt4 import QtGui
 
-from openlp.core.common import Registry, Settings, translate
+from openlp.core.common import RegistryProperties, Settings, translate
 from openlp.core.lib import ImageSource, build_icon, clean_tags, expand_tags
 
 log = logging.getLogger(__name__)
@@ -127,7 +127,7 @@
     CanAutoStartForLive = 16
 
 
-class ServiceItem(object):
+class ServiceItem(RegistryProperties):
     """
     The service item is a base class for the plugins to use to interact with
     the service manager, the slide controller, and the projection screen
@@ -652,23 +652,3 @@
                     if file_suffix.lower() not in suffix_list:
                         self.is_valid = False
                         break
-
-    def _get_renderer(self):
-        """
-        Adds the Renderer to the class dynamically
-        """
-        if not hasattr(self, '_renderer'):
-            self._renderer = Registry().get('renderer')
-        return self._renderer
-
-    renderer = property(_get_renderer)
-
-    def _get_image_manager(self):
-        """
-        Adds the image manager to the class dynamically
-        """
-        if not hasattr(self, '_image_manager'):
-            self._image_manager = Registry().get('image_manager')
-        return self._image_manager
-
-    image_manager = property(_get_image_manager)

=== modified file 'openlp/core/lib/settingstab.py'
--- openlp/core/lib/settingstab.py	2013-12-28 21:33:38 +0000
+++ openlp/core/lib/settingstab.py	2014-03-17 07:34:01 +0000
@@ -35,10 +35,10 @@
 from PyQt4 import QtGui
 
 
-from openlp.core.common import Registry
-
-
-class SettingsTab(QtGui.QWidget):
+from openlp.core.common import RegistryProperties
+
+
+class SettingsTab(QtGui.QWidget, RegistryProperties):
     """
     SettingsTab is a helper widget for plugins to define Tabs for the settings dialog.
     """
@@ -140,63 +140,3 @@
         Tab has just been made visible to the user
         """
         self.tab_visited = True
-
-    def _get_service_manager(self):
-        """
-        Adds the service manager to the class dynamically
-        """
-        if not hasattr(self, '_service_manager'):
-            self._service_manager = Registry().get('service_manager')
-        return self._service_manager
-
-    service_manager = property(_get_service_manager)
-
-    def _get_main_window(self):
-        """
-        Adds the main window to the class dynamically
-        """
-        if not hasattr(self, '_main_window'):
-            self._main_window = Registry().get('main_window')
-        return self._main_window
-
-    main_window = property(_get_main_window)
-
-    def _get_renderer(self):
-        """
-        Adds the Renderer to the class dynamically
-        """
-        if not hasattr(self, '_renderer'):
-            self._renderer = Registry().get('renderer')
-        return self._renderer
-
-    renderer = property(_get_renderer)
-
-    def _get_theme_manager(self):
-        """
-        Adds the theme manager to the class dynamically
-        """
-        if not hasattr(self, '_theme_manager'):
-            self._theme_manager = Registry().get('theme_manager')
-        return self._theme_manager
-
-    theme_manager = property(_get_theme_manager)
-
-    def _get_media_controller(self):
-        """
-        Adds the media controller to the class dynamically
-        """
-        if not hasattr(self, '_media_controller'):
-            self._media_controller = Registry().get('media_controller')
-        return self._media_controller
-
-    media_controller = property(_get_media_controller)
-
-    def _get_settings_form(self):
-        """
-        Adds the plugin manager to the class dynamically
-        """
-        if not hasattr(self, '_settings_form'):
-            self._settings_form = Registry().get('settings_form')
-        return self._settings_form
-
-    settings_form = property(_get_settings_form)

=== modified file 'openlp/core/ui/exceptionform.py'
--- openlp/core/ui/exceptionform.py	2013-12-28 21:33:38 +0000
+++ openlp/core/ui/exceptionform.py	2014-03-17 07:34:01 +0000
@@ -38,7 +38,7 @@
 import sqlalchemy
 from lxml import etree
 
-from openlp.core.common import Registry
+from openlp.core.common import RegistryProperties
 
 from PyQt4 import Qt, QtCore, QtGui, QtWebKit
 
@@ -93,7 +93,7 @@
 log = logging.getLogger(__name__)
 
 
-class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog):
+class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog, RegistryProperties):
     """
     The exception dialog
     """
@@ -260,13 +260,3 @@
             return '-'
         except:
             return '- (Possible non-standard UNO installation)'
-
-    def _get_main_window(self):
-        """
-        Adds the main window to the class dynamically
-        """
-        if not hasattr(self, '_main_window'):
-            self._main_window = Registry().get('main_window')
-        return self._main_window
-
-    main_window = property(_get_main_window)

=== modified file 'openlp/core/ui/filerenameform.py'
--- openlp/core/ui/filerenameform.py	2013-12-28 21:33:38 +0000
+++ openlp/core/ui/filerenameform.py	2014-03-17 07:34:01 +0000
@@ -34,10 +34,10 @@
 
 from .filerenamedialog import Ui_FileRenameDialog
 
-from openlp.core.common import Registry, translate
-
-
-class FileRenameForm(QtGui.QDialog, Ui_FileRenameDialog):
+from openlp.core.common import Registry, RegistryProperties, translate
+
+
+class FileRenameForm(QtGui.QDialog, Ui_FileRenameDialog, RegistryProperties):
     """
     The file rename dialog
     """
@@ -57,14 +57,4 @@
         else:
             self.setWindowTitle(translate('OpenLP.FileRenameForm', 'File Rename'))
         self.file_name_edit.setFocus()
-        return QtGui.QDialog.exec_(self)
-
-    def _get_main_window(self):
-        """
-        Adds the main window to the class dynamically
-        """
-        if not hasattr(self, '_main_window'):
-            self._main_window = Registry().get('main_window')
-        return self._main_window
-
-    main_window = property(_get_main_window)
+        return QtGui.QDialog.exec_(self)
\ No newline at end of file

=== modified file 'openlp/core/ui/firsttimeform.py'
--- openlp/core/ui/firsttimeform.py	2013-12-28 21:33:38 +0000
+++ openlp/core/ui/firsttimeform.py	2014-03-17 07:34:01 +0000
@@ -41,7 +41,7 @@
 
 from PyQt4 import QtCore, QtGui
 
-from openlp.core.common import Registry, AppLocation, Settings, check_directory_exists, translate
+from openlp.core.common import Registry, RegistryProperties, AppLocation, Settings, check_directory_exists, translate
 from openlp.core.lib import PluginStatus, build_icon
 from openlp.core.utils import get_web_page
 from .firsttimewizard import Ui_FirstTimeWizard, FirstTimePage
@@ -75,7 +75,7 @@
             item.setFlags(item.flags() | QtCore.Qt.ItemIsUserCheckable)
 
 
-class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
+class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard, RegistryProperties):
     """
     This is the Theme Import Wizard, which allows easy creation and editing of OpenLP themes.
     """
@@ -473,28 +473,4 @@
         Set the status of a plugin.
         """
         status = PluginStatus.Active if field.checkState() == QtCore.Qt.Checked else PluginStatus.Inactive
-        Settings().setValue(tag, status)
-
-    def _get_theme_manager(self):
-        """
-        Adds the theme manager to the class dynamically
-        """
-        if not hasattr(self, '_theme_manager'):
-            self._theme_manager = Registry().get('theme_manager')
-        return self._theme_manager
-
-    theme_manager = property(_get_theme_manager)
-
-    def _get_application(self):
-        """
-        Adds the openlp to the class dynamically.
-        Windows needs to access the application in a dynamic manner.
-        """
-        if os.name == 'nt':
-            return Registry().get('application')
-        else:
-            if not hasattr(self, '_application'):
-                self._application = Registry().get('application')
-            return self._application
-
-    application = property(_get_application)
+        Settings().setValue(tag, status)
\ No newline at end of file

=== modified file 'openlp/core/ui/listpreviewwidget.py'
--- openlp/core/ui/listpreviewwidget.py	2013-12-28 21:33:38 +0000
+++ openlp/core/ui/listpreviewwidget.py	2014-03-17 07:34:01 +0000
@@ -33,11 +33,11 @@
 
 from PyQt4 import QtCore, QtGui
 
-from openlp.core.common import Registry
+from openlp.core.common import RegistryProperties
 from openlp.core.lib import ImageSource, ServiceItem
 
 
-class ListPreviewWidget(QtGui.QTableWidget):
+class ListPreviewWidget(QtGui.QTableWidget, RegistryProperties):
     def __init__(self, parent, screen_ratio):
         """
         Initializes the widget to default state.
@@ -160,15 +160,4 @@
         """
         Returns the number of slides this widget holds.
         """
-        return super(ListPreviewWidget, self).rowCount()
-
-    def _get_image_manager(self):
-        """
-        Adds the image manager to the class dynamically.
-        """
-        if not hasattr(self, '_image_manager'):
-            self._image_manager = Registry().get('image_manager')
-        return self._image_manager
-
-    image_manager = property(_get_image_manager)
-
+        return super(ListPreviewWidget, self).rowCount()
\ No newline at end of file

=== modified file 'openlp/core/ui/maindisplay.py'
--- openlp/core/ui/maindisplay.py	2014-01-11 22:05:38 +0000
+++ openlp/core/ui/maindisplay.py	2014-03-17 07:34:01 +0000
@@ -38,13 +38,12 @@
 
 import cgi
 import logging
-import os
 import sys
 
 from PyQt4 import QtCore, QtGui, QtWebKit, QtOpenGL
 from PyQt4.phonon import Phonon
 
-from openlp.core.common import Registry, OpenLPMixin, Settings, translate
+from openlp.core.common import Registry, RegistryProperties, OpenLPMixin, Settings, translate
 from openlp.core.lib import ServiceItem, ImageSource, build_html, expand_tags, image_to_byte
 from openlp.core.lib.theme import BackgroundType
 
@@ -118,7 +117,7 @@
         self.web_loaded = True
 
 
-class MainDisplay(OpenLPMixin, Display):
+class MainDisplay(OpenLPMixin, Display, RegistryProperties):
     """
     This is the display screen as a specialized class from the Display class
     """
@@ -468,50 +467,6 @@
             self.setCursor(QtCore.Qt.ArrowCursor)
             self.frame.evaluateJavaScript('document.body.style.cursor = "auto"')
 
-    def _get_plugin_manager(self):
-        """
-        Adds the Renderer to the class dynamically
-        """
-        if not hasattr(self, '_plugin_manager'):
-            self._plugin_manager = Registry().get('plugin_manager')
-        return self._plugin_manager
-
-    plugin_manager = property(_get_plugin_manager)
-
-    def _get_image_manager(self):
-        """
-        Adds the image manager to the class dynamically
-        """
-        if not hasattr(self, '_image_manager'):
-            self._image_manager = Registry().get('image_manager')
-        return self._image_manager
-
-    image_manager = property(_get_image_manager)
-
-    def _get_application(self):
-        """
-        Adds the openlp to the class dynamically.
-        Windows needs to access the application in a dynamic manner.
-        """
-        if os.name == 'nt':
-            return Registry().get('application')
-        else:
-            if not hasattr(self, '_application'):
-                self._application = Registry().get('application')
-            return self._application
-
-    application = property(_get_application)
-
-    def _get_live_controller(self):
-        """
-        Adds the live controller to the class dynamically
-        """
-        if not hasattr(self, '_live_controller'):
-            self._live_controller = Registry().get('live_controller')
-        return self._live_controller
-
-    live_controller = property(_get_live_controller)
-
 
 class AudioPlayer(OpenLPMixin, QtCore.QObject):
     """

=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py	2014-03-13 20:08:47 +0000
+++ openlp/core/ui/mainwindow.py	2014-03-17 07:34:01 +0000
@@ -493,13 +493,13 @@
         Settings().set_up_default_values()
         self.about_form = AboutForm(self)
         MediaController()
-        self.settings_form = SettingsForm(self)
+        SettingsForm(self)
         self.formatting_tag_form = FormattingTagForm(self)
         self.shortcut_form = ShortcutListForm(self)
         # Set up the path with plugins
         PluginManager(self)
         ImageManager()
-        self.renderer = Renderer()
+        Renderer()
         # Set up the interface
         self.setupUi(self)
         # Define the media Dock Manager

=== modified file 'openlp/core/ui/media/mediacontroller.py'
--- openlp/core/ui/media/mediacontroller.py	2013-12-31 20:29:03 +0000
+++ openlp/core/ui/media/mediacontroller.py	2014-03-17 07:34:01 +0000
@@ -35,7 +35,7 @@
 import datetime
 from PyQt4 import QtCore, QtGui
 
-from openlp.core.common import Registry, RegistryMixin, Settings, UiStrings, translate
+from openlp.core.common import OpenLPMixin, Registry, RegistryMixin, RegistryProperties, Settings, UiStrings, translate
 from openlp.core.lib import OpenLPToolbar
 from openlp.core.lib.ui import critical_error_message_box
 from openlp.core.ui.media import MediaState, MediaInfo, MediaType, get_media_players, set_media_players
@@ -80,7 +80,7 @@
         QtGui.QSlider.mouseReleaseEvent(self, event)
 
 
-class MediaController(object):
+class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
     """
     The implementation of the Media Controller. The Media Controller adds an own
     class for every Player. Currently these are QtWebkit, Phonon and Vlc.
@@ -94,12 +94,11 @@
     current_media_players is an array of player instances keyed on ControllerType.
 
     """
-    def __init__(self):
+    def __init__(self, parent=None):
         """
         Constructor
         """
-        Registry().register('media_controller', self)
-        Registry().register_function('bootstrap_initialise', self.bootstrap_initialise)
+        super(MediaController, self).__init__(parent)
         self.media_players = {}
         self.display_controllers = {}
         self.current_media_players = {}
@@ -743,24 +742,4 @@
         """
         if controller.is_live:
             return controller.display
-        return controller.preview_display
-
-    def _get_service_manager(self):
-        """
-        Adds the plugin manager to the class dynamically
-        """
-        if not hasattr(self, '_service_manager'):
-            self._service_manager = Registry().get('service_manager')
-        return self._service_manager
-
-    service_manager = property(_get_service_manager)
-
-    def _get_live_controller(self):
-        """
-        Adds the live controller to the class dynamically
-        """
-        if not hasattr(self, '_live_controller'):
-            self._live_controller = Registry().get('live_controller')
-        return self._live_controller
-
-    live_controller = property(_get_live_controller)
+        return controller.preview_display
\ No newline at end of file

=== modified file 'openlp/core/ui/media/mediaplayer.py'
--- openlp/core/ui/media/mediaplayer.py	2013-12-31 20:29:03 +0000
+++ openlp/core/ui/media/mediaplayer.py	2014-03-17 07:34:01 +0000
@@ -31,11 +31,11 @@
 """
 import os
 
-from openlp.core.common import Registry
+from openlp.core.common import RegistryProperties
 from openlp.core.ui.media import MediaState
 
 
-class MediaPlayer(object):
+class MediaPlayer(RegistryProperties):
     """
     This is the base class media Player class to provide OpenLP with a pluggable media display framework.
     """
@@ -150,18 +150,4 @@
         """
         Returns Information about the player
         """
-        return ''
-
-    def _get_application(self):
-        """
-        Adds the openlp to the class dynamically.
-        Windows needs to access the application in a dynamic manner.
-        """
-        if os.name == 'nt':
-            return Registry().get('application')
-        else:
-            if not hasattr(self, '_application'):
-                self._application = Registry().get('application')
-            return self._application
-
-    application = property(_get_application)
\ No newline at end of file
+        return ''
\ No newline at end of file

=== modified file 'openlp/core/ui/pluginform.py'
--- openlp/core/ui/pluginform.py	2013-12-28 21:33:38 +0000
+++ openlp/core/ui/pluginform.py	2014-03-17 07:34:01 +0000
@@ -34,14 +34,14 @@
 
 from PyQt4 import QtGui
 
-from openlp.core.common import Registry, translate
+from openlp.core.common import RegistryProperties, translate
 from openlp.core.lib import PluginStatus
 from .plugindialog import Ui_PluginViewDialog
 
 log = logging.getLogger(__name__)
 
 
-class PluginForm(QtGui.QDialog, Ui_PluginViewDialog):
+class PluginForm(QtGui.QDialog, Ui_PluginViewDialog, RegistryProperties):
     """
     The plugin form provides user control over the plugins OpenLP uses.
     """
@@ -154,28 +154,4 @@
         elif self.active_plugin.status == PluginStatus.Disabled:
             status_text = translate('OpenLP.PluginForm', '%s (Disabled)')
         self.plugin_list_widget.currentItem().setText(
-            status_text % self.active_plugin.name_strings['singular'])
-
-    def _get_plugin_manager(self):
-        """
-        Adds the plugin manager to the class dynamically
-        """
-        if not hasattr(self, '_plugin_manager'):
-            self._plugin_manager = Registry().get('plugin_manager')
-        return self._plugin_manager
-
-    plugin_manager = property(_get_plugin_manager)
-
-    def _get_application(self):
-        """
-        Adds the openlp to the class dynamically.
-        Windows needs to access the application in a dynamic manner.
-        """
-        if os.name == 'nt':
-            return Registry().get('application')
-        else:
-            if not hasattr(self, '_application'):
-                self._application = Registry().get('application')
-            return self._application
-
-    application = property(_get_application)
+            status_text % self.active_plugin.name_strings['singular'])
\ No newline at end of file

=== modified file 'openlp/core/ui/printserviceform.py'
--- openlp/core/ui/printserviceform.py	2014-02-23 15:41:09 +0000
+++ openlp/core/ui/printserviceform.py	2014-03-17 07:34:01 +0000
@@ -36,7 +36,7 @@
 
 from PyQt4 import QtCore, QtGui
 
-from openlp.core.common import Registry, Settings, UiStrings, translate
+from openlp.core.common import Registry, RegistryProperties, Settings, UiStrings, translate
 from openlp.core.lib import get_text_file_string
 from openlp.core.ui.printservicedialog import Ui_PrintServiceDialog, ZoomSize
 from openlp.core.common import AppLocation
@@ -111,7 +111,7 @@
 """
 
 
-class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog):
+class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog, RegistryProperties):
     """
     The :class:`~openlp.core.ui.printserviceform.PrintServiceForm` class displays a dialog for printing the service.
     """
@@ -403,24 +403,4 @@
             return
         for item in self.service_manager.service_items:
             # Trigger Audit requests
-            Registry().register_function('print_service_started', [item['service_item']])
-
-    def _get_service_manager(self):
-        """
-        Adds the service manager to the class dynamically
-        """
-        if not hasattr(self, '_service_manager'):
-            self._service_manager = Registry().get('service_manager')
-        return self._service_manager
-
-    service_manager = property(_get_service_manager)
-
-    def _get_main_window(self):
-        """
-        Adds the main window to the class dynamically
-        """
-        if not hasattr(self, '_main_window'):
-            self._main_window = Registry().get('main_window')
-        return self._main_window
-
-    main_window = property(_get_main_window)
+            Registry().register_function('print_service_started', [item['service_item']])
\ No newline at end of file

=== modified file 'openlp/core/ui/serviceitemeditform.py'
--- openlp/core/ui/serviceitemeditform.py	2013-12-28 21:33:38 +0000
+++ openlp/core/ui/serviceitemeditform.py	2014-03-17 07:34:01 +0000
@@ -30,12 +30,12 @@
 The service item edit dialog
 """
 from PyQt4 import QtGui
-from openlp.core.common import Registry
+from openlp.core.common import Registry, RegistryProperties
 
 from .serviceitemeditdialog import Ui_ServiceItemEditDialog
 
 
-class ServiceItemEditForm(QtGui.QDialog, Ui_ServiceItemEditDialog):
+class ServiceItemEditForm(QtGui.QDialog, Ui_ServiceItemEditDialog, RegistryProperties):
     """
     This is the form that is used to edit the verses of the song.
     """
@@ -151,14 +151,3 @@
             else:
                 self.up_button.setEnabled(True)
             self.delete_button.setEnabled(True)
-
-    def _get_main_window(self):
-        """
-        Adds the main window to the class dynamically
-        """
-        if not hasattr(self, '_main_window'):
-            self._main_window = Registry().get('main_window')
-        return self._main_window
-
-    main_window = property(_get_main_window)
-

=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py	2014-02-23 15:41:09 +0000
+++ openlp/core/ui/servicemanager.py	2014-03-17 07:34:01 +0000
@@ -39,8 +39,8 @@
 
 from PyQt4 import QtCore, QtGui
 
-from openlp.core.common import Registry, AppLocation, Settings, ThemeLevel, OpenLPMixin, RegistryMixin, \
-    check_directory_exists, UiStrings, translate
+from openlp.core.common import Registry, RegistryProperties, AppLocation, Settings, ThemeLevel, OpenLPMixin, \
+    RegistryMixin, check_directory_exists, UiStrings, translate
 from openlp.core.lib import OpenLPToolbar, ServiceItem, ItemCapabilities, PluginStatus, build_icon
 from openlp.core.lib.ui import critical_error_message_box, create_widget_action, find_and_set_in_combo_box
 from openlp.core.ui import ServiceNoteForm, ServiceItemEditForm, StartTimeForm
@@ -306,7 +306,7 @@
         event.accept()
 
 
-class ServiceManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ServiceManager):
+class ServiceManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ServiceManager, RegistryProperties):
     """
     Manages the services. This involves taking text strings from plugins and adding them to the service. This service
     can then be zipped up with all the resources used into one OSZ or oszl file for use on any OpenLP v2 installation.
@@ -1632,68 +1632,4 @@
         Print a Service Order Sheet.
         """
         setting_dialog = PrintServiceForm()
-        setting_dialog.exec_()
-
-    def _get_renderer(self):
-        """
-        Adds the Renderer to the class dynamically
-        """
-        if not hasattr(self, '_renderer'):
-            self._renderer = Registry().get('renderer')
-        return self._renderer
-
-    renderer = property(_get_renderer)
-
-    def _get_live_controller(self):
-        """
-        Adds the live controller to the class dynamically
-        """
-        if not hasattr(self, '_live_controller'):
-            self._live_controller = Registry().get('live_controller')
-        return self._live_controller
-
-    live_controller = property(_get_live_controller)
-
-    def _get_preview_controller(self):
-        """
-        Adds the preview controller to the class dynamically
-        """
-        if not hasattr(self, '_preview_controller'):
-            self._preview_controller = Registry().get('preview_controller')
-        return self._preview_controller
-
-    preview_controller = property(_get_preview_controller)
-
-    def _get_plugin_manager(self):
-        """
-        Adds the plugin manager to the class dynamically
-        """
-        if not hasattr(self, '_plugin_manager'):
-            self._plugin_manager = Registry().get('plugin_manager')
-        return self._plugin_manager
-
-    plugin_manager = property(_get_plugin_manager)
-
-    def _get_main_window(self):
-        """
-        Adds the main window to the class dynamically
-        """
-        if not hasattr(self, '_main_window'):
-            self._main_window = Registry().get('main_window')
-        return self._main_window
-
-    main_window = property(_get_main_window)
-
-    def _get_application(self):
-        """
-        Adds the openlp to the class dynamically.
-        Windows needs to access the application in a dynamic manner.
-        """
-        if os.name == 'nt':
-            return Registry().get('application')
-        else:
-            if not hasattr(self, '_application'):
-                self._application = Registry().get('application')
-            return self._application
-
-    application = property(_get_application)
+        setting_dialog.exec_()
\ No newline at end of file

=== modified file 'openlp/core/ui/servicenoteform.py'
--- openlp/core/ui/servicenoteform.py	2014-03-04 18:49:30 +0000
+++ openlp/core/ui/servicenoteform.py	2014-03-17 07:34:01 +0000
@@ -31,12 +31,12 @@
 """
 from PyQt4 import QtGui
 
-from openlp.core.common import Registry, translate
+from openlp.core.common import Registry, RegistryProperties, translate
 from openlp.core.lib import SpellTextEdit
 from openlp.core.lib.ui import create_button_box
 
 
-class ServiceNoteForm(QtGui.QDialog):
+class ServiceNoteForm(QtGui.QDialog, RegistryProperties):
     """
     This is the form that is used to edit the verses of the song.
     """
@@ -74,14 +74,4 @@
         """
         Translate the UI on the fly
         """
-        self.setWindowTitle(translate('OpenLP.ServiceNoteForm', 'Service Item Notes'))
-
-    def _get_main_window(self):
-        """
-        Adds the main window to the class dynamically
-        """
-        if not hasattr(self, '_main_window'):
-            self._main_window = Registry().get('main_window')
-        return self._main_window
-
-    main_window = property(_get_main_window)
+        self.setWindowTitle(translate('OpenLP.ServiceNoteForm', 'Service Item Notes'))
\ No newline at end of file

=== modified file 'openlp/core/ui/settingsform.py'
--- openlp/core/ui/settingsform.py	2013-12-31 20:29:03 +0000
+++ openlp/core/ui/settingsform.py	2014-03-17 07:34:01 +0000
@@ -33,7 +33,7 @@
 
 from PyQt4 import QtGui
 
-from openlp.core.common import Registry
+from openlp.core.common import Registry, RegistryProperties
 from openlp.core.lib import PluginStatus, build_icon
 from openlp.core.ui import AdvancedTab, GeneralTab, ThemesTab
 from openlp.core.ui.media import PlayerTab
@@ -42,7 +42,7 @@
 log = logging.getLogger(__name__)
 
 
-class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
+class SettingsForm(QtGui.QDialog, Ui_SettingsDialog, RegistryProperties):
     """
     Provide the form to manipulate the settings for OpenLP
     """
@@ -152,34 +152,4 @@
             The function to be called
         """
         if not function in self.processes:
-            self.processes.append(function)
-
-    def _get_main_window(self):
-        """
-        Adds the main window to the class dynamically
-        """
-        if not hasattr(self, '_main_window'):
-            self._main_window = Registry().get('main_window')
-        return self._main_window
-
-    main_window = property(_get_main_window)
-
-    def _get_service_manager(self):
-        """
-        Adds the plugin manager to the class dynamically
-        """
-        if not hasattr(self, '_service_manager'):
-            self._service_manager = Registry().get('service_manager')
-        return self._service_manager
-
-    service_manager = property(_get_service_manager)
-
-    def _get_plugin_manager(self):
-        """
-        Adds the plugin manager to the class dynamically
-        """
-        if not hasattr(self, '_plugin_manager'):
-            self._plugin_manager = Registry().get('plugin_manager')
-        return self._plugin_manager
-
-    plugin_manager = property(_get_plugin_manager)
+            self.processes.append(function)
\ No newline at end of file

=== modified file 'openlp/core/ui/shortcutlistform.py'
--- openlp/core/ui/shortcutlistform.py	2013-12-28 21:33:38 +0000
+++ openlp/core/ui/shortcutlistform.py	2014-03-17 07:34:01 +0000
@@ -33,7 +33,7 @@
 
 from PyQt4 import QtCore, QtGui
 
-from openlp.core.common import Registry, Settings, translate
+from openlp.core.common import RegistryProperties, Settings, translate
 from openlp.core.utils.actions import ActionList
 from .shortcutlistdialog import Ui_ShortcutListDialog
 
@@ -42,7 +42,7 @@
 log = logging.getLogger(__name__)
 
 
-class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
+class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog, RegistryProperties):
     """
     The shortcut list dialog
     """
@@ -462,14 +462,3 @@
             button.setChecked(checked)
         if enabled is not None:
             button.setEnabled(enabled)
-
-    def _get_main_window(self):
-        """
-        Adds the main window to the class dynamically
-        """
-        if not hasattr(self, '_main_window'):
-            self._main_window = Registry().get('main_window')
-        return self._main_window
-
-    main_window = property(_get_main_window)
-

=== modified file 'openlp/core/ui/starttimeform.py'
--- openlp/core/ui/starttimeform.py	2013-12-28 21:33:38 +0000
+++ openlp/core/ui/starttimeform.py	2014-03-17 07:34:01 +0000
@@ -33,11 +33,11 @@
 
 from .starttimedialog import Ui_StartTimeDialog
 
-from openlp.core.common import Registry, UiStrings, translate
+from openlp.core.common import Registry, RegistryProperties, UiStrings, translate
 from openlp.core.lib.ui import critical_error_message_box
 
 
-class StartTimeForm(QtGui.QDialog, Ui_StartTimeDialog):
+class StartTimeForm(QtGui.QDialog, Ui_StartTimeDialog, RegistryProperties):
     """
     The start time dialog
     """
@@ -88,20 +88,10 @@
 
     def _time_split(self, seconds):
         """
-        Split time up into hours minutes and seconds from secongs
+        Split time up into hours minutes and seconds from seconds
         """
         hours = seconds // 3600
         seconds -= 3600 * hours
         minutes = seconds // 60
         seconds -= 60 * minutes
-        return hours, minutes, seconds
-
-    def _get_main_window(self):
-        """
-        Adds the main window to the class dynamically
-        """
-        if not hasattr(self, '_main_window'):
-            self._main_window = Registry().get('main_window')
-        return self._main_window
-
-    main_window = property(_get_main_window)
+        return hours, minutes, seconds
\ No newline at end of file

=== modified file 'openlp/core/ui/themeform.py'
--- openlp/core/ui/themeform.py	2013-12-28 21:33:38 +0000
+++ openlp/core/ui/themeform.py	2014-03-17 07:34:01 +0000
@@ -34,7 +34,7 @@
 
 from PyQt4 import QtCore, QtGui
 
-from openlp.core.common import Registry, UiStrings, translate
+from openlp.core.common import Registry, RegistryProperties, UiStrings, translate
 from openlp.core.lib.theme import BackgroundType, BackgroundGradientType
 from openlp.core.lib.ui import critical_error_message_box
 from openlp.core.ui import ThemeLayoutForm
@@ -44,7 +44,7 @@
 log = logging.getLogger(__name__)
 
 
-class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
+class ThemeForm(QtGui.QWizard, Ui_ThemeWizard, RegistryProperties):
     """
     This is the Theme Import Wizard, which allows easy creation and editing of
     OpenLP themes.
@@ -541,24 +541,4 @@
         new_color = QtGui.QColorDialog.getColor(QtGui.QColor(field), self)
         if new_color.isValid():
             field = new_color.name()
-        return field
-
-    def _get_renderer(self):
-        """
-        Adds the Renderer to the class dynamically
-        """
-        if not hasattr(self, '_renderer'):
-            self._renderer = Registry().get('renderer')
-        return self._renderer
-
-    renderer = property(_get_renderer)
-
-    def _get_theme_manager(self):
-        """
-        Adds the theme manager to the class dynamically
-        """
-        if not hasattr(self, '_theme_manager'):
-            self._theme_manager = Registry().get('theme_manager')
-        return self._theme_manager
-
-    theme_manager = property(_get_theme_manager)
+        return field
\ No newline at end of file

=== modified file 'openlp/core/ui/thememanager.py'
--- openlp/core/ui/thememanager.py	2014-01-11 22:05:38 +0000
+++ openlp/core/ui/thememanager.py	2014-03-17 07:34:01 +0000
@@ -36,8 +36,8 @@
 from xml.etree.ElementTree import ElementTree, XML
 from PyQt4 import QtCore, QtGui
 
-from openlp.core.common import Registry, AppLocation, Settings, OpenLPMixin, RegistryMixin, check_directory_exists, \
-    UiStrings, translate
+from openlp.core.common import Registry, RegistryProperties, AppLocation, Settings, OpenLPMixin, RegistryMixin, \
+    check_directory_exists, UiStrings, translate
 from openlp.core.lib import FileDialog, ImageSource, OpenLPToolbar, get_text_file_string, build_icon, \
     check_item_selected, create_thumb, validate_thumb
 from openlp.core.lib.theme import ThemeXML, BackgroundType
@@ -127,7 +127,7 @@
         self.theme_list_widget.currentItemChanged.connect(self.check_list_state)
 
 
-class ThemeManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ThemeManager):
+class ThemeManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ThemeManager, RegistryProperties):
     """
     Manages the orders of Theme.
     """
@@ -753,58 +753,4 @@
                                                    % (theme, plugin.name))
                         return False
             return True
-        return False
-
-    def _get_renderer(self):
-        """
-        Adds the Renderer to the class dynamically
-        """
-        if not hasattr(self, '_renderer'):
-            self._renderer = Registry().get('renderer')
-        return self._renderer
-
-    renderer = property(_get_renderer)
-
-    def _get_image_manager(self):
-        """
-        Adds the image manager to the class dynamically
-        """
-        if not hasattr(self, '_image_manager'):
-            self._image_manager = Registry().get('image_manager')
-        return self._image_manager
-
-    image_manager = property(_get_image_manager)
-
-    def _get_plugin_manager(self):
-        """
-        Adds the Renderer to the class dynamically
-        """
-        if not hasattr(self, '_plugin_manager'):
-            self._plugin_manager = Registry().get('plugin_manager')
-        return self._plugin_manager
-
-    plugin_manager = property(_get_plugin_manager)
-
-    def _get_main_window(self):
-        """
-        Adds the main window to the class dynamically
-        """
-        if not hasattr(self, '_main_window'):
-            self._main_window = Registry().get('main_window')
-        return self._main_window
-
-    main_window = property(_get_main_window)
-
-    def _get_application(self):
-        """
-        Adds the openlp to the class dynamically.
-        Windows needs to access the application in a dynamic manner.
-        """
-        if os.name == 'nt':
-            return Registry().get('application')
-        else:
-            if not hasattr(self, '_application'):
-                self._application = Registry().get('application')
-            return self._application
-
-    application = property(_get_application)
+        return False
\ No newline at end of file

=== modified file 'openlp/core/ui/wizard.py'
--- openlp/core/ui/wizard.py	2014-03-04 18:49:30 +0000
+++ openlp/core/ui/wizard.py	2014-03-17 07:34:01 +0000
@@ -34,7 +34,7 @@
 
 from PyQt4 import QtGui
 
-from openlp.core.common import Registry, Settings, UiStrings, translate
+from openlp.core.common import Registry, RegistryProperties, Settings, UiStrings, translate
 from openlp.core.lib import build_icon
 from openlp.core.lib.ui import add_welcome_page
 
@@ -72,7 +72,7 @@
         '%s folder to import from.', 'A song format e.g. PowerSong')
 
 
-class OpenLPWizard(QtGui.QWizard):
+class OpenLPWizard(QtGui.QWizard, RegistryProperties):
     """
     Generic OpenLP wizard to provide generic functionality and a unified look
     and feel.
@@ -318,18 +318,4 @@
             QtGui.QFileDialog.ShowDirsOnly)
         if folder:
             editbox.setText(folder)
-        Settings().setValue(self.plugin.settings_section + '/' + setting_name, folder)
-
-    def _get_application(self):
-        """
-        Adds the openlp to the class dynamically.
-        Windows needs to access the application in a dynamic manner.
-        """
-        if os.name == 'nt':
-            return Registry().get('application')
-        else:
-            if not hasattr(self, '_application'):
-                self._application = Registry().get('application')
-            return self._application
-
-    application = property(_get_application)
+        Settings().setValue(self.plugin.settings_section + '/' + setting_name, folder)
\ No newline at end of file

=== modified file 'openlp/plugins/alerts/alertsplugin.py'
--- openlp/plugins/alerts/alertsplugin.py	2014-01-01 09:57:06 +0000
+++ openlp/plugins/alerts/alertsplugin.py	2014-03-17 07:34:01 +0000
@@ -140,7 +140,7 @@
         self.weight = -3
         self.icon_path = ':/plugins/plugin_alerts.png'
         self.icon = build_icon(self.icon_path)
-        self.alerts_manager = AlertsManager(self)
+        AlertsManager(self)
         self.manager = Manager('alerts', init_schema)
         self.alert_form = AlertForm(self)
 

=== modified file 'openlp/plugins/alerts/lib/alertsmanager.py'
--- openlp/plugins/alerts/lib/alertsmanager.py	2014-01-11 21:46:20 +0000
+++ openlp/plugins/alerts/lib/alertsmanager.py	2014-03-17 07:34:01 +0000
@@ -33,10 +33,10 @@
 
 from PyQt4 import QtCore
 
-from openlp.core.common import OpenLPMixin, RegistryMixin, Registry, translate
-
-
-class AlertsManager(OpenLPMixin, RegistryMixin, QtCore.QObject):
+from openlp.core.common import OpenLPMixin, RegistryMixin, Registry, RegistryProperties, translate
+
+
+class AlertsManager(OpenLPMixin, RegistryMixin, QtCore.QObject, RegistryProperties):
     """
     AlertsManager manages the settings of Alerts.
     """
@@ -97,24 +97,4 @@
             self.live_controller.display.alert('', alert_tab.location)
         self.killTimer(self.timer_id)
         self.timer_id = 0
-        self.generate_alert()
-
-    def _get_live_controller(self):
-        """
-        Adds the live controller to the class dynamically
-        """
-        if not hasattr(self, '_live_controller'):
-            self._live_controller = Registry().get('live_controller')
-        return self._live_controller
-
-    live_controller = property(_get_live_controller)
-
-    def _get_main_window(self):
-        """
-        Adds the main window to the class dynamically
-        """
-        if not hasattr(self, '_main_window'):
-            self._main_window = Registry().get('main_window')
-        return self._main_window
-
-    main_window = property(_get_main_window)
+        self.generate_alert()
\ No newline at end of file

=== modified file 'openlp/plugins/bibles/forms/editbibleform.py'
--- openlp/plugins/bibles/forms/editbibleform.py	2013-12-28 21:33:38 +0000
+++ openlp/plugins/bibles/forms/editbibleform.py	2014-03-17 07:34:01 +0000
@@ -33,7 +33,7 @@
 
 from PyQt4 import QtGui
 
-from openlp.core.common import Registry, UiStrings, translate
+from openlp.core.common import RegistryProperties, UiStrings, translate
 from openlp.core.lib.ui import critical_error_message_box
 from .editbibledialog import Ui_EditBibleDialog
 from openlp.plugins.bibles.lib import BibleStrings
@@ -41,7 +41,7 @@
 
 log = logging.getLogger(__name__)
 
-class EditBibleForm(QtGui.QDialog, Ui_EditBibleDialog):
+class EditBibleForm(QtGui.QDialog, Ui_EditBibleDialog, RegistryProperties):
     """
     Class to manage the editing of a bible
     """
@@ -189,17 +189,3 @@
                             % new_book_name)
                     return False
         return True
-
-    def _get_application(self):
-        """
-        Adds the openlp to the class dynamically.
-        Windows needs to access the application in a dynamic manner.
-        """
-        if os.name == 'nt':
-            return Registry().get('application')
-        else:
-            if not hasattr(self, '_application'):
-                self._application = Registry().get('application')
-            return self._application
-
-    application = property(_get_application)

=== modified file 'openlp/plugins/bibles/lib/db.py'
--- openlp/plugins/bibles/lib/db.py	2014-03-11 19:01:09 +0000
+++ openlp/plugins/bibles/lib/db.py	2014-03-17 07:34:01 +0000
@@ -38,7 +38,7 @@
 from sqlalchemy.orm import class_mapper, mapper, relation
 from sqlalchemy.orm.exc import UnmappedClassError
 
-from openlp.core.common import Registry, AppLocation, translate
+from openlp.core.common import Registry, RegistryProperties, AppLocation, translate
 from openlp.core.lib.db import BaseModel, init_db, Manager
 from openlp.core.lib.ui import critical_error_message_box
 from openlp.core.utils import clean_filename
@@ -116,7 +116,7 @@
     return session
 
 
-class BibleDB(QtCore.QObject, Manager):
+class BibleDB(QtCore.QObject, Manager, RegistryProperties):
     """
     This class represents a database-bound Bible. It is used as a base class for all the custom importers, so that
     the can implement their own import methods, but benefit from the database methods in here via inheritance,
@@ -501,20 +501,6 @@
         verses = self.session.query(Verse).all()
         log.debug(verses)
 
-    def _get_application(self):
-        """
-        Adds the openlp to the class dynamically.
-        Windows needs to access the application in a dynamic manner.
-        """
-        if os.name == 'nt':
-            return Registry().get('application')
-        else:
-            if not hasattr(self, '_application'):
-                self._application = Registry().get('application')
-            return self._application
-
-    application = property(_get_application)
-
 
 class BiblesResourcesDB(QtCore.QObject, Manager):
     """

=== modified file 'openlp/plugins/bibles/lib/http.py'
--- openlp/plugins/bibles/lib/http.py	2014-03-09 10:26:28 +0000
+++ openlp/plugins/bibles/lib/http.py	2014-03-17 07:34:01 +0000
@@ -29,7 +29,6 @@
 """
 The :mod:`http` module enables OpenLP to retrieve scripture from bible websites.
 """
-import os
 import logging
 import re
 import socket
@@ -38,7 +37,7 @@
 
 from bs4 import BeautifulSoup, NavigableString, Tag
 
-from openlp.core.common import Registry, translate
+from openlp.core.common import Registry, RegistryProperties, translate
 from openlp.core.lib.ui import critical_error_message_box
 from openlp.core.utils import get_web_page
 from openlp.plugins.bibles.lib import SearchResults
@@ -61,7 +60,7 @@
 log = logging.getLogger(__name__)
 
 
-class BGExtract(object):
+class BGExtract(RegistryProperties):
     """
     Extract verses from BibleGateway
     """
@@ -285,22 +284,8 @@
                 books.append(book.contents[0])
         return books
 
-    def _get_application(self):
-        """
-        Adds the openlp to the class dynamically.
-        Windows needs to access the application in a dynamic manner.
-        """
-        if os.name == 'nt':
-            return Registry().get('application')
-        else:
-            if not hasattr(self, '_application'):
-                self._application = Registry().get('application')
-            return self._application
-
-    application = property(_get_application)
-
-
-class BSExtract(object):
+
+class BSExtract(RegistryProperties):
     """
     Extract verses from Bibleserver.com
     """
@@ -359,22 +344,8 @@
         content = content.find_all('li')
         return [book.contents[0].contents[0] for book in content if len(book.contents[0].contents)]
 
-    def _get_application(self):
-        """
-        Adds the openlp to the class dynamically.
-        Windows needs to access the application in a dynamic manner.
-        """
-        if os.name == 'nt':
-            return Registry().get('application')
-        else:
-            if not hasattr(self, '_application'):
-                self._application = Registry().get('application')
-            return self._application
-
-    application = property(_get_application)
-
-
-class CWExtract(object):
+
+class CWExtract(RegistryProperties):
     """
     Extract verses from CrossWalk/BibleStudyTools
     """
@@ -457,22 +428,8 @@
             books.append(book.contents[0])
         return books
 
-    def _get_application(self):
-        """
-        Adds the openlp to the class dynamically.
-        Windows needs to access the application in a dynamic manner.
-        """
-        if os.name == 'nt':
-            return Registry().get('application')
-        else:
-            if not hasattr(self, '_application'):
-                self._application = Registry().get('application')
-            return self._application
-
-    application = property(_get_application)
-
-
-class HTTPBible(BibleDB):
+
+class HTTPBible(BibleDB, RegistryProperties):
     log.info('%s HTTPBible loaded', __name__)
 
     def __init__(self, parent, **kwargs):
@@ -647,20 +604,6 @@
         log.debug('HTTPBible.get_verse_count("%s", %s)', book_id, chapter)
         return BiblesResourcesDB.get_verse_count(book_id, chapter)
 
-    def _get_application(self):
-        """
-        Adds the openlp to the class dynamically.
-        Windows needs to access the application in a dynamic manner.
-        """
-        if os.name == 'nt':
-            return Registry().get('application')
-        else:
-            if not hasattr(self, '_application'):
-                self._application = Registry().get('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):
     """

=== modified file 'openlp/plugins/bibles/lib/manager.py'
--- openlp/plugins/bibles/lib/manager.py	2014-03-11 19:01:09 +0000
+++ openlp/plugins/bibles/lib/manager.py	2014-03-17 07:34:01 +0000
@@ -30,7 +30,7 @@
 import logging
 import os
 
-from openlp.core.common import Registry, AppLocation, Settings, translate
+from openlp.core.common import RegistryProperties, AppLocation, Settings, translate
 from openlp.core.utils import delete_file
 from openlp.plugins.bibles.lib import parse_reference, get_reference_separator, LanguageSelection
 from openlp.plugins.bibles.lib.db import BibleDB, BibleMeta
@@ -84,7 +84,7 @@
         ]
 
 
-class BibleManager(object):
+class BibleManager(RegistryProperties):
     """
     The Bible manager which holds and manages all the Bibles.
     """
@@ -405,15 +405,4 @@
         for bible in self.db_cache:
             self.db_cache[bible].finalise()
 
-    def _get_main_window(self):
-        """
-        Adds the main window to the class dynamically
-        """
-        if not hasattr(self, '_main_window'):
-            self._main_window = Registry().get('main_window')
-        return self._main_window
-
-    main_window = property(_get_main_window)
-
-
 __all__ = ['BibleFormat']

=== modified file 'openlp/plugins/images/imageplugin.py'
--- openlp/plugins/images/imageplugin.py	2014-03-08 20:39:36 +0000
+++ openlp/plugins/images/imageplugin.py	2014-03-17 07:34:01 +0000
@@ -124,13 +124,3 @@
         log.info('Images config_update')
         background = QtGui.QColor(Settings().value(self.settings_section + '/background color'))
         self.image_manager.update_images_border(ImageSource.ImagePlugin, background)
-
-    def _get_image_manager(self):
-        """
-        Adds the image manager to the class dynamically
-        """
-        if not hasattr(self, '_image_manager'):
-            self._image_manager = Registry().get('image_manager')
-        return self._image_manager
-
-    image_manager = property(_get_image_manager)

=== modified file 'openlp/plugins/media/lib/mediaitem.py'
--- openlp/plugins/media/lib/mediaitem.py	2014-03-08 20:53:22 +0000
+++ openlp/plugins/media/lib/mediaitem.py	2014-03-17 07:34:01 +0000
@@ -32,7 +32,8 @@
 
 from PyQt4 import QtCore, QtGui
 
-from openlp.core.common import Registry, AppLocation, Settings, check_directory_exists, UiStrings, translate
+from openlp.core.common import Registry, RegistryProperties, AppLocation, Settings, check_directory_exists, UiStrings,\
+    translate
 from openlp.core.lib import ItemCapabilities, MediaManagerItem,MediaType, ServiceItem, ServiceItemContext, \
     build_icon, check_item_selected
 from openlp.core.lib.ui import critical_error_message_box, create_horizontal_adjusting_combo_box
@@ -51,7 +52,7 @@
 ERROR_ICON = build_icon(':/general/general_delete.png')
 
 
-class MediaMediaItem(MediaManagerItem):
+class MediaMediaItem(MediaManagerItem, RegistryProperties):
     """
     This is the custom media manager item for Media Slides.
     """

=== modified file 'openlp/plugins/media/mediaplugin.py'
--- openlp/plugins/media/mediaplugin.py	2014-03-08 20:53:22 +0000
+++ openlp/plugins/media/mediaplugin.py	2014-03-17 07:34:01 +0000
@@ -31,7 +31,7 @@
 
 from PyQt4 import QtCore
 
-from openlp.core.common import Registry, translate
+from openlp.core.common import translate
 from openlp.core.lib import Plugin, StringContent, build_icon
 from openlp.plugins.media.lib import MediaMediaItem, MediaTab
 
@@ -120,13 +120,3 @@
         Add html code to htmlbuilder.
         """
         return self.media_controller.get_media_display_html()
-
-    def _get_media_controller(self):
-        """
-        Adds the media controller to the class dynamically
-        """
-        if not hasattr(self, '_media_controller'):
-            self._media_controller = Registry().get('media_controller')
-        return self._media_controller
-
-    media_controller = property(_get_media_controller)

=== modified file 'openlp/plugins/presentations/lib/presentationcontroller.py'
--- openlp/plugins/presentations/lib/presentationcontroller.py	2014-03-08 21:23:47 +0000
+++ openlp/plugins/presentations/lib/presentationcontroller.py	2014-03-17 07:34:01 +0000
@@ -426,13 +426,3 @@
 
     def close_presentation(self):
         pass
-
-    def _get_plugin_manager(self):
-        """
-        Adds the plugin manager to the class dynamically
-        """
-        if not hasattr(self, '_plugin_manager'):
-            self._plugin_manager = Registry().get('plugin_manager')
-        return self._plugin_manager
-
-    plugin_manager = property(_get_plugin_manager)

=== modified file 'openlp/plugins/remotes/lib/httprouter.py'
--- openlp/plugins/remotes/lib/httprouter.py	2013-12-28 21:33:38 +0000
+++ openlp/plugins/remotes/lib/httprouter.py	2014-03-17 07:34:01 +0000
@@ -124,7 +124,7 @@
 from mako.template import Template
 from PyQt4 import QtCore
 
-from openlp.core.common import Registry, AppLocation, Settings, translate
+from openlp.core.common import Registry, RegistryProperties, AppLocation, Settings, translate
 from openlp.core.lib import PluginStatus, StringContent, image_to_byte
 
 log = logging.getLogger(__name__)
@@ -139,7 +139,7 @@
 }
 
 
-class HttpRouter(object):
+class HttpRouter(RegistryProperties):
     """
     This code is called by the HttpServer upon a request and it processes it based on the routing table.
     This code is stateless and is created on each request.
@@ -601,43 +601,3 @@
             item_id = plugin.media_item.create_item_from_id(id)
             plugin.media_item.emit(QtCore.SIGNAL('%s_add_to_service' % plugin_name), [item_id, True])
         self.do_http_success()
-
-    def _get_service_manager(self):
-        """
-        Adds the service manager to the class dynamically
-        """
-        if not hasattr(self, '_service_manager'):
-            self._service_manager = Registry().get('service_manager')
-        return self._service_manager
-
-    service_manager = property(_get_service_manager)
-
-    def _get_live_controller(self):
-        """
-        Adds the live controller to the class dynamically
-        """
-        if not hasattr(self, '_live_controller'):
-            self._live_controller = Registry().get('live_controller')
-        return self._live_controller
-
-    live_controller = property(_get_live_controller)
-
-    def _get_plugin_manager(self):
-        """
-        Adds the plugin manager to the class dynamically
-        """
-        if not hasattr(self, '_plugin_manager'):
-            self._plugin_manager = Registry().get('plugin_manager')
-        return self._plugin_manager
-
-    plugin_manager = property(_get_plugin_manager)
-
-    def _get_alerts_manager(self):
-        """
-        Adds the alerts manager to the class dynamically
-        """
-        if not hasattr(self, '_alerts_manager'):
-            self._alerts_manager = Registry().get('alerts_manager')
-        return self._alerts_manager
-
-    alerts_manager = property(_get_alerts_manager)

=== modified file 'openlp/plugins/songs/forms/duplicatesongremovalform.py'
--- openlp/plugins/songs/forms/duplicatesongremovalform.py	2014-03-04 18:49:30 +0000
+++ openlp/plugins/songs/forms/duplicatesongremovalform.py	2014-03-17 07:34:01 +0000
@@ -35,7 +35,7 @@
 
 from PyQt4 import QtCore, QtGui
 
-from openlp.core.common import Registry, translate
+from openlp.core.common import Registry, RegistryProperties, translate
 from openlp.core.ui.wizard import OpenLPWizard, WizardStrings
 from openlp.plugins.songs.lib import delete_song
 from openlp.plugins.songs.lib.db import Song, MediaFile
@@ -45,7 +45,7 @@
 log = logging.getLogger(__name__)
 
 
-class DuplicateSongRemovalForm(OpenLPWizard):
+class DuplicateSongRemovalForm(OpenLPWizard, RegistryProperties):
     """
     This is the Duplicate Song Removal Wizard. It provides functionality to search for and remove duplicate songs
     in the database.
@@ -327,29 +327,4 @@
             self.button(QtGui.QWizard.FinishButton).show()
             self.button(QtGui.QWizard.FinishButton).setEnabled(True)
             self.button(QtGui.QWizard.NextButton).hide()
-            self.button(QtGui.QWizard.CancelButton).hide()
-
-    def _get_main_window(self):
-        """
-        Adds the main window to the class dynamically.
-        """
-        if not hasattr(self, '_main_window'):
-            self._main_window = Registry().get('main_window')
-        return self._main_window
-
-    main_window = property(_get_main_window)
-
-    def _get_application(self):
-        """
-        Adds the openlp to the class dynamically.
-        Windows needs to access the application in a dynamic manner.
-        """
-        if os.name == 'nt':
-            return Registry().get('application')
-        else:
-            if not hasattr(self, '_application'):
-                self._application = Registry().get('application')
-            return self._application
-
-    application = property(_get_application)
-
+            self.button(QtGui.QWizard.CancelButton).hide()
\ No newline at end of file

=== modified file 'openlp/plugins/songs/forms/editsongform.py'
--- openlp/plugins/songs/forms/editsongform.py	2014-03-04 18:49:30 +0000
+++ openlp/plugins/songs/forms/editsongform.py	2014-03-17 07:34:01 +0000
@@ -38,7 +38,7 @@
 
 from PyQt4 import QtCore, QtGui
 
-from openlp.core.common import Registry, AppLocation, UiStrings, check_directory_exists, translate
+from openlp.core.common import Registry, RegistryProperties, AppLocation, UiStrings, check_directory_exists, translate
 from openlp.core.lib import FileDialog, PluginStatus, MediaType, create_separated_list
 from openlp.core.lib.ui import set_case_insensitive_completer, critical_error_message_box, find_and_set_in_combo_box
 from openlp.plugins.songs.lib import VerseType, clean_song
@@ -52,7 +52,7 @@
 log = logging.getLogger(__name__)
 
 
-class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
+class EditSongForm(QtGui.QDialog, Ui_EditSongDialog, RegistryProperties):
     """
     Class to manage the editing of a song
     """
@@ -955,24 +955,4 @@
                 log.exception('Could not remove directory: %s', save_path)
         clean_song(self.manager, self.song)
         self.manager.save_object(self.song)
-        self.media_item.auto_select_id = self.song.id
-
-    def _get_plugin_manager(self):
-        """
-        Adds the plugin manager to the class dynamically
-        """
-        if not hasattr(self, '_plugin_manager'):
-            self._plugin_manager = Registry().get('plugin_manager')
-        return self._plugin_manager
-
-    plugin_manager = property(_get_plugin_manager)
-
-    def _get_theme_manager(self):
-        """
-        Adds the theme manager to the class dynamically
-        """
-        if not hasattr(self, '_theme_manager'):
-            self._theme_manager = Registry().get('theme_manager')
-        return self._theme_manager
-
-    theme_manager = property(_get_theme_manager)
+        self.media_item.auto_select_id = self.song.id
\ No newline at end of file

=== modified file 'openlp/plugins/songs/forms/songimportform.py'
--- openlp/plugins/songs/forms/songimportform.py	2014-03-06 20:40:08 +0000
+++ openlp/plugins/songs/forms/songimportform.py	2014-03-17 07:34:01 +0000
@@ -35,7 +35,7 @@
 
 from PyQt4 import QtCore, QtGui
 
-from openlp.core.common import Registry, Settings, UiStrings, translate
+from openlp.core.common import RegistryProperties, Settings, UiStrings, translate
 from openlp.core.lib import FileDialog
 from openlp.core.lib.ui import critical_error_message_box
 from openlp.core.ui.wizard import OpenLPWizard, WizardStrings
@@ -44,7 +44,7 @@
 log = logging.getLogger(__name__)
 
 
-class SongImportForm(OpenLPWizard):
+class SongImportForm(OpenLPWizard, RegistryProperties):
     """
     This is the Song Import Wizard, which allows easy importing of Songs
     into OpenLP from other formats like OpenLyrics, OpenSong and CCLI.
@@ -480,26 +480,6 @@
         self.format_widgets[this_format]['import_widget'] = import_widget
         return import_widget
 
-    def _get_main_window(self):
-        """
-        Adds the main window to the class dynamically
-        """
-        if not hasattr(self, '_main_window'):
-            self._main_window = Registry().get('main_window')
-        return self._main_window
-
-    main_window = property(_get_main_window)
-
-    def _get_main_window(self):
-        """
-        Adds the main window to the class dynamically
-        """
-        if not hasattr(self, '_main_window'):
-            self._main_window = Registry().get('main_window')
-        return self._main_window
-
-    main_window = property(_get_main_window)
-
 
 class SongImportSourcePage(QtGui.QWizardPage):
     """

=== modified file 'openlp/plugins/songs/forms/songmaintenanceform.py'
--- openlp/plugins/songs/forms/songmaintenanceform.py	2014-03-04 18:49:30 +0000
+++ openlp/plugins/songs/forms/songmaintenanceform.py	2014-03-17 07:34:01 +0000
@@ -32,7 +32,7 @@
 from PyQt4 import QtGui, QtCore
 from sqlalchemy.sql import and_
 
-from openlp.core.common import Registry, UiStrings, translate
+from openlp.core.common import Registry, RegistryProperties, UiStrings, translate
 from openlp.core.lib.ui import critical_error_message_box
 from openlp.plugins.songs.forms.authorsform import AuthorsForm
 from openlp.plugins.songs.forms.topicsform import TopicsForm
@@ -43,7 +43,7 @@
 log = logging.getLogger(__name__)
 
 
-class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
+class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog, RegistryProperties):
     """
     Class documentation goes here.
     """
@@ -531,18 +531,4 @@
             edit_button.setEnabled(False)
         else:
             delete_button.setEnabled(True)
-            edit_button.setEnabled(True)
-
-    def _get_application(self):
-        """
-        Adds the openlp to the class dynamically.
-        Windows needs to access the application in a dynamic manner.
-        """
-        if os.name == 'nt':
-            return Registry().get('application')
-        else:
-            if not hasattr(self, '_application'):
-                self._application = Registry().get('application')
-            return self._application
-
-    application = property(_get_application)
+            edit_button.setEnabled(True)
\ No newline at end of file

=== modified file 'openlp/plugins/songs/lib/openlyricsexport.py'
--- openlp/plugins/songs/lib/openlyricsexport.py	2014-03-06 22:05:15 +0000
+++ openlp/plugins/songs/lib/openlyricsexport.py	2014-03-17 07:34:01 +0000
@@ -35,14 +35,14 @@
 
 from lxml import etree
 
-from openlp.core.common import Registry, check_directory_exists, translate
+from openlp.core.common import RegistryProperties, check_directory_exists, translate
 from openlp.core.utils import clean_filename
 from openlp.plugins.songs.lib.xml import OpenLyrics
 
 log = logging.getLogger(__name__)
 
 
-class OpenLyricsExport(object):
+class OpenLyricsExport(RegistryProperties):
     """
     This provides the Openlyrics export.
     """
@@ -82,16 +82,3 @@
                        pretty_print=True)
         return True
 
-    def _get_application(self):
-        """
-        Adds the openlp to the class dynamically.
-        Windows needs to access the application in a dynamic manner.
-        """
-        if os.name == 'nt':
-            return Registry().get('application')
-        else:
-            if not hasattr(self, '_application'):
-                self._application = Registry().get('application')
-            return self._application
-
-    application = property(_get_application)

=== modified file 'openlp/plugins/songusage/forms/songusagedeleteform.py'
--- openlp/plugins/songusage/forms/songusagedeleteform.py	2014-01-11 22:01:41 +0000
+++ openlp/plugins/songusage/forms/songusagedeleteform.py	2014-03-17 07:34:01 +0000
@@ -29,12 +29,12 @@
 
 from PyQt4 import QtGui
 
-from openlp.core.common import Registry, translate
+from openlp.core.common import RegistryProperties, translate
 from openlp.plugins.songusage.lib.db import SongUsageItem
 from .songusagedeletedialog import Ui_SongUsageDeleteDialog
 
 
-class SongUsageDeleteForm(QtGui.QDialog, Ui_SongUsageDeleteDialog):
+class SongUsageDeleteForm(QtGui.QDialog, Ui_SongUsageDeleteDialog, RegistryProperties):
     """
     Class documentation goes here.
     """
@@ -70,14 +70,4 @@
                 )
                 self.accept()
         else:
-            self.reject()
-
-    def _get_main_window(self):
-        """
-        Adds the main window to the class dynamically
-        """
-        if not hasattr(self, '_main_window'):
-            self._main_window = Registry().get('main_window')
-        return self._main_window
-
-    main_window = property(_get_main_window)
+            self.reject()
\ No newline at end of file

=== modified file 'openlp/plugins/songusage/forms/songusagedetailform.py'
--- openlp/plugins/songusage/forms/songusagedetailform.py	2014-01-11 22:01:41 +0000
+++ openlp/plugins/songusage/forms/songusagedetailform.py	2014-03-17 07:34:01 +0000
@@ -33,14 +33,14 @@
 from PyQt4 import QtGui
 from sqlalchemy.sql import and_
 
-from openlp.core.common import Registry, Settings, check_directory_exists, translate
+from openlp.core.common import RegistryProperties, Settings, check_directory_exists, translate
 from openlp.plugins.songusage.lib.db import SongUsageItem
 from .songusagedetaildialog import Ui_SongUsageDetailDialog
 
 log = logging.getLogger(__name__)
 
 
-class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog):
+class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog, RegistryProperties):
     """
     Class documentation goes here.
     """
@@ -118,13 +118,3 @@
             if file_handle:
                 file_handle.close()
         self.close()
-
-    def _get_main_window(self):
-        """
-        Adds the main window to the class dynamically
-        """
-        if not hasattr(self, '_main_window'):
-            self._main_window = Registry().get('main_window')
-        return self._main_window
-
-    main_window = property(_get_main_window)

=== modified file 'tests/functional/__init__.py'
--- tests/functional/__init__.py	2014-03-04 21:28:15 +0000
+++ tests/functional/__init__.py	2014-03-17 07:34:01 +0000
@@ -1,4 +1,31 @@
 # -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection                                      #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2014 Raoul Snyman                                        #
+# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan      #
+# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub,      #
+# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer.   #
+# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru,          #
+# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith,             #
+# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock,              #
+# Frode Woldsund, Martin Zibricky, Patrick Zimmermann                         #
+# --------------------------------------------------------------------------- #
+# This program is free software; you can redistribute it and/or modify it     #
+# under the terms of the GNU General Public License as published by the Free  #
+# Software Foundation; version 2 of the License.                              #
+#                                                                             #
+# This program is distributed in the hope that it will be useful, but WITHOUT #
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or       #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for    #
+# more details.                                                               #
+#                                                                             #
+# You should have received a copy of the GNU General Public License along     #
+# with this program; if not, write to the Free Software Foundation, Inc., 59  #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA                          #
+###############################################################################
 """
 Base directory for tests
 """

=== modified file 'tests/functional/openlp_core_common/test_registryproperties.py'
--- tests/functional/openlp_core_common/test_registryproperties.py	2014-03-14 20:06:24 +0000
+++ tests/functional/openlp_core_common/test_registryproperties.py	2014-03-17 07:34:01 +0000
@@ -41,17 +41,23 @@
     """
     def setUp(self):
         """
-        Create the UI
+        Create the Register
         """
         Registry.create()
 
     def no_application_test(self):
+        """
+        Test property if no registry value assigned
+        """
         # GIVEN an Empty Registry
         # WHEN there is no Application
         # THEN the application should be none
         self.assertEquals(self.application, None, 'The application value should be None')
 
     def application_test(self):
+        """
+        Test property if registry value assigned
+        """
         # GIVEN an Empty Registry
         application = MagicMock()
         # WHEN the application is registered

=== modified file 'tests/functional/openlp_core_common/test_settings.py'
--- tests/functional/openlp_core_common/test_settings.py	2014-03-13 20:59:10 +0000
+++ tests/functional/openlp_core_common/test_settings.py	2014-03-17 07:34:01 +0000
@@ -29,16 +29,13 @@
 """
 Package to test the openlp.core.lib.settings package.
 """
-import os
-from tempfile import mkstemp
-
 from unittest import TestCase
-from PyQt4 import QtGui
 
 from openlp.core.common import Settings
-
-
-class TestSettings(TestCase):
+from tests.helpers.testmixin import TestMixin
+
+
+class TestSettings(TestCase, TestMixin):
     """
     Test the functions in the Settings module
     """
@@ -46,18 +43,14 @@
         """
         Create the UI
         """
-        Settings.setDefaultFormat(Settings.IniFormat)
-        self.fd, self.ini_file = mkstemp('.ini')
-        Settings().set_filename(self.ini_file)
-        self.application = QtGui.QApplication.instance()
+        self.get_application()
+        self.build_settings()
 
     def tearDown(self):
         """
         Delete all the C++ objects at the end so that we don't have a segfault
         """
-        del self.application
-        os.close(self.fd)
-        os.unlink(Settings().fileName())
+        self.destroy_settings()
 
     def settings_basic_test(self):
         """

=== modified file 'tests/functional/openlp_core_lib/__init__.py'
--- tests/functional/openlp_core_lib/__init__.py	2013-02-16 20:45:15 +0000
+++ tests/functional/openlp_core_lib/__init__.py	2014-03-17 07:34:01 +0000
@@ -0,0 +1,31 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection                                      #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2014 Raoul Snyman                                        #
+# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan      #
+# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub,      #
+# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer.   #
+# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru,          #
+# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith,             #
+# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock,              #
+# Frode Woldsund, Martin Zibricky, Patrick Zimmermann                         #
+# --------------------------------------------------------------------------- #
+# This program is free software; you can redistribute it and/or modify it     #
+# under the terms of the GNU General Public License as published by the Free  #
+# Software Foundation; version 2 of the License.                              #
+#                                                                             #
+# This program is distributed in the hope that it will be useful, but WITHOUT #
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or       #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for    #
+# more details.                                                               #
+#                                                                             #
+# You should have received a copy of the GNU General Public License along     #
+# with this program; if not, write to the Free Software Foundation, Inc., 59  #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA                          #
+###############################################################################
+"""
+Package to test the openlp.core.lib package.
+"""
\ No newline at end of file

=== modified file 'tests/functional/openlp_core_lib/test_file_dialog.py'
--- tests/functional/openlp_core_lib/test_file_dialog.py	2013-11-16 21:04:16 +0000
+++ tests/functional/openlp_core_lib/test_file_dialog.py	2014-03-17 07:34:01 +0000
@@ -7,6 +7,7 @@
 from openlp.core.lib.filedialog import FileDialog
 from tests.functional import MagicMock, patch
 
+
 class TestFileDialog(TestCase):
     """
     Test the functions in the :mod:`filedialog` module.
@@ -46,7 +47,7 @@
     def returned_file_list_test(self):
         """
             Test that FileDialog.getOpenFileNames handles a list of files properly when QFileList.getOpenFileNames
-            returns a good file name, a urlencoded file name and a non-existing file
+            returns a good file name, a url encoded file name and a non-existing file
         """
         self.mocked_os.rest()
         self.mocked_qt_gui.reset()
@@ -62,7 +63,7 @@
         result = FileDialog.getOpenFileNames(self.mocked_parent)
 
         # THEN: os.path.exists should have been called with known args. QmessageBox.information should have been
-        #       called. The returned result should corrilate with the input.
+        #       called. The returned result should correlate with the input.
         self.mocked_os.path.exists.assert_callde_with('/Valid File')
         self.mocked_os.path.exists.assert_callde_with('/url%20encoded%20file%20%231')
         self.mocked_os.path.exists.assert_callde_with('/url encoded file #1')

=== modified file 'tests/functional/openlp_core_lib/test_image_manager.py'
--- tests/functional/openlp_core_lib/test_image_manager.py	2013-12-28 21:33:38 +0000
+++ tests/functional/openlp_core_lib/test_image_manager.py	2014-03-17 07:34:01 +0000
@@ -36,18 +36,19 @@
 
 from openlp.core.common import Registry
 from openlp.core.lib import ImageManager, ScreenList
+from tests.helpers.testmixin import TestMixin
 
 TEST_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', 'resources'))
 
 
-class TestImageManager(TestCase):
+class TestImageManager(TestCase, TestMixin):
 
     def setUp(self):
         """
         Create the UI
         """
         Registry.create()
-        self.app = QtGui.QApplication.instance()
+        self.get_application()
         ScreenList.create(self.app.desktop())
         self.image_manager = ImageManager()
 

=== modified file 'tests/functional/openlp_core_utils/__init__.py'
--- tests/functional/openlp_core_utils/__init__.py	2013-02-19 12:49:21 +0000
+++ tests/functional/openlp_core_utils/__init__.py	2014-03-17 07:34:01 +0000
@@ -0,0 +1,28 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection                                      #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2014 Raoul Snyman                                        #
+# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan      #
+# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub,      #
+# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer.   #
+# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru,          #
+# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith,             #
+# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock,              #
+# Frode Woldsund, Martin Zibricky, Patrick Zimmermann                         #
+# --------------------------------------------------------------------------- #
+# This program is free software; you can redistribute it and/or modify it     #
+# under the terms of the GNU General Public License as published by the Free  #
+# Software Foundation; version 2 of the License.                              #
+#                                                                             #
+# This program is distributed in the hope that it will be useful, but WITHOUT #
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or       #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for    #
+# more details.                                                               #
+#                                                                             #
+# You should have received a copy of the GNU General Public License along     #
+# with this program; if not, write to the Free Software Foundation, Inc., 59  #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA                          #
+###############################################################################
\ No newline at end of file

=== modified file 'tests/functional/openlp_core_utils/test_actions.py'
--- tests/functional/openlp_core_utils/test_actions.py	2014-03-13 20:59:10 +0000
+++ tests/functional/openlp_core_utils/test_actions.py	2014-03-17 07:34:01 +0000
@@ -29,17 +29,16 @@
 """
 Package to test the openlp.core.utils.actions package.
 """
-import os
-from tempfile import mkstemp
 from unittest import TestCase
 
 from PyQt4 import QtGui, QtCore
 
 from openlp.core.common import Settings
 from openlp.core.utils import ActionList
-
-
-class TestActionList(TestCase):
+from tests.helpers.testmixin import TestMixin
+
+
+class TestActionList(TestCase, TestMixin):
     """
     Test the ActionList class
     """
@@ -49,10 +48,8 @@
         Prepare the tests
         """
         self.action_list = ActionList.get_instance()
-        Settings.setDefaultFormat(Settings.IniFormat)
+        self.build_settings()
         self.settings = Settings()
-        self.fd, self.ini_file = mkstemp('.ini')
-        self.settings.set_filename(self.ini_file)
         self.settings.beginGroup('shortcuts')
 
     def tearDown(self):
@@ -60,8 +57,7 @@
         Clean up
         """
         self.settings.endGroup()
-        os.close(self.fd)
-        os.unlink(Settings().fileName())
+        self.destroy_settings()
 
     def test_add_action_same_parent(self):
         """

=== modified file 'tests/functional/openlp_plugins/__init__.py'
--- tests/functional/openlp_plugins/__init__.py	2013-02-19 12:49:21 +0000
+++ tests/functional/openlp_plugins/__init__.py	2014-03-17 07:34:01 +0000
@@ -1,1 +1,28 @@
-__author__ = 'raoul'
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection                                      #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2014 Raoul Snyman                                        #
+# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan      #
+# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub,      #
+# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer.   #
+# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru,          #
+# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith,             #
+# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock,              #
+# Frode Woldsund, Martin Zibricky, Patrick Zimmermann                         #
+# --------------------------------------------------------------------------- #
+# This program is free software; you can redistribute it and/or modify it     #
+# under the terms of the GNU General Public License as published by the Free  #
+# Software Foundation; version 2 of the License.                              #
+#                                                                             #
+# This program is distributed in the hope that it will be useful, but WITHOUT #
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or       #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for    #
+# more details.                                                               #
+#                                                                             #
+# You should have received a copy of the GNU General Public License along     #
+# with this program; if not, write to the Free Software Foundation, Inc., 59  #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA                          #
+###############################################################################

=== modified file 'tests/functional/openlp_plugins/bibles/__init__.py'
--- tests/functional/openlp_plugins/bibles/__init__.py	2014-03-11 20:10:46 +0000
+++ tests/functional/openlp_plugins/bibles/__init__.py	2014-03-17 07:34:01 +0000
@@ -25,4 +25,5 @@
 # You should have received a copy of the GNU General Public License along     #
 # with this program; if not, write to the Free Software Foundation, Inc., 59  #
 # Temple Place, Suite 330, Boston, MA 02111-1307 USA                          #
-###############################################################################
\ No newline at end of file
+###############################################################################
+

=== modified file 'tests/functional/openlp_plugins/bibles/test_http.py'
--- tests/functional/openlp_plugins/bibles/test_http.py	2013-12-24 08:56:50 +0000
+++ tests/functional/openlp_plugins/bibles/test_http.py	2014-03-17 07:34:01 +0000
@@ -63,6 +63,7 @@
 #   get_soup_for_bible_ref
 #   send_error_message
 
+
 class TestBSExtract(TestCase):
     """
     Test the BSExtractClass

=== modified file 'tests/functional/openlp_plugins/bibles/test_versereferencelist.py'
--- tests/functional/openlp_plugins/bibles/test_versereferencelist.py	2014-03-11 20:10:46 +0000
+++ tests/functional/openlp_plugins/bibles/test_versereferencelist.py	2014-03-17 07:34:01 +0000
@@ -49,7 +49,7 @@
         verse = 1
         version = 'testVersion'
         copyright_ = 'testCopyright'
-        permission = 'testPermision'
+        permission = 'testPermission'
 
         # WHEN: We add it to the verse list
         reference_list.add(book, chapter, verse, version, copyright_, permission)
@@ -57,9 +57,11 @@
         # THEN: The entries should be in the first entry of the list
         self.assertEqual(reference_list.current_index, 0, 'The current index should be 0')
         self.assertEqual(reference_list.verse_list[0]['book'], book, 'The book in first entry should be %s' % book)
-        self.assertEqual(reference_list.verse_list[0]['chapter'], chapter, 'The chapter in first entry should be %u' % chapter)
+        self.assertEqual(reference_list.verse_list[0]['chapter'], chapter, 'The chapter in first entry should be %u' %
+                                                                           chapter)
         self.assertEqual(reference_list.verse_list[0]['start'], verse, 'The start in first entry should be %u' % verse)
-        self.assertEqual(reference_list.verse_list[0]['version'], version, 'The version in first entry should be %s' % version)
+        self.assertEqual(reference_list.verse_list[0]['version'], version, 'The version in first entry should be %s' %
+                                                                           version)
         self.assertEqual(reference_list.verse_list[0]['end'], verse, 'The end in first entry should be %u' % verse)
 
     def add_next_verse_test(self):
@@ -73,7 +75,7 @@
         next_verse = 2
         version = 'testVersion'
         copyright_ = 'testCopyright'
-        permission = 'testPermision'
+        permission = 'testPermission'
         reference_list = VerseReferenceList()
         reference_list.add(book, chapter, verse, version, copyright_, permission)
 
@@ -98,7 +100,7 @@
         another_verse = 5
         version = 'testVersion'
         copyright_ = 'testCopyright'
-        permission = 'testPermision'
+        permission = 'testPermission'
         reference_list = VerseReferenceList()
         reference_list.add(book, chapter, verse, version, copyright_, permission)
 
@@ -116,7 +118,7 @@
         reference_list = VerseReferenceList()
         version = 'testVersion'
         copyright_ = 'testCopyright'
-        permission = 'testPermision'
+        permission = 'testPermission'
 
         # WHEN: a not existing version will be added
         reference_list.add_version(version, copyright_, permission)
@@ -135,7 +137,7 @@
         reference_list = VerseReferenceList()
         version = 'testVersion'
         copyright_ = 'testCopyright'
-        permission = 'testPermision'
+        permission = 'testPermission'
         reference_list.add_version(version, copyright_, permission)
 
         # WHEN: an existing version will be added

=== modified file 'tests/functional/openlp_plugins/images/__init__.py'
--- tests/functional/openlp_plugins/images/__init__.py	2013-03-18 22:04:09 +0000
+++ tests/functional/openlp_plugins/images/__init__.py	2014-03-17 07:34:01 +0000
@@ -0,0 +1,28 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection                                      #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2014 Raoul Snyman                                        #
+# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan      #
+# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub,      #
+# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer.   #
+# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru,          #
+# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith,             #
+# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock,              #
+# Frode Woldsund, Martin Zibricky, Patrick Zimmermann                         #
+# --------------------------------------------------------------------------- #
+# This program is free software; you can redistribute it and/or modify it     #
+# under the terms of the GNU General Public License as published by the Free  #
+# Software Foundation; version 2 of the License.                              #
+#                                                                             #
+# This program is distributed in the hope that it will be useful, but WITHOUT #
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or       #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for    #
+# more details.                                                               #
+#                                                                             #
+# You should have received a copy of the GNU General Public License along     #
+# with this program; if not, write to the Free Software Foundation, Inc., 59  #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA                          #
+###############################################################################
\ No newline at end of file

=== modified file 'tests/functional/openlp_plugins/presentations/__init__.py'
--- tests/functional/openlp_plugins/presentations/__init__.py	2013-07-17 14:19:21 +0000
+++ tests/functional/openlp_plugins/presentations/__init__.py	2014-03-17 07:34:01 +0000
@@ -0,0 +1,28 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection                                      #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2014 Raoul Snyman                                        #
+# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan      #
+# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub,      #
+# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer.   #
+# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru,          #
+# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith,             #
+# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock,              #
+# Frode Woldsund, Martin Zibricky, Patrick Zimmermann                         #
+# --------------------------------------------------------------------------- #
+# This program is free software; you can redistribute it and/or modify it     #
+# under the terms of the GNU General Public License as published by the Free  #
+# Software Foundation; version 2 of the License.                              #
+#                                                                             #
+# This program is distributed in the hope that it will be useful, but WITHOUT #
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or       #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for    #
+# more details.                                                               #
+#                                                                             #
+# You should have received a copy of the GNU General Public License along     #
+# with this program; if not, write to the Free Software Foundation, Inc., 59  #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA                          #
+###############################################################################
\ No newline at end of file

=== modified file 'tests/functional/openlp_plugins/presentations/test_mediaitem.py'
--- tests/functional/openlp_plugins/presentations/test_mediaitem.py	2014-03-04 20:18:14 +0000
+++ tests/functional/openlp_plugins/presentations/test_mediaitem.py	2014-03-17 07:34:01 +0000
@@ -31,14 +31,13 @@
 """
 from unittest import TestCase
 
-from PyQt4 import QtGui
-
 from openlp.core.common import Registry
 from openlp.plugins.presentations.lib.mediaitem import PresentationMediaItem
 from tests.functional import patch, MagicMock
-
-
-class TestMediaItem(TestCase):
+from tests.helpers.testmixin import TestMixin
+
+
+class TestMediaItem(TestCase, TestMixin):
     """
     Test the mediaitem methods.
     """
@@ -52,13 +51,7 @@
         with patch('openlp.plugins.presentations.lib.mediaitem.MediaManagerItem._setup'), \
                 patch('openlp.plugins.presentations.lib.mediaitem.PresentationMediaItem.setup_item'):
             self.media_item = PresentationMediaItem(None, MagicMock, MagicMock())
-        self.application = QtGui.QApplication.instance()
-
-    def tearDown(self):
-        """
-        Delete all the C++ objects at the end so that we don't have a segfault
-        """
-        del self.application
+        self.get_application()
 
     def build_file_mask_string_test(self):
         """

=== modified file 'tests/functional/openlp_plugins/presentations/test_pdfcontroller.py'
--- tests/functional/openlp_plugins/presentations/test_pdfcontroller.py	2014-03-13 20:59:10 +0000
+++ tests/functional/openlp_plugins/presentations/test_pdfcontroller.py	2014-03-17 07:34:01 +0000
@@ -32,22 +32,21 @@
 import os
 import shutil
 from unittest import TestCase, SkipTest
-from tempfile import mkstemp, mkdtemp
-
-from PyQt4 import QtGui
+from tempfile import mkdtemp
 
 from openlp.plugins.presentations.lib.pdfcontroller import PdfController, PdfDocument
 from tests.functional import MagicMock
 from openlp.core.common import Settings
 from openlp.core.lib import ScreenList
 from tests.utils.constants import TEST_RESOURCES_PATH
+from tests.helpers.testmixin import TestMixin
 
 __default_settings__ = {
     'presentations/enable_pdf_program': False
 }
 
 
-class TestPdfController(TestCase):
+class TestPdfController(TestCase, TestMixin):
     """
     Test the PdfController.
     """
@@ -55,11 +54,9 @@
         """
         Set up the components need for all tests.
         """
-        Settings.setDefaultFormat(Settings.IniFormat)
-        self.fd, self.ini_file = mkstemp('.ini')
-        Settings().set_filename(self.ini_file)
-        self.application = QtGui.QApplication.instance()
-        ScreenList.create(self.application.desktop())
+        self.get_application()
+        self.build_settings()
+        ScreenList.create(self.app.desktop())
         Settings().extend_default_settings(__default_settings__)
         self.temp_folder = mkdtemp()
         self.thumbnail_folder = mkdtemp()
@@ -70,10 +67,8 @@
         """
         Delete all the C++ objects at the end so that we don't have a segfault
         """
-        del self.application
         try:
-            os.close(self.fd)
-            os.unlink(Settings().fileName())
+            self.destroy_settings()
             shutil.rmtree(self.thumbnail_folder)
             shutil.rmtree(self.temp_folder)
         except OSError:

=== modified file 'tests/functional/openlp_plugins/remotes/__init__.py'
--- tests/functional/openlp_plugins/remotes/__init__.py	2013-03-29 20:58:06 +0000
+++ tests/functional/openlp_plugins/remotes/__init__.py	2014-03-17 07:34:01 +0000
@@ -0,0 +1,28 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection                                      #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2014 Raoul Snyman                                        #
+# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan      #
+# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub,      #
+# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer.   #
+# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru,          #
+# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith,             #
+# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock,              #
+# Frode Woldsund, Martin Zibricky, Patrick Zimmermann                         #
+# --------------------------------------------------------------------------- #
+# This program is free software; you can redistribute it and/or modify it     #
+# under the terms of the GNU General Public License as published by the Free  #
+# Software Foundation; version 2 of the License.                              #
+#                                                                             #
+# This program is distributed in the hope that it will be useful, but WITHOUT #
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or       #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for    #
+# more details.                                                               #
+#                                                                             #
+# You should have received a copy of the GNU General Public License along     #
+# with this program; if not, write to the Free Software Foundation, Inc., 59  #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA                          #
+###############################################################################
\ No newline at end of file

=== modified file 'tests/functional/openlp_plugins/remotes/test_remotetab.py'
--- tests/functional/openlp_plugins/remotes/test_remotetab.py	2014-03-12 05:31:19 +0000
+++ tests/functional/openlp_plugins/remotes/test_remotetab.py	2014-03-17 07:34:01 +0000
@@ -32,13 +32,13 @@
 import os
 import re
 from unittest import TestCase
-from tempfile import mkstemp
 
 from PyQt4 import QtGui
 
 from openlp.core.common import Settings
 from openlp.plugins.remotes.lib.remotetab import RemoteTab
 from tests.functional import patch
+from tests.helpers.testmixin import TestMixin
 
 __default_settings__ = {
     'remotes/twelve hour': True,
@@ -54,7 +54,7 @@
 TEST_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', 'resources'))
 
 
-class TestRemoteTab(TestCase):
+class TestRemoteTab(TestCase, TestMixin):
     """
     Test the functions in the :mod:`lib` module.
     """
@@ -62,10 +62,8 @@
         """
         Create the UI
         """
-        Settings.setDefaultFormat(Settings.IniFormat)
-        self.fd, self.ini_file = mkstemp('.ini')
-        Settings().set_filename(self.ini_file)
-        self.application = QtGui.QApplication.instance()
+        self.get_application()
+        self.build_settings()
         Settings().extend_default_settings(__default_settings__)
         self.parent = QtGui.QMainWindow()
         self.form = RemoteTab(self.parent, 'Remotes', None, None)
@@ -74,11 +72,9 @@
         """
         Delete all the C++ objects at the end so that we don't have a segfault
         """
-        del self.application
         del self.parent
         del self.form
-        os.close(self.fd)
-        os.unlink(Settings().fileName())
+        self.destroy_settings()
 
     def get_ip_address_default_test(self):
         """

=== modified file 'tests/functional/openlp_plugins/remotes/test_router.py'
--- tests/functional/openlp_plugins/remotes/test_router.py	2014-03-12 05:31:19 +0000
+++ tests/functional/openlp_plugins/remotes/test_router.py	2014-03-17 07:34:01 +0000
@@ -31,13 +31,11 @@
 """
 import os
 from unittest import TestCase
-from tempfile import mkstemp
-
-from PyQt4 import QtGui
 
 from openlp.core.common import Settings
 from openlp.plugins.remotes.lib.httpserver import HttpRouter
 from tests.functional import MagicMock, patch, mock_open
+from tests.helpers.testmixin import TestMixin
 
 __default_settings__ = {
     'remotes/twelve hour': True,
@@ -53,7 +51,7 @@
 TEST_PATH = os.path.abspath(os.path.dirname(__file__))
 
 
-class TestRouter(TestCase):
+class TestRouter(TestCase, TestMixin):
     """
     Test the functions in the :mod:`lib` module.
     """
@@ -61,10 +59,8 @@
         """
         Create the UI
         """
-        Settings.setDefaultFormat(Settings.IniFormat)
-        self.fd, self.ini_file = mkstemp('.ini')
-        Settings().set_filename(self.ini_file)
-        self.application = QtGui.QApplication.instance()
+        self.get_application()
+        self.build_settings()
         Settings().extend_default_settings(__default_settings__)
         self.router = HttpRouter()
 
@@ -72,9 +68,7 @@
         """
         Delete all the C++ objects at the end so that we don't have a segfault
         """
-        del self.application
-        os.close(self.fd)
-        os.unlink(Settings().fileName())
+        self.destroy_settings()
 
     def password_encrypter_test(self):
         """

=== modified file 'tests/functional/openlp_plugins/songs/__init__.py'
--- tests/functional/openlp_plugins/songs/__init__.py	2013-08-15 19:49:51 +0000
+++ tests/functional/openlp_plugins/songs/__init__.py	2014-03-17 07:34:01 +0000
@@ -1,3 +1,31 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection                                      #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2014 Raoul Snyman                                        #
+# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan      #
+# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub,      #
+# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer.   #
+# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru,          #
+# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith,             #
+# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock,              #
+# Frode Woldsund, Martin Zibricky, Patrick Zimmermann                         #
+# --------------------------------------------------------------------------- #
+# This program is free software; you can redistribute it and/or modify it     #
+# under the terms of the GNU General Public License as published by the Free  #
+# Software Foundation; version 2 of the License.                              #
+#                                                                             #
+# This program is distributed in the hope that it will be useful, but WITHOUT #
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or       #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for    #
+# more details.                                                               #
+#                                                                             #
+# You should have received a copy of the GNU General Public License along     #
+# with this program; if not, write to the Free Software Foundation, Inc., 59  #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA                          #
+###############################################################################
 """
 Tests for the Songs plugin
 """

=== modified file 'tests/functional/openlp_plugins/songs/test_mediaitem.py'
--- tests/functional/openlp_plugins/songs/test_mediaitem.py	2014-03-13 20:59:10 +0000
+++ tests/functional/openlp_plugins/songs/test_mediaitem.py	2014-03-17 07:34:01 +0000
@@ -11,9 +11,10 @@
 from openlp.core.lib import ServiceItem
 from openlp.plugins.songs.lib.mediaitem import SongMediaItem
 from tests.functional import patch, MagicMock
-
-
-class TestMediaItem(TestCase):
+from tests.helpers.testmixin import TestMixin
+
+
+class TestMediaItem(TestCase, TestMixin):
     """
     Test the functions in the :mod:`lib` module.
     """
@@ -27,24 +28,15 @@
         with patch('openlp.core.lib.mediamanageritem.MediaManagerItem._setup'), \
                 patch('openlp.plugins.songs.forms.editsongform.EditSongForm.__init__'):
             self.media_item = SongMediaItem(None, MagicMock())
-
-        Settings.setDefaultFormat(Settings.IniFormat)
-        self.fd, self.ini_file = mkstemp('.ini')
-        Settings().set_filename(self.ini_file)
-        self.application = QtGui.QApplication.instance()
+        self.get_application()
+        self.build_settings()
         QtCore.QLocale.setDefault(QtCore.QLocale('en_GB'))
 
     def tearDown(self):
         """
         Delete all the C++ objects at the end so that we don't have a segfault
         """
-        del self.application
-        # Not all tests use settings!
-        try:
-            os.close(self.fd)
-            os.unlink(Settings().fileName())
-        except Exception:
-            pass
+        self.destroy_settings()
 
     def build_song_footer_one_author_test(self):
         """

=== modified file 'tests/helpers/testmixin.py'
--- tests/helpers/testmixin.py	2014-03-14 17:38:57 +0000
+++ tests/helpers/testmixin.py	2014-03-17 07:34:01 +0000
@@ -39,6 +39,9 @@
 class TestMixin(object):
 
     def get_application(self):
+        """
+        Build or reuse the Application object
+        """
         old_app_instance = QtCore.QCoreApplication.instance()
         if old_app_instance is None:
             self.app = QtGui.QApplication([])
@@ -46,11 +49,17 @@
             self.app = old_app_instance
 
     def build_settings(self):
+        """
+        Build the settings Object and initialise it
+        """
         Settings.setDefaultFormat(Settings.IniFormat)
         fd, self.ini_file = mkstemp('.ini')
         Settings().set_filename(self.ini_file)
 
     def destroy_settings(self):
+        """
+        Destroy the Settings Object
+        """
         if hasattr(self, 'fd'):
             os.close(self.fd)
         os.unlink(Settings().fileName())

=== modified file 'tests/interfaces/__init__.py'
--- tests/interfaces/__init__.py	2013-10-04 21:45:38 +0000
+++ tests/interfaces/__init__.py	2014-03-17 07:34:01 +0000
@@ -1,4 +1,31 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
 
+###############################################################################
+# OpenLP - Open Source Lyrics Projection                                      #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2014 Raoul Snyman                                        #
+# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan      #
+# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub,      #
+# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer.   #
+# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru,          #
+# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith,             #
+# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock,              #
+# Frode Woldsund, Martin Zibricky, Patrick Zimmermann                         #
+# --------------------------------------------------------------------------- #
+# This program is free software; you can redistribute it and/or modify it     #
+# under the terms of the GNU General Public License as published by the Free  #
+# Software Foundation; version 2 of the License.                              #
+#                                                                             #
+# This program is distributed in the hope that it will be useful, but WITHOUT #
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or       #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for    #
+# more details.                                                               #
+#                                                                             #
+# You should have received a copy of the GNU General Public License along     #
+# with this program; if not, write to the Free Software Foundation, Inc., 59  #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA                          #
+###############################################################################
 import sip
 sip.setapi('QDate', 2)
 sip.setapi('QDateTime', 2)

=== modified file 'tests/interfaces/openlp_core_lib/__init__.py'
--- tests/interfaces/openlp_core_lib/__init__.py	2013-02-11 21:16:30 +0000
+++ tests/interfaces/openlp_core_lib/__init__.py	2014-03-17 07:34:01 +0000
@@ -0,0 +1,28 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection                                      #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2014 Raoul Snyman                                        #
+# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan      #
+# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub,      #
+# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer.   #
+# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru,          #
+# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith,             #
+# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock,              #
+# Frode Woldsund, Martin Zibricky, Patrick Zimmermann                         #
+# --------------------------------------------------------------------------- #
+# This program is free software; you can redistribute it and/or modify it     #
+# under the terms of the GNU General Public License as published by the Free  #
+# Software Foundation; version 2 of the License.                              #
+#                                                                             #
+# This program is distributed in the hope that it will be useful, but WITHOUT #
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or       #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for    #
+# more details.                                                               #
+#                                                                             #
+# You should have received a copy of the GNU General Public License along     #
+# with this program; if not, write to the Free Software Foundation, Inc., 59  #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA                          #
+###############################################################################
\ No newline at end of file

=== modified file 'tests/interfaces/openlp_core_lib/test_pluginmanager.py'
--- tests/interfaces/openlp_core_lib/test_pluginmanager.py	2014-03-13 21:16:38 +0000
+++ tests/interfaces/openlp_core_lib/test_pluginmanager.py	2014-03-17 07:34:01 +0000
@@ -1,20 +1,48 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection                                      #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2014 Raoul Snyman                                        #
+# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan      #
+# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub,      #
+# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer.   #
+# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru,          #
+# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith,             #
+# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock,              #
+# Frode Woldsund, Martin Zibricky, Patrick Zimmermann                         #
+# --------------------------------------------------------------------------- #
+# This program is free software; you can redistribute it and/or modify it     #
+# under the terms of the GNU General Public License as published by the Free  #
+# Software Foundation; version 2 of the License.                              #
+#                                                                             #
+# This program is distributed in the hope that it will be useful, but WITHOUT #
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or       #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for    #
+# more details.                                                               #
+#                                                                             #
+# You should have received a copy of the GNU General Public License along     #
+# with this program; if not, write to the Free Software Foundation, Inc., 59  #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA                          #
+###############################################################################
 """
 Package to test the openlp.core.lib.pluginmanager package.
 """
-import os
 import sys
 import shutil
-from tempfile import mkstemp, mkdtemp
+from tempfile import mkdtemp
 from unittest import TestCase
 
-from PyQt4 import QtGui, QtCore
+from PyQt4 import QtGui
 
 from openlp.core.common import Registry, Settings
 from openlp.core.lib.pluginmanager import PluginManager
 from tests.interfaces import MagicMock
-
-
-class TestPluginManager(TestCase):
+from tests.helpers.testmixin import TestMixin
+
+
+class TestPluginManager(TestCase, TestMixin):
     """
     Test the PluginManager class
     """
@@ -24,25 +52,19 @@
         Some pre-test setup required.
         """
         Settings.setDefaultFormat(Settings.IniFormat)
-        self.fd, self.ini_file = mkstemp('.ini')
+        self.build_settings()
         self.temp_dir = mkdtemp('openlp')
-        Settings().set_filename(self.ini_file)
         Settings().setValue('advanced/data path', self.temp_dir)
         Registry.create()
         Registry().register('service_list', MagicMock())
-        old_app_instance = QtCore.QCoreApplication.instance()
-        if old_app_instance is None:
-            self.app = QtGui.QApplication([])
-        else:
-            self.app = old_app_instance
+        self.get_application()
         self.main_window = QtGui.QMainWindow()
         Registry().register('main_window', self.main_window)
 
     def tearDown(self):
         del self.main_window
-        os.close(self.fd)
-        os.unlink(Settings().fileName())
         Settings().remove('advanced/data path')
+        self.destroy_settings()
         shutil.rmtree(self.temp_dir)
 
     def find_plugins_test(self):

=== modified file 'tests/interfaces/openlp_core_ui/__init__.py'
--- tests/interfaces/openlp_core_ui/__init__.py	2013-02-14 17:34:41 +0000
+++ tests/interfaces/openlp_core_ui/__init__.py	2014-03-17 07:34:01 +0000
@@ -1,1 +1,28 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
 
+###############################################################################
+# OpenLP - Open Source Lyrics Projection                                      #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2014 Raoul Snyman                                        #
+# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan      #
+# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub,      #
+# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer.   #
+# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru,          #
+# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith,             #
+# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock,              #
+# Frode Woldsund, Martin Zibricky, Patrick Zimmermann                         #
+# --------------------------------------------------------------------------- #
+# This program is free software; you can redistribute it and/or modify it     #
+# under the terms of the GNU General Public License as published by the Free  #
+# Software Foundation; version 2 of the License.                              #
+#                                                                             #
+# This program is distributed in the hope that it will be useful, but WITHOUT #
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or       #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for    #
+# more details.                                                               #
+#                                                                             #
+# You should have received a copy of the GNU General Public License along     #
+# with this program; if not, write to the Free Software Foundation, Inc., 59  #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA                          #
+###############################################################################

=== modified file 'tests/interfaces/openlp_core_ui/test_filerenamedialog.py'
--- tests/interfaces/openlp_core_ui/test_filerenamedialog.py	2014-03-14 20:06:24 +0000
+++ tests/interfaces/openlp_core_ui/test_filerenamedialog.py	2014-03-17 07:34:01 +0000
@@ -31,7 +31,7 @@
 """
 from unittest import TestCase
 
-from PyQt4 import QtCore, QtGui, QtTest
+from PyQt4 import QtGui, QtTest
 
 from openlp.core.common import Registry
 from openlp.core.ui import filerenameform

=== modified file 'tests/interfaces/openlp_core_ui/test_listpreviewwidget.py'
--- tests/interfaces/openlp_core_ui/test_listpreviewwidget.py	2014-03-10 19:56:36 +0000
+++ tests/interfaces/openlp_core_ui/test_listpreviewwidget.py	2014-03-17 07:34:01 +0000
@@ -1,30 +1,55 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection                                      #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2014 Raoul Snyman                                        #
+# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan      #
+# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub,      #
+# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer.   #
+# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru,          #
+# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith,             #
+# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock,              #
+# Frode Woldsund, Martin Zibricky, Patrick Zimmermann                         #
+# --------------------------------------------------------------------------- #
+# This program is free software; you can redistribute it and/or modify it     #
+# under the terms of the GNU General Public License as published by the Free  #
+# Software Foundation; version 2 of the License.                              #
+#                                                                             #
+# This program is distributed in the hope that it will be useful, but WITHOUT #
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or       #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for    #
+# more details.                                                               #
+#                                                                             #
+# You should have received a copy of the GNU General Public License along     #
+# with this program; if not, write to the Free Software Foundation, Inc., 59  #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA                          #
+###############################################################################
 """
     Package to test the openlp.core.ui.listpreviewwidget.
 """
 
 from unittest import TestCase
 
-from PyQt4 import QtGui, QtCore
+from PyQt4 import QtGui
 
 from openlp.core.common import Registry
 from openlp.core.lib import ServiceItem
 from openlp.core.ui import listpreviewwidget
 from tests.interfaces import MagicMock, patch
 from tests.utils.osdinteraction import read_service_from_file
-
-
-class TestListPreviewWidget(TestCase):
+from tests.helpers.testmixin import TestMixin
+
+
+class TestListPreviewWidget(TestCase, TestMixin):
 
     def setUp(self):
         """
         Create the UI.
         """
         Registry.create()
-        old_app_instance = QtCore.QCoreApplication.instance()
-        if old_app_instance is None:
-            self.app = QtGui.QApplication([])
-        else:
-            self.app = old_app_instance
+        self.get_application()
         self.main_window = QtGui.QMainWindow()
         self.image = QtGui.QImage(1, 1, QtGui.QImage.Format_RGB32)
         self.image_manager = MagicMock()

=== modified file 'tests/interfaces/openlp_core_ui/test_mainwindow.py'
--- tests/interfaces/openlp_core_ui/test_mainwindow.py	2014-03-10 19:56:36 +0000
+++ tests/interfaces/openlp_core_ui/test_mainwindow.py	2014-03-17 07:34:01 +0000
@@ -1,16 +1,44 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection                                      #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2014 Raoul Snyman                                        #
+# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan      #
+# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub,      #
+# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer.   #
+# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru,          #
+# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith,             #
+# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock,              #
+# Frode Woldsund, Martin Zibricky, Patrick Zimmermann                         #
+# --------------------------------------------------------------------------- #
+# This program is free software; you can redistribute it and/or modify it     #
+# under the terms of the GNU General Public License as published by the Free  #
+# Software Foundation; version 2 of the License.                              #
+#                                                                             #
+# This program is distributed in the hope that it will be useful, but WITHOUT #
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or       #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for    #
+# more details.                                                               #
+#                                                                             #
+# You should have received a copy of the GNU General Public License along     #
+# with this program; if not, write to the Free Software Foundation, Inc., 59  #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA                          #
+###############################################################################
 """
 Package to test the openlp.core.ui.mainwindow package.
 """
 from unittest import TestCase
 
-from PyQt4 import QtGui, QtCore
 
 from openlp.core.common import Registry
 from openlp.core.ui.mainwindow import MainWindow
 from tests.interfaces import MagicMock, patch
-
-
-class TestMainWindow(TestCase):
+from tests.helpers.testmixin import TestMixin
+
+
+class TestMainWindow(TestCase, TestMixin):
 
     def setUp(self):
         """
@@ -18,11 +46,7 @@
         """
         Registry.create()
         self.registry = Registry()
-        old_app_instance = QtCore.QCoreApplication.instance()
-        if old_app_instance is None:
-            self.app = QtGui.QApplication([])
-        else:
-            self.app = old_app_instance
+        self.get_application()
         # Mock cursor busy/normal methods.
         self.app.set_busy_cursor = MagicMock()
         self.app.set_normal_cursor = MagicMock()

=== modified file 'tests/interfaces/openlp_core_ui/test_servicemanager.py'
--- tests/interfaces/openlp_core_ui/test_servicemanager.py	2014-03-13 20:59:10 +0000
+++ tests/interfaces/openlp_core_ui/test_servicemanager.py	2014-03-17 07:34:01 +0000
@@ -1,29 +1,52 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection                                      #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2014 Raoul Snyman                                        #
+# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan      #
+# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub,      #
+# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer.   #
+# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru,          #
+# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith,             #
+# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock,              #
+# Frode Woldsund, Martin Zibricky, Patrick Zimmermann                         #
+# --------------------------------------------------------------------------- #
+# This program is free software; you can redistribute it and/or modify it     #
+# under the terms of the GNU General Public License as published by the Free  #
+# Software Foundation; version 2 of the License.                              #
+#                                                                             #
+# This program is distributed in the hope that it will be useful, but WITHOUT #
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or       #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for    #
+# more details.                                                               #
+#                                                                             #
+# You should have received a copy of the GNU General Public License along     #
+# with this program; if not, write to the Free Software Foundation, Inc., 59  #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA                          #
+###############################################################################
 """
     Package to test the openlp.core.lib package.
 """
 
 from unittest import TestCase
 
-from PyQt4 import QtGui, QtTest, QtCore
-
 from openlp.core.common import Registry
 from openlp.core.lib import ScreenList, ServiceItem, ItemCapabilities
 from openlp.core.ui.mainwindow import MainWindow
 from tests.interfaces import MagicMock, patch
-
-
-class TestServiceManager(TestCase):
+from tests.helpers.testmixin import TestMixin
+
+
+class TestServiceManager(TestCase, TestMixin):
 
     def setUp(self):
         """
         Create the UI
         """
         Registry.create()
-        old_app_instance = QtCore.QCoreApplication.instance()
-        if old_app_instance is None:
-            self.app = QtGui.QApplication([])
-        else:
-            self.app = old_app_instance
+        self.get_application()
         ScreenList.create(self.app.desktop())
         Registry().register('application', MagicMock())
         with patch('openlp.core.lib.PluginManager'):

=== modified file 'tests/interfaces/openlp_core_ui/test_servicenotedialog.py'
--- tests/interfaces/openlp_core_ui/test_servicenotedialog.py	2014-03-14 20:06:24 +0000
+++ tests/interfaces/openlp_core_ui/test_servicenotedialog.py	2014-03-17 07:34:01 +0000
@@ -36,20 +36,17 @@
 from openlp.core.common import Registry
 from openlp.core.ui import servicenoteform
 from tests.interfaces import patch
-
-
-class TestStartNoteDialog(TestCase):
+from tests.helpers.testmixin import TestMixin
+
+
+class TestStartNoteDialog(TestCase, TestMixin):
 
     def setUp(self):
         """
         Create the UI
         """
         Registry.create()
-        old_app_instance = QtCore.QCoreApplication.instance()
-        if old_app_instance is None:
-            self.app = QtGui.QApplication([])
-        else:
-            self.app = old_app_instance
+        self.get_application()
         self.main_window = QtGui.QMainWindow()
         Registry().register('main_window', self.main_window)
         self.form = servicenoteform.ServiceNoteForm()

=== modified file 'tests/interfaces/openlp_core_ui/test_settings_form.py'
--- tests/interfaces/openlp_core_ui/test_settings_form.py	2014-03-14 20:06:24 +0000
+++ tests/interfaces/openlp_core_ui/test_settings_form.py	2014-03-17 07:34:01 +0000
@@ -31,13 +31,13 @@
 """
 from unittest import TestCase
 
-from PyQt4 import QtCore, QtTest, QtGui
+from PyQt4 import QtCore, QtTest
 
 from openlp.core.common import Registry
 from openlp.core.ui import settingsform
 from openlp.core.lib import ScreenList
 from tests.interfaces import MagicMock, patch
-
+from tests.helpers.testmixin import TestMixin
 
 SCREEN = {
     'primary': False,
@@ -46,7 +46,7 @@
 }
 
 
-class TestSettingsForm(TestCase):
+class TestSettingsForm(TestCase, TestMixin):
     """
     Test the PluginManager class
     """
@@ -59,11 +59,7 @@
         self.dummy2 = MagicMock()
         self.dummy3 = MagicMock()
         self.desktop = MagicMock()
-        old_app_instance = QtCore.QCoreApplication.instance()
-        if old_app_instance is None:
-            self.app = QtGui.QApplication([])
-        else:
-            self.app = old_app_instance
+        self.get_application()
         self.desktop.primaryScreen.return_value = SCREEN['primary']
         self.desktop.screenCount.return_value = SCREEN['number']
         self.desktop.screenGeometry.return_value = SCREEN['size']

=== modified file 'tests/interfaces/openlp_core_ui/test_starttimedialog.py'
--- tests/interfaces/openlp_core_ui/test_starttimedialog.py	2014-03-10 19:56:36 +0000
+++ tests/interfaces/openlp_core_ui/test_starttimedialog.py	2014-03-17 07:34:01 +0000
@@ -1,3 +1,31 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection                                      #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2014 Raoul Snyman                                        #
+# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan      #
+# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub,      #
+# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer.   #
+# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru,          #
+# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith,             #
+# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock,              #
+# Frode Woldsund, Martin Zibricky, Patrick Zimmermann                         #
+# --------------------------------------------------------------------------- #
+# This program is free software; you can redistribute it and/or modify it     #
+# under the terms of the GNU General Public License as published by the Free  #
+# Software Foundation; version 2 of the License.                              #
+#                                                                             #
+# This program is distributed in the hope that it will be useful, but WITHOUT #
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or       #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for    #
+# more details.                                                               #
+#                                                                             #
+# You should have received a copy of the GNU General Public License along     #
+# with this program; if not, write to the Free Software Foundation, Inc., 59  #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA                          #
+###############################################################################
 """
 Package to test the openlp.core.ui package.
 """
@@ -8,20 +36,17 @@
 from openlp.core.common import Registry
 from openlp.core.ui import starttimeform
 from tests.interfaces import MagicMock, patch
-
-
-class TestStartTimeDialog(TestCase):
+from tests.helpers.testmixin import TestMixin
+
+
+class TestStartTimeDialog(TestCase, TestMixin):
 
     def setUp(self):
         """
         Create the UI
         """
         Registry.create()
-        old_app_instance = QtCore.QCoreApplication.instance()
-        if old_app_instance is None:
-            self.app = QtGui.QApplication([])
-        else:
-            self.app = old_app_instance
+        self.get_application()
         self.main_window = QtGui.QMainWindow()
         Registry().register('main_window', self.main_window)
         self.form = starttimeform.StartTimeForm()

=== modified file 'tests/interfaces/openlp_core_utils/__init__.py'
--- tests/interfaces/openlp_core_utils/__init__.py	2013-07-13 16:33:32 +0000
+++ tests/interfaces/openlp_core_utils/__init__.py	2014-03-17 07:34:01 +0000
@@ -0,0 +1,28 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection                                      #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2014 Raoul Snyman                                        #
+# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan      #
+# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub,      #
+# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer.   #
+# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru,          #
+# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith,             #
+# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock,              #
+# Frode Woldsund, Martin Zibricky, Patrick Zimmermann                         #
+# --------------------------------------------------------------------------- #
+# This program is free software; you can redistribute it and/or modify it     #
+# under the terms of the GNU General Public License as published by the Free  #
+# Software Foundation; version 2 of the License.                              #
+#                                                                             #
+# This program is distributed in the hope that it will be useful, but WITHOUT #
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or       #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for    #
+# more details.                                                               #
+#                                                                             #
+# You should have received a copy of the GNU General Public License along     #
+# with this program; if not, write to the Free Software Foundation, Inc., 59  #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA                          #
+###############################################################################
\ No newline at end of file

=== modified file 'tests/interfaces/openlp_core_utils/test_utils.py'
--- tests/interfaces/openlp_core_utils/test_utils.py	2014-03-13 20:59:10 +0000
+++ tests/interfaces/openlp_core_utils/test_utils.py	2014-03-17 07:34:01 +0000
@@ -1,15 +1,43 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection                                      #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2014 Raoul Snyman                                        #
+# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan      #
+# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub,      #
+# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer.   #
+# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru,          #
+# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith,             #
+# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock,              #
+# Frode Woldsund, Martin Zibricky, Patrick Zimmermann                         #
+# --------------------------------------------------------------------------- #
+# This program is free software; you can redistribute it and/or modify it     #
+# under the terms of the GNU General Public License as published by the Free  #
+# Software Foundation; version 2 of the License.                              #
+#                                                                             #
+# This program is distributed in the hope that it will be useful, but WITHOUT #
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or       #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for    #
+# more details.                                                               #
+#                                                                             #
+# You should have received a copy of the GNU General Public License along     #
+# with this program; if not, write to the Free Software Foundation, Inc., 59  #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA                          #
+###############################################################################
 """
 Functional tests to test the AppLocation class and related methods.
 """
 import os
 from unittest import TestCase
-from PyQt4 import QtCore, QtGui
 
 from openlp.core.utils import is_not_image_file
 from tests.utils.constants import TEST_RESOURCES_PATH
-
-
-class TestUtils(TestCase):
+from tests.helpers.testmixin import TestMixin
+
+
+class TestUtils(TestCase, TestMixin):
     """
     A test suite to test out various methods around the Utils functions.
     """
@@ -18,11 +46,7 @@
         """
         Some pre-test setup required.
         """
-        old_app_instance = QtCore.QCoreApplication.instance()
-        if old_app_instance is None:
-            self.app = QtGui.QApplication([])
-        else:
-            self.app = old_app_instance
+        self.get_application()
 
     def is_not_image_empty_test(self):
         """

=== modified file 'tests/interfaces/openlp_plugins/__init__.py'
--- tests/interfaces/openlp_plugins/__init__.py	2013-03-29 06:25:01 +0000
+++ tests/interfaces/openlp_plugins/__init__.py	2014-03-17 07:34:01 +0000
@@ -0,0 +1,28 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection                                      #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2014 Raoul Snyman                                        #
+# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan      #
+# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub,      #
+# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer.   #
+# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru,          #
+# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith,             #
+# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock,              #
+# Frode Woldsund, Martin Zibricky, Patrick Zimmermann                         #
+# --------------------------------------------------------------------------- #
+# This program is free software; you can redistribute it and/or modify it     #
+# under the terms of the GNU General Public License as published by the Free  #
+# Software Foundation; version 2 of the License.                              #
+#                                                                             #
+# This program is distributed in the hope that it will be useful, but WITHOUT #
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or       #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for    #
+# more details.                                                               #
+#                                                                             #
+# You should have received a copy of the GNU General Public License along     #
+# with this program; if not, write to the Free Software Foundation, Inc., 59  #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA                          #
+###############################################################################
\ No newline at end of file

=== modified file 'tests/interfaces/openlp_plugins/custom/forms/__init__.py'
--- tests/interfaces/openlp_plugins/custom/forms/__init__.py	2013-03-29 06:25:01 +0000
+++ tests/interfaces/openlp_plugins/custom/forms/__init__.py	2014-03-17 07:34:01 +0000
@@ -0,0 +1,28 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection                                      #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2014 Raoul Snyman                                        #
+# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan      #
+# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub,      #
+# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer.   #
+# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru,          #
+# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith,             #
+# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock,              #
+# Frode Woldsund, Martin Zibricky, Patrick Zimmermann                         #
+# --------------------------------------------------------------------------- #
+# This program is free software; you can redistribute it and/or modify it     #
+# under the terms of the GNU General Public License as published by the Free  #
+# Software Foundation; version 2 of the License.                              #
+#                                                                             #
+# This program is distributed in the hope that it will be useful, but WITHOUT #
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or       #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for    #
+# more details.                                                               #
+#                                                                             #
+# You should have received a copy of the GNU General Public License along     #
+# with this program; if not, write to the Free Software Foundation, Inc., 59  #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA                          #
+###############################################################################
\ No newline at end of file

=== modified file 'tests/interfaces/openlp_plugins/custom/forms/test_customform.py'
--- tests/interfaces/openlp_plugins/custom/forms/test_customform.py	2014-03-14 17:34:36 +0000
+++ tests/interfaces/openlp_plugins/custom/forms/test_customform.py	2014-03-17 07:34:01 +0000
@@ -38,9 +38,10 @@
 from openlp.plugins.custom.lib.mediaitem import CustomMediaItem
 from openlp.plugins.custom.forms.editcustomform import EditCustomForm
 from tests.interfaces import MagicMock, patch
-
-
-class TestEditCustomForm(TestCase):
+from tests.helpers.testmixin import TestMixin
+
+
+class TestEditCustomForm(TestCase, TestMixin):
     """
     Test the EditCustomForm.
     """
@@ -49,11 +50,7 @@
         Create the UI
         """
         Registry.create()
-        old_app_instance = QtCore.QCoreApplication.instance()
-        if old_app_instance is None:
-            self.app = QtGui.QApplication([])
-        else:
-            self.app = old_app_instance
+        self.get_application()
         self.main_window = QtGui.QMainWindow()
         Registry().register('main_window', self.main_window)
         media_item = MagicMock()

=== modified file 'tests/interfaces/openlp_plugins/custom/forms/test_customslideform.py'
--- tests/interfaces/openlp_plugins/custom/forms/test_customslideform.py	2014-03-10 19:56:36 +0000
+++ tests/interfaces/openlp_plugins/custom/forms/test_customslideform.py	2014-03-17 07:34:01 +0000
@@ -1,16 +1,45 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection                                      #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2014 Raoul Snyman                                        #
+# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan      #
+# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub,      #
+# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer.   #
+# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru,          #
+# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith,             #
+# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock,              #
+# Frode Woldsund, Martin Zibricky, Patrick Zimmermann                         #
+# --------------------------------------------------------------------------- #
+# This program is free software; you can redistribute it and/or modify it     #
+# under the terms of the GNU General Public License as published by the Free  #
+# Software Foundation; version 2 of the License.                              #
+#                                                                             #
+# This program is distributed in the hope that it will be useful, but WITHOUT #
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or       #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for    #
+# more details.                                                               #
+#                                                                             #
+# You should have received a copy of the GNU General Public License along     #
+# with this program; if not, write to the Free Software Foundation, Inc., 59  #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA                          #
+###############################################################################
 """
 Module to test the EditCustomSlideForm.
 """
 from unittest import TestCase
 
-from PyQt4 import QtGui, QtCore
+from PyQt4 import QtGui
 
 from openlp.core.common import Registry
 from openlp.plugins.custom.forms.editcustomslideform import EditCustomSlideForm
 from tests.interfaces import MagicMock, patch
-
-
-class TestEditCustomSlideForm(TestCase):
+from tests.helpers.testmixin import TestMixin
+
+
+class TestEditCustomSlideForm(TestCase, TestMixin):
     """
     Test the EditCustomSlideForm.
     """
@@ -19,11 +48,7 @@
         Create the UI
         """
         Registry.create()
-        old_app_instance = QtCore.QCoreApplication.instance()
-        if old_app_instance is None:
-            self.app = QtGui.QApplication([])
-        else:
-            self.app = old_app_instance
+        self.get_application()
         self.main_window = QtGui.QMainWindow()
         Registry().register('main_window', self.main_window)
         self.form = EditCustomSlideForm()

=== modified file 'tests/interfaces/openlp_plugins/remotes/__init__.py'
--- tests/interfaces/openlp_plugins/remotes/__init__.py	2013-03-29 08:25:33 +0000
+++ tests/interfaces/openlp_plugins/remotes/__init__.py	2014-03-17 07:34:01 +0000
@@ -0,0 +1,28 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection                                      #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2014 Raoul Snyman                                        #
+# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan      #
+# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub,      #
+# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer.   #
+# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru,          #
+# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith,             #
+# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock,              #
+# Frode Woldsund, Martin Zibricky, Patrick Zimmermann                         #
+# --------------------------------------------------------------------------- #
+# This program is free software; you can redistribute it and/or modify it     #
+# under the terms of the GNU General Public License as published by the Free  #
+# Software Foundation; version 2 of the License.                              #
+#                                                                             #
+# This program is distributed in the hope that it will be useful, but WITHOUT #
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or       #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for    #
+# more details.                                                               #
+#                                                                             #
+# You should have received a copy of the GNU General Public License along     #
+# with this program; if not, write to the Free Software Foundation, Inc., 59  #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA                          #
+###############################################################################
\ No newline at end of file

=== modified file 'tests/interfaces/openlp_plugins/songs/__init__.py'
--- tests/interfaces/openlp_plugins/songs/__init__.py	2013-03-29 06:25:01 +0000
+++ tests/interfaces/openlp_plugins/songs/__init__.py	2014-03-17 07:34:01 +0000
@@ -0,0 +1,28 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection                                      #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2014 Raoul Snyman                                        #
+# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan      #
+# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub,      #
+# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer.   #
+# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru,          #
+# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith,             #
+# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock,              #
+# Frode Woldsund, Martin Zibricky, Patrick Zimmermann                         #
+# --------------------------------------------------------------------------- #
+# This program is free software; you can redistribute it and/or modify it     #
+# under the terms of the GNU General Public License as published by the Free  #
+# Software Foundation; version 2 of the License.                              #
+#                                                                             #
+# This program is distributed in the hope that it will be useful, but WITHOUT #
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or       #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for    #
+# more details.                                                               #
+#                                                                             #
+# You should have received a copy of the GNU General Public License along     #
+# with this program; if not, write to the Free Software Foundation, Inc., 59  #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA                          #
+###############################################################################
\ No newline at end of file

=== modified file 'tests/interfaces/openlp_plugins/songs/forms/__init__.py'
--- tests/interfaces/openlp_plugins/songs/forms/__init__.py	2013-03-29 06:25:01 +0000
+++ tests/interfaces/openlp_plugins/songs/forms/__init__.py	2014-03-17 07:34:01 +0000
@@ -0,0 +1,28 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection                                      #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2014 Raoul Snyman                                        #
+# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan      #
+# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub,      #
+# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer.   #
+# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru,          #
+# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith,             #
+# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock,              #
+# Frode Woldsund, Martin Zibricky, Patrick Zimmermann                         #
+# --------------------------------------------------------------------------- #
+# This program is free software; you can redistribute it and/or modify it     #
+# under the terms of the GNU General Public License as published by the Free  #
+# Software Foundation; version 2 of the License.                              #
+#                                                                             #
+# This program is distributed in the hope that it will be useful, but WITHOUT #
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or       #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for    #
+# more details.                                                               #
+#                                                                             #
+# You should have received a copy of the GNU General Public License along     #
+# with this program; if not, write to the Free Software Foundation, Inc., 59  #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA                          #
+###############################################################################
\ No newline at end of file

=== modified file 'tests/interfaces/openlp_plugins/songs/forms/test_authorsform.py'
--- tests/interfaces/openlp_plugins/songs/forms/test_authorsform.py	2014-03-10 19:56:36 +0000
+++ tests/interfaces/openlp_plugins/songs/forms/test_authorsform.py	2014-03-17 07:34:01 +0000
@@ -1,3 +1,31 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection                                      #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2014 Raoul Snyman                                        #
+# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan      #
+# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub,      #
+# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer.   #
+# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru,          #
+# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith,             #
+# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock,              #
+# Frode Woldsund, Martin Zibricky, Patrick Zimmermann                         #
+# --------------------------------------------------------------------------- #
+# This program is free software; you can redistribute it and/or modify it     #
+# under the terms of the GNU General Public License as published by the Free  #
+# Software Foundation; version 2 of the License.                              #
+#                                                                             #
+# This program is distributed in the hope that it will be useful, but WITHOUT #
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or       #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for    #
+# more details.                                                               #
+#                                                                             #
+# You should have received a copy of the GNU General Public License along     #
+# with this program; if not, write to the Free Software Foundation, Inc., 59  #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA                          #
+###############################################################################
 """
 Package to test the openlp.plugins.songs.forms.authorsform package.
 """
@@ -7,9 +35,10 @@
 
 from openlp.core.common import Registry
 from openlp.plugins.songs.forms.authorsform import AuthorsForm
-
-
-class TestAuthorsForm(TestCase):
+from tests.helpers.testmixin import TestMixin
+
+
+class TestAuthorsForm(TestCase, TestMixin):
     """
     Test the AuthorsForm class
     """
@@ -19,11 +48,7 @@
         Create the UI
         """
         Registry.create()
-        old_app_instance = QtCore.QCoreApplication.instance()
-        if old_app_instance is None:
-            self.app = QtGui.QApplication([])
-        else:
-            self.app = old_app_instance
+        self.get_application()
         self.main_window = QtGui.QMainWindow()
         Registry().register('main_window', self.main_window)
         self.form = AuthorsForm()

=== modified file 'tests/interfaces/openlp_plugins/songs/forms/test_editsongform.py'
--- tests/interfaces/openlp_plugins/songs/forms/test_editsongform.py	2014-03-10 19:56:36 +0000
+++ tests/interfaces/openlp_plugins/songs/forms/test_editsongform.py	2014-03-17 07:34:01 +0000
@@ -1,16 +1,45 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection                                      #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2014 Raoul Snyman                                        #
+# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan      #
+# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub,      #
+# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer.   #
+# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru,          #
+# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith,             #
+# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock,              #
+# Frode Woldsund, Martin Zibricky, Patrick Zimmermann                         #
+# --------------------------------------------------------------------------- #
+# This program is free software; you can redistribute it and/or modify it     #
+# under the terms of the GNU General Public License as published by the Free  #
+# Software Foundation; version 2 of the License.                              #
+#                                                                             #
+# This program is distributed in the hope that it will be useful, but WITHOUT #
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or       #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for    #
+# more details.                                                               #
+#                                                                             #
+# You should have received a copy of the GNU General Public License along     #
+# with this program; if not, write to the Free Software Foundation, Inc., 59  #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA                          #
+###############################################################################
 """
 Package to test the openlp.plugins.songs.forms.editsongform package.
 """
 from unittest import TestCase
 
-from PyQt4 import QtGui, QtCore
+from PyQt4 import QtGui
 
 from openlp.core.common import Registry
 from openlp.plugins.songs.forms.editsongform import EditSongForm
 from tests.interfaces import MagicMock
-
-
-class TestEditSongForm(TestCase):
+from tests.helpers.testmixin import TestMixin
+
+
+class TestEditSongForm(TestCase, TestMixin):
     """
     Test the EditSongForm class
     """
@@ -20,11 +49,7 @@
         Create the UI
         """
         Registry.create()
-        old_app_instance = QtCore.QCoreApplication.instance()
-        if old_app_instance is None:
-            self.app = QtGui.QApplication([])
-        else:
-            self.app = old_app_instance
+        self.get_application()
         self.main_window = QtGui.QMainWindow()
         Registry().register('main_window', self.main_window)
         Registry().register('theme_manager', MagicMock())

=== modified file 'tests/interfaces/openlp_plugins/songs/forms/test_editverseform.py'
--- tests/interfaces/openlp_plugins/songs/forms/test_editverseform.py	2014-03-10 19:56:36 +0000
+++ tests/interfaces/openlp_plugins/songs/forms/test_editverseform.py	2014-03-17 07:34:01 +0000
@@ -1,3 +1,31 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection                                      #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2014 Raoul Snyman                                        #
+# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan      #
+# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub,      #
+# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer.   #
+# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru,          #
+# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith,             #
+# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock,              #
+# Frode Woldsund, Martin Zibricky, Patrick Zimmermann                         #
+# --------------------------------------------------------------------------- #
+# This program is free software; you can redistribute it and/or modify it     #
+# under the terms of the GNU General Public License as published by the Free  #
+# Software Foundation; version 2 of the License.                              #
+#                                                                             #
+# This program is distributed in the hope that it will be useful, but WITHOUT #
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or       #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for    #
+# more details.                                                               #
+#                                                                             #
+# You should have received a copy of the GNU General Public License along     #
+# with this program; if not, write to the Free Software Foundation, Inc., 59  #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA                          #
+###############################################################################
 """
 Package to test the openlp.plugins.songs.forms.editverseform package.
 """
@@ -7,9 +35,10 @@
 
 from openlp.core.common import Registry
 from openlp.plugins.songs.forms.editverseform import EditVerseForm
-
-
-class TestEditVerseForm(TestCase):
+from tests.helpers.testmixin import TestMixin
+
+
+class TestEditVerseForm(TestCase, TestMixin):
     """
     Test the EditVerseForm class
     """
@@ -19,11 +48,7 @@
         Create the UI
         """
         Registry.create()
-        old_app_instance = QtCore.QCoreApplication.instance()
-        if old_app_instance is None:
-            self.app = QtGui.QApplication([])
-        else:
-            self.app = old_app_instance
+        self.get_application()
         self.main_window = QtGui.QMainWindow()
         Registry().register('main_window', self.main_window)
         self.form = EditVerseForm()

=== modified file 'tests/interfaces/openlp_plugins/songs/forms/test_topicsform.py'
--- tests/interfaces/openlp_plugins/songs/forms/test_topicsform.py	2014-03-10 19:56:36 +0000
+++ tests/interfaces/openlp_plugins/songs/forms/test_topicsform.py	2014-03-17 07:34:01 +0000
@@ -1,3 +1,31 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection                                      #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2014 Raoul Snyman                                        #
+# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan      #
+# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub,      #
+# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer.   #
+# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru,          #
+# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith,             #
+# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock,              #
+# Frode Woldsund, Martin Zibricky, Patrick Zimmermann                         #
+# --------------------------------------------------------------------------- #
+# This program is free software; you can redistribute it and/or modify it     #
+# under the terms of the GNU General Public License as published by the Free  #
+# Software Foundation; version 2 of the License.                              #
+#                                                                             #
+# This program is distributed in the hope that it will be useful, but WITHOUT #
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or       #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for    #
+# more details.                                                               #
+#                                                                             #
+# You should have received a copy of the GNU General Public License along     #
+# with this program; if not, write to the Free Software Foundation, Inc., 59  #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA                          #
+###############################################################################
 """
 Package to test the openlp.plugins.songs.forms.topicsform package.
 """
@@ -7,9 +35,10 @@
 
 from openlp.core.common import Registry
 from openlp.plugins.songs.forms.topicsform import TopicsForm
-
-
-class TestTopicsForm(TestCase):
+from tests.helpers.testmixin import TestMixin
+
+
+class TestTopicsForm(TestCase, TestMixin):
     """
     Test the TopicsForm class
     """
@@ -19,11 +48,7 @@
         Create the UI
         """
         Registry.create()
-        old_app_instance = QtCore.QCoreApplication.instance()
-        if old_app_instance is None:
-            self.app = QtGui.QApplication([])
-        else:
-            self.app = old_app_instance
+        self.get_application()
         self.main_window = QtGui.QMainWindow()
         Registry().register('main_window', self.main_window)
         self.form = TopicsForm()


Follow ups