← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~trb143/openlp/cleanup-config into lp:openlp

 

Tim Bentley has proposed merging lp:~trb143/openlp/cleanup-config into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)

For more details, see:
https://code.launchpad.net/~trb143/openlp/cleanup-config/+merge/152594

Clean up Settings events to stream line them and reduce unnecessary processing.

Fix bugs in Remote where some screen actions no longer work!

Add tests for settings form.

Start to remove "config_update" it's scope is too wide!
-- 
https://code.launchpad.net/~trb143/openlp/cleanup-config/+merge/152594
Your team OpenLP Core is requested to review the proposed merge of lp:~trb143/openlp/cleanup-config into lp:openlp.
=== modified file 'openlp/core/lib/settingstab.py'
--- openlp/core/lib/settingstab.py	2013-02-19 19:50:14 +0000
+++ openlp/core/lib/settingstab.py	2013-03-10 20:30:28 +0000
@@ -189,3 +189,12 @@
 
     media_controller = property(_get_media_controller)
 
+    def _get_settings_form(self):
+        """
+        Adds the plugin manager to the class dynamically
+        """
+        if not hasattr(self, u'_settings_form'):
+            self._settings_form = Registry().get(u'settings_form')
+        return self._settings_form
+
+    settings_form = property(_get_settings_form)

=== modified file 'openlp/core/ui/advancedtab.py'
--- openlp/core/ui/advancedtab.py	2013-03-07 11:01:06 +0000
+++ openlp/core/ui/advancedtab.py	2013-03-10 20:30:28 +0000
@@ -36,7 +36,7 @@
 
 from PyQt4 import QtCore, QtGui
 
-from openlp.core.lib import Registry, SettingsTab, Settings, UiStrings, translate, build_icon
+from openlp.core.lib import SettingsTab, Settings, UiStrings, translate, build_icon
 from openlp.core.utils import AppLocation, format_time, get_images_filter
 from openlp.core.lib import SlideLimits
 
@@ -52,7 +52,6 @@
         """
         Initialise the settings tab
         """
-        self.display_changed = False
         self.default_image = u':/graphics/openlp-splash-screen.png'
         self.default_color = u'#ffffff'
         self.data_exists = False
@@ -251,7 +250,6 @@
         self.default_color_button.clicked.connect(self.on_default_color_button_clicked)
         self.default_browse_button.clicked.connect(self.on_default_browse_button_clicked)
         self.default_revert_button.clicked.connect(self.on_default_revert_button_clicked)
-        self.x11_bypass_check_box.toggled.connect(self.on_X11_bypass_check_box_toggled)
         self.alternate_rows_check_box.toggled.connect(self.on_alternate_rows_check_box_toggled)
         self.data_directory_browse_button.clicked.connect(self.on_data_directory_browse_button_clicked)
         self.data_directory_default_button.clicked.connect(self.on_data_directory_default_button_clicked)
@@ -427,16 +425,15 @@
         settings.setValue(u'expand service item', self.expand_service_item_check_box.isChecked())
         settings.setValue(u'enable exit confirmation', self.enable_auto_close_check_box.isChecked())
         settings.setValue(u'hide mouse', self.hide_mouse_check_box.isChecked())
-        settings.setValue(u'x11 bypass wm', self.x11_bypass_check_box.isChecked())
         settings.setValue(u'alternate rows', self.alternate_rows_check_box.isChecked())
         settings.setValue(u'default color', self.default_color)
         settings.setValue(u'default image', self.default_file_edit.text())
         settings.setValue(u'slide limits', self.slide_limits)
+        if  self.x11_bypass_check_box.isChecked() != settings.value(u'x11 bypass wm'):
+            settings.setValue(u'x11 bypass wm', self.x11_bypass_check_box.isChecked())
+            self.settings_form.register_post_process(u'config_screen_changed')
+        self.settings_form.register_post_process(u'slidecontroller_update_slide_limits')
         settings.endGroup()
-        if self.display_changed:
-            Registry().execute(u'config_screen_changed')
-            self.display_changed = False
-        Registry().execute(u'slidecontroller_update_slide_limits')
 
     def cancel(self):
         """
@@ -516,8 +513,8 @@
         Select an image for the default display screen.
         """
         file_filters = u'%s;;%s (*.*) (*)' % (get_images_filter(), UiStrings().AllFiles)
-        filename = QtGui.QFileDialog.getOpenFileName(self,
-            translate('OpenLP.AdvancedTab', 'Open File'), '', file_filters)
+        filename = QtGui.QFileDialog.getOpenFileName(self, translate('OpenLP.AdvancedTab', 'Open File'), '',
+            file_filters)
         if filename:
             self.default_file_edit.setText(filename)
         self.default_file_edit.setFocus()
@@ -635,15 +632,6 @@
         self.default_file_edit.setText(u':/graphics/openlp-splash-screen.png')
         self.default_file_edit.setFocus()
 
-    def on_X11_bypass_check_box_toggled(self, checked):
-        """
-        Toggle X11 bypass flag on maindisplay depending on check box state.
-
-        ``checked``
-            The state of the check box (boolean).
-        """
-        self.display_changed = True
-
     def on_alternate_rows_check_box_toggled(self, checked):
         """
         Notify user about required restart.

=== modified file 'openlp/core/ui/generaltab.py'
--- openlp/core/ui/generaltab.py	2013-03-08 08:14:39 +0000
+++ openlp/core/ui/generaltab.py	2013-03-10 20:30:28 +0000
@@ -313,7 +313,7 @@
         Apply settings after settings tab has loaded and most of the
         system so must be delayed
         """
-        Registry().execute(u'slidecontroller_live_spin_delay', self.timeoutSpinBox.value())
+        self.settings_form.register_post_process(u'slidecontroller_live_spin_delay')
         # Do not continue on start up.
         if not postUpdate:
             return
@@ -329,7 +329,7 @@
         else:
             self.screens.reset_current_display()
         if self.display_changed:
-            Registry().execute(u'config_screen_changed')
+            self.settings_form.register_post_process(u'config_screen_changed')
         self.display_changed = False
 
     def onOverrideRadioButtonPressed(self, checked):

=== modified file 'openlp/core/ui/maindisplay.py'
--- openlp/core/ui/maindisplay.py	2013-03-07 08:14:26 +0000
+++ openlp/core/ui/maindisplay.py	2013-03-10 20:30:28 +0000
@@ -158,7 +158,6 @@
             Registry().register_function(u'live_display_hide', self.hide_display)
             Registry().register_function(u'live_display_show', self.show_display)
             Registry().register_function(u'update_display_css', self.css_changed)
-            Registry().register_function(u'config_updated', self.config_changed)
 
     def set_transparency(self, enabled):
         """
@@ -173,19 +172,10 @@
 
     def css_changed(self):
         """
-        We may need to rebuild the CSS on the live display.
-        """
-        self.rebuild_css = True
-
-    def config_changed(self):
-        """
-        Call the plugins to rebuild the Live display CSS as the screen has
-        not been rebuild on exit of config.
-        """
-        if self.rebuild_css and self.plugin_manager.plugins:
-            for plugin in self.plugin_manager.plugins:
-                plugin.refreshCss(self.frame)
-        self.rebuild_css = False
+        We need to rebuild the CSS on the live display.
+        """
+        for plugin in self.plugin_manager.plugins:
+            plugin.refreshCss(self.frame)
 
     def retranslateUi(self):
         """

=== modified file 'openlp/core/ui/media/playertab.py'
--- openlp/core/ui/media/playertab.py	2013-03-07 11:01:06 +0000
+++ openlp/core/ui/media/playertab.py	2013-03-10 20:30:28 +0000
@@ -216,7 +216,6 @@
         """
         Save the settings
         """
-        player_string_changed = False
         settings = Settings()
         settings.beginGroup(self.settingsSection)
         settings.setValue(u'background color', self.bg_color)
@@ -225,16 +224,13 @@
         if self.usedPlayers != old_players:
             # clean old Media stuff
             set_media_players(self.usedPlayers, override_player)
-            player_string_changed = True
-        if player_string_changed:
-            self.service_manager.reset_supported_suffixes()
-            Registry().execute(u'mediaitem_media_rebuild')
-            Registry().execute(u'config_screen_changed')
+            self.settings_form.register_post_process(u'mediaitem_suffix_reset')
+            self.settings_form.register_post_process(u'mediaitem_media_rebuild')
+            self.settings_form.register_post_process(u'config_screen_changed')
 
     def post_set_up(self):
         """
-        Late setup for players as the MediaController has to be initialised
-        first.
+        Late setup for players as the MediaController has to be initialised first.
         """
         for key, player in self.media_players.iteritems():
             player = self.media_players[key]
@@ -257,7 +253,7 @@
         """
         Translations for players is dependent on  their setup as well
          """
-        for key in self.media_players:
+        for key in self.media_players and self.playerCheckBoxes:
             player = self.media_players[key]
             checkbox = self.playerCheckBoxes[player.name]
             checkbox.setPlayerName(player.name)

=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py	2013-03-07 08:05:43 +0000
+++ openlp/core/ui/servicemanager.py	2013-03-10 20:30:28 +0000
@@ -113,10 +113,12 @@
         self.toolbar = OpenLPToolbar(self)
         self.toolbar.add_toolbar_action(u'newService', text=UiStrings().NewService, icon=u':/general/general_new.png',
             tooltip=UiStrings().CreateService, triggers=self.on_new_service_clicked)
-        self.toolbar.add_toolbar_action(u'openService', text=UiStrings().OpenService, icon=u':/general/general_open.png',
+        self.toolbar.add_toolbar_action(u'openService', text=UiStrings().OpenService,
+            icon=u':/general/general_open.png',
             tooltip=translate('OpenLP.ServiceManager', 'Load an existing service.'),
             triggers=self.on_load_service_clicked)
-        self.toolbar.add_toolbar_action(u'saveService', text=UiStrings().SaveService, icon=u':/general/general_save.png',
+        self.toolbar.add_toolbar_action(u'saveService', text=UiStrings().SaveService,
+            icon=u':/general/general_save.png',
             tooltip=translate('OpenLP.ServiceManager', 'Save this service.'), triggers=self.decide_save_method)
         self.toolbar.addSeparator()
         self.theme_label = QtGui.QLabel(u'%s:' % UiStrings().Theme, self)
@@ -268,6 +270,8 @@
         Registry().register_function(u'config_updated', self.config_updated)
         Registry().register_function(u'config_screen_changed', self.regenerate_service_Items)
         Registry().register_function(u'theme_update_global', self.theme_change)
+        Registry().register_function(u'mediaitem_suffix_reset', self.reset_supported_suffixes)
+        Registry().register_function(u'servicemanager_set_item', self.on_set_item)
 
     def drag_enter_event(self, event):
         """

=== modified file 'openlp/core/ui/settingsform.py'
--- openlp/core/ui/settingsform.py	2013-02-21 21:18:26 +0000
+++ openlp/core/ui/settingsform.py	2013-03-10 20:30:28 +0000
@@ -52,15 +52,8 @@
         Registry().register(u'settings_form', self)
         Registry().register_function(u'bootstrap_post_set_up', self.post_set_up)
         QtGui.QDialog.__init__(self, parent)
+        self.processes = []
         self.setupUi(self)
-        # General tab
-        self.generalTab = GeneralTab(self)
-        # Themes tab
-        self.themesTab = ThemesTab(self)
-        # Advanced tab
-        self.advancedTab = AdvancedTab(self)
-        # Advanced tab
-        self.playerTab = PlayerTab(self)
 
     def exec_(self):
         """
@@ -108,6 +101,8 @@
         for tabIndex in range(self.stackedLayout.count()):
             self.stackedLayout.widget(tabIndex).save()
         # Must go after all settings are save
+        while self.processes:
+            Registry().execute(self.processes.pop(0))
         Registry().execute(u'config_updated')
         return QtGui.QDialog.accept(self)
 
@@ -115,6 +110,7 @@
         """
         Process the form saving the settings
         """
+        self.processes = []
         for tabIndex in range(self.stackedLayout.count()):
             self.stackedLayout.widget(tabIndex).cancel()
         return QtGui.QDialog.reject(self)
@@ -123,6 +119,14 @@
         """
         Run any post-setup code for the tabs on the form
         """
+        # General tab
+        self.generalTab = GeneralTab(self)
+        # Themes tab
+        self.themesTab = ThemesTab(self)
+        # Advanced tab
+        self.advancedTab = AdvancedTab(self)
+        # Advanced tab
+        self.playerTab = PlayerTab(self)
         self.generalTab.post_set_up()
         self.themesTab.post_set_up()
         self.advancedTab.post_set_up()
@@ -138,15 +142,15 @@
         self.stackedLayout.setCurrentIndex(tabIndex)
         self.stackedLayout.currentWidget().tabVisible()
 
-    def resetSupportedSuffixes(self):
-        """
-        Control the resetting of the serviceManager suffix list as can be
-        called by a number of settings tab and only needs to be called once
-        per save.
-        """
-        if self.resetSuffixes:
-            self.service_manager.reset_supported_suffixes()
-            self.resetSuffixes = False
+    def register_post_process(self, function):
+        """
+        Register for updates to be done on save removing duplicate functions
+
+        ``function``
+            The function to be called
+        """
+        if not function in self.processes:
+            self.processes.append(function)
 
     def _get_main_window(self):
         """

=== modified file 'openlp/core/ui/thememanager.py'
--- openlp/core/ui/thememanager.py	2013-03-07 08:05:43 +0000
+++ openlp/core/ui/thememanager.py	2013-03-10 20:30:28 +0000
@@ -184,8 +184,7 @@
 
     def change_global_from_tab(self, theme_name):
         """
-        Change the global theme when it is changed through the Themes settings
-        tab
+        Change the global theme when it is changed through the Themes settings tab
         """
         log.debug(u'change_global_from_tab %s', theme_name)
         for count in range(0, self.theme_list_widget.count()):

=== modified file 'openlp/core/ui/themestab.py'
--- openlp/core/ui/themestab.py	2013-03-07 11:01:06 +0000
+++ openlp/core/ui/themestab.py	2013-03-10 20:30:28 +0000
@@ -151,13 +151,13 @@
         settings.endGroup()
         self.renderer.set_global_theme(self.global_theme)
         self.renderer.set_theme_level(self.theme_level)
-        Registry().execute(u'theme_update_global', self.global_theme)
+        self.settings_form.register_post_process(u'theme_update_global')
 
     def post_set_up(self):
         """
         After setting things up...
         """
-        Registry().execute(u'theme_update_global', self.global_theme)
+        Registry().execute(u'theme_update_global')
 
     def onSongLevelButtonClicked(self):
         """

=== modified file 'openlp/plugins/alerts/lib/alertstab.py'
--- openlp/plugins/alerts/lib/alertstab.py	2013-03-07 11:01:06 +0000
+++ openlp/plugins/alerts/lib/alertstab.py	2013-03-10 20:30:28 +0000
@@ -27,11 +27,12 @@
 # Temple Place, Suite 330, Boston, MA 02111-1307 USA                          #
 ###############################################################################
 
-from PyQt4 import QtCore, QtGui
+from PyQt4 import QtGui
 
-from openlp.core.lib import Registry, SettingsTab, Settings, UiStrings, translate
+from openlp.core.lib import SettingsTab, Settings, UiStrings, translate
 from openlp.core.lib.ui import create_valign_selection_widgets
 
+
 class AlertsTab(SettingsTab):
     """
     AlertsTab is the alerts settings tab in the settings dialog.
@@ -173,7 +174,7 @@
         settings.setValue(u'location', self.location)
         settings.endGroup()
         if self.changed:
-            Registry().execute(u'update_display_css')
+            self.settings_form.register_post_process(u'update_display_css')
         self.changed = False
 
     def updateDisplay(self):
@@ -184,4 +185,3 @@
         self.fontPreview.setFont(font)
         self.fontPreview.setStyleSheet(u'background-color: %s; color: %s' % (self.bg_color, self.font_color))
         self.changed = True
-

=== modified file 'openlp/plugins/bibles/lib/biblestab.py'
--- openlp/plugins/bibles/lib/biblestab.py	2013-03-07 11:01:06 +0000
+++ openlp/plugins/bibles/lib/biblestab.py	2013-03-10 20:30:28 +0000
@@ -179,27 +179,13 @@
         self.rangeSeparatorCheckBox.setText(translate('BiblesPlugin.BiblesTab', 'Range Separator:'))
         self.listSeparatorCheckBox.setText(translate('BiblesPlugin.BiblesTab', 'List Separator:'))
         self.endSeparatorCheckBox.setText(translate('BiblesPlugin.BiblesTab', 'End Mark:'))
-        #@todo these are common so move to StringsUI and reuse.
-        self.verseSeparatorLineEdit.setToolTip(
-            translate('BiblesPlugin.BiblesTab', 'Multiple alternative '
-                'verse separators may be defined.\nThey have to be separated '
-                'by a vertical bar "|".\nPlease clear this edit line to use '
-                'the default value.'))
-        self.rangeSeparatorLineEdit.setToolTip(
-            translate('BiblesPlugin.BiblesTab', 'Multiple alternative '
-                'range separators may be defined.\nThey have to be separated '
-                'by a vertical bar "|".\nPlease clear this edit line to use '
-                'the default value.'))
-        self.listSeparatorLineEdit.setToolTip(
-            translate('BiblesPlugin.BiblesTab', 'Multiple alternative '
-                'list separators may be defined.\nThey have to be separated '
-                'by a vertical bar "|".\nPlease clear this edit line to use '
-                'the default value.'))
-        self.endSeparatorLineEdit.setToolTip(
-            translate('BiblesPlugin.BiblesTab', 'Multiple alternative '
-                'end marks may be defined.\nThey have to be separated by a '
-                'vertical bar "|".\nPlease clear this edit line to use the '
-                'default value.'))
+        tip_text = translate('BiblesPlugin.BiblesTab',
+            'Multiple alternative verse separators may be defined.\nThey have to be separated by a vertical bar "|".'
+            '\nPlease clear this edit line to use the default value.')
+        self.verseSeparatorLineEdit.setToolTip(tip_text)
+        self.rangeSeparatorLineEdit.setToolTip(tip_text)
+        self.listSeparatorLineEdit.setToolTip(tip_text)
+        self.endSeparatorLineEdit.setToolTip(tip_text)
         self.languageSelectionGroupBox.setTitle(translate('BiblesPlugin.BiblesTab', 'Default Bible Language'))
         self.languageSelectionLabel.setText(translate('BiblesPlugin.BiblesTab',
             'Book name language in search field,\nsearch results and on display:'))
@@ -368,7 +354,6 @@
         settings.setValue(u'display new chapter', self.show_new_chapters)
         settings.setValue(u'display brackets', self.display_style)
         settings.setValue(u'verse layout style', self.layout_style)
-        settings.setValue(u'book name language', self.language_selection)
         settings.setValue(u'second bibles', self.second_bibles)
         settings.setValue(u'bible theme', self.bible_theme)
         if self.verseSeparatorCheckBox.isChecked():
@@ -388,7 +373,10 @@
         else:
             settings.remove(u'end separator')
         update_reference_separators()
-        Registry().execute(u'bibles_load_list')
+        if self.language_selection != settings.value(u'book name language'):
+            settings.setValue(u'book name language', self.language_selection)
+            self.settings_form.register_post_process(u'bibles_load_list',
+                translate('OpenLP.BibleTab', 'Bibles Lists updating.'))
         settings.endGroup()
 
     def update_theme_list(self, theme_list):

=== modified file 'openlp/plugins/bibles/lib/db.py'
--- openlp/plugins/bibles/lib/db.py	2013-02-07 08:42:17 +0000
+++ openlp/plugins/bibles/lib/db.py	2013-03-10 20:30:28 +0000
@@ -365,16 +365,13 @@
             The language selection the user has chosen in the settings
             section of the Bible.
         """
-        log.debug(u'get_book_ref_id_by_localised_name("%s", "%s")',
-            book, language_selection)
-        from openlp.plugins.bibles.lib import LanguageSelection, \
-            BibleStrings
+        log.debug(u'get_book_ref_id_by_localised_name("%s", "%s")', book, language_selection)
+        from openlp.plugins.bibles.lib import LanguageSelection, BibleStrings
         book_names = BibleStrings().BookNames
         # escape reserved characters
         book_escaped = book
         for character in RESERVED_CHARACTERS:
-            book_escaped = book_escaped.replace(
-                character, u'\\' + character)
+            book_escaped = book_escaped.replace(character, u'\\' + character)
         regex_book = re.compile(u'\s*%s\s*' % u'\s*'.join(
             book_escaped.split()), re.UNICODE | re.IGNORECASE)
         if language_selection == LanguageSelection.Bible:
@@ -382,8 +379,7 @@
             if db_book:
                 return db_book.book_reference_id
         elif language_selection == LanguageSelection.Application:
-            books = filter(lambda key:
-                regex_book.match(unicode(book_names[key])), book_names.keys())
+            books = filter(lambda key: regex_book.match(unicode(book_names[key])), book_names.keys())
             books = filter(None, map(BiblesResourcesDB.get_book, books))
             for value in books:
                 if self.get_book_by_book_ref_id(value[u'id']):
@@ -391,8 +387,7 @@
         elif language_selection == LanguageSelection.English:
             books = BiblesResourcesDB.get_books_like(book)
             if books:
-                book_list = filter(
-                    lambda value: regex_book.match(value[u'name']), books)
+                book_list = filter(lambda value: regex_book.match(value[u'name']), books)
                 if not book_list:
                     book_list = books
                 for value in book_list:

=== modified file 'openlp/plugins/images/lib/imagetab.py'
--- openlp/plugins/images/lib/imagetab.py	2013-03-07 11:01:06 +0000
+++ openlp/plugins/images/lib/imagetab.py	2013-03-10 20:30:28 +0000
@@ -90,5 +90,4 @@
         settings.setValue(u'background color', self.bg_color)
         settings.endGroup()
         if self.initial_color != self.bg_color:
-            Registry().execute(u'image_updated')
-
+            self.settings_form.register_post_process(u'image_updated')

=== modified file 'openlp/plugins/media/lib/mediatab.py'
--- openlp/plugins/media/lib/mediatab.py	2013-02-07 08:42:17 +0000
+++ openlp/plugins/media/lib/mediatab.py	2013-03-10 20:30:28 +0000
@@ -29,7 +29,8 @@
 
 from PyQt4 import QtGui
 
-from openlp.core.lib import Registry, Settings, SettingsTab, UiStrings, translate
+from openlp.core.lib import Settings, SettingsTab, UiStrings, translate
+
 
 class MediaQCheckBox(QtGui.QCheckBox):
     """
@@ -74,15 +75,12 @@
         self.autoStartCheckBox.setChecked(Settings().value(self.settingsSection + u'/media auto start'))
 
     def save(self):
-        override_changed = False
         setting_key = self.settingsSection + u'/override player'
         if Settings().value(setting_key) != self.overridePlayerCheckBox.checkState():
             Settings().setValue(setting_key, self.overridePlayerCheckBox.checkState())
-            override_changed = True
+            self.settings_form.register_post_process(u'mediaitem_suffix_reset')
+            self.settings_form.register_post_process(u'mediaitem_media_rebuild')
+            self.settings_form.register_post_process(u'mediaitem_suffixes')
         setting_key = self.settingsSection + u'/media auto start'
         if Settings().value(setting_key) != self.autoStartCheckBox.checkState():
             Settings().setValue(setting_key, self.autoStartCheckBox.checkState())
-        if override_changed:
-            self.parent.reset_supported_suffixes()
-            Registry().execute(u'mediaitem_media_rebuild')
-            Registry().execute(u'mediaitem_suffixes')

=== modified file 'openlp/plugins/presentations/lib/presentationtab.py'
--- openlp/plugins/presentations/lib/presentationtab.py	2013-02-07 08:42:17 +0000
+++ openlp/plugins/presentations/lib/presentationtab.py	2013-03-10 20:30:28 +0000
@@ -29,7 +29,7 @@
 
 from PyQt4 import QtGui
 
-from openlp.core.lib import Registry, Settings, SettingsTab, UiStrings, translate
+from openlp.core.lib import Settings, SettingsTab, UiStrings, translate
 
 class PresentationTab(SettingsTab):
     """
@@ -129,9 +129,9 @@
             Settings().setValue(setting_key, self.OverrideAppCheckBox.checkState())
             changed = True
         if changed:
-            self.parent.reset_supported_suffixes()
-            Registry().execute(u'mediaitem_presentation_rebuild')
-            Registry().execute(u'mediaitem_suffixes')
+            self.settings_form.register_post_process(u'mediaitem_suffix_reset')
+            self.settings_form.register_post_process(u'mediaitem_presentation_rebuild')
+            self.settings_form.register_post_process(u'mediaitem_suffixes')
 
     def tabVisible(self):
         """

=== modified file 'openlp/plugins/remotes/lib/httpserver.py'
--- openlp/plugins/remotes/lib/httpserver.py	2013-03-01 17:36:43 +0000
+++ openlp/plugins/remotes/lib/httpserver.py	2013-03-10 20:30:28 +0000
@@ -162,8 +162,6 @@
         self.plugin = plugin
         self.html_dir = os.path.join(AppLocation.get_directory(AppLocation.PluginsDir), u'remotes', u'html')
         self.connections = []
-        self.current_item = None
-        self.current_slide = None
         self.start_tcp()
 
     def start_tcp(self):
@@ -177,23 +175,9 @@
         address = Settings().value(self.plugin.settingsSection + u'/ip address')
         self.server = QtNetwork.QTcpServer()
         self.server.listen(QtNetwork.QHostAddress(address), port)
-        Registry().register_function(u'slidecontroller_live_changed', self.slide_change)
-        Registry().register_function(u'slidecontroller_live_started', self.item_change)
         self.server.newConnection.connect(self.new_connection)
         log.debug(u'TCP listening on port %d' % port)
 
-    def slide_change(self, row):
-        """
-        Slide change listener. Store the item and tell the clients.
-        """
-        self.current_slide = row
-
-    def item_change(self, items):
-        """
-        Item (song) change listener. Store the slide and tell the clients.
-        """
-        self.current_item = items[0]
-
     def new_connection(self):
         """
         A new http connection has been made. Create a client object to handle
@@ -252,8 +236,8 @@
 
     def _get_service_items(self):
         service_items = []
-        if self.parent.current_item:
-            current_unique_identifier = self.parent.current_item.unique_identifier
+        if self.live_controller.service_item:
+            current_unique_identifier = self.live_controller.service_item.unique_identifier
         else:
             current_unique_identifier = None
         for item in self.service_manager.service_items:
@@ -388,8 +372,8 @@
         """
         result = {
             u'service': self.service_manager.service_id,
-            u'slide': self.parent.current_slide or 0,
-            u'item': self.parent.current_item.unique_identifier if self.parent.current_item else u'',
+            u'slide': self.live_controller.selected_row or 0,
+            u'item': self.live_controller.service_item.unique_identifier if self.live_controller.service_item else u'',
             u'twelve': Settings().value(u'remotes/twelve hour'),
             u'blank': self.live_controller.blank_screen.isChecked(),
             u'theme': self.live_controller.theme_screen.isChecked(),
@@ -438,7 +422,7 @@
         """
         event = u'slidecontroller_%s_%s' % (display_type, action)
         if action == u'text':
-            current_item = self.parent.current_item
+            current_item = self.live_controller.service_item
             data = []
             if current_item:
                 for index, frame in enumerate(current_item.get_frames()):
@@ -454,11 +438,11 @@
                         item[u'tag'] = unicode(index + 1)
                         item[u'text'] = unicode(frame[u'title'])
                         item[u'html'] = unicode(frame[u'title'])
-                    item[u'selected'] = (self.parent.current_slide == index)
+                    item[u'selected'] = (self.live_controller.selected_row == index)
                     data.append(item)
             json_data = {u'results': {u'slides': data}}
             if current_item:
-                json_data[u'results'][u'item'] = self.parent.current_item.unique_identifier
+                json_data[u'results'][u'item'] = self.live_controller.service_item.unique_identifier
         else:
             if self.url_params and self.url_params.get(u'data'):
                 try:

=== modified file 'tests/interfaces/openlp_core_ui/test_filerenamedialog.py'
--- tests/interfaces/openlp_core_ui/test_filerenamedialog.py	2013-03-01 11:12:23 +0000
+++ tests/interfaces/openlp_core_ui/test_filerenamedialog.py	2013-03-10 20:30:28 +0000
@@ -8,6 +8,7 @@
 from openlp.core.ui import filerenameform
 from PyQt4 import QtGui, QtTest
 
+
 class TestStartFileRenameForm(TestCase):
 
     def setUp(self):

=== modified file 'tests/interfaces/openlp_core_ui/test_servicenotedialog.py'
--- tests/interfaces/openlp_core_ui/test_servicenotedialog.py	2013-02-18 21:05:08 +0000
+++ tests/interfaces/openlp_core_ui/test_servicenotedialog.py	2013-03-10 20:30:28 +0000
@@ -10,7 +10,6 @@
 from openlp.core.ui import servicenoteform
 
 
-
 class TestStartNoteDialog(TestCase):
 
     def setUp(self):

=== added file 'tests/interfaces/openlp_core_ui/test_settings_form.py'
--- tests/interfaces/openlp_core_ui/test_settings_form.py	1970-01-01 00:00:00 +0000
+++ tests/interfaces/openlp_core_ui/test_settings_form.py	2013-03-10 20:30:28 +0000
@@ -0,0 +1,110 @@
+"""
+Package to test the openlp.core.lib.settingsform package.
+"""
+from unittest import TestCase
+
+from mock import MagicMock, patch
+
+from PyQt4 import QtCore, QtTest
+
+from openlp.core.ui import settingsform
+from openlp.core.lib import Registry, ScreenList
+
+
+SCREEN = {
+    u'primary': False,
+    u'number': 1,
+    u'size': QtCore.QRect(0, 0, 1024, 768)
+}
+
+
+class TestSettingsForm(TestCase):
+    """
+    Test the PluginManager class
+    """
+
+    def setUp(self):
+        """
+        Some pre-test setup required.
+        """
+        self.desktop = MagicMock()
+        self.desktop.primaryScreen.return_value = SCREEN[u'primary']
+        self.desktop.screenCount.return_value = SCREEN[u'number']
+        self.desktop.screenGeometry.return_value = SCREEN[u'size']
+        self.screens = ScreenList.create(self.desktop)
+        Registry.create()
+        self.form = settingsform.SettingsForm()
+
+    def tearDown(self):
+        """
+        Delete all the C++ objects at the end so that we don't have a segfault
+        """
+        del self.form
+
+    def basic_cancel_test(self):
+        """
+        Test running the settings form and pressing Cancel
+        """
+        # GIVEN: An initial form
+
+        # WHEN displaying the UI and pressing cancel
+        with patch(u'PyQt4.QtGui.QDialog.reject') as mocked_reject:
+            okWidget = self.form.button_box.button(self.form.button_box.Cancel)
+            QtTest.QTest.mouseClick(okWidget, QtCore.Qt.LeftButton)
+
+            # THEN the dialog reject should have been called
+            assert mocked_reject.call_count == 1, u'The QDialog.reject should have been called'
+
+    def basic_accept_test(self):
+        """
+        Test running the settings form and pressing Ok
+        """
+        # GIVEN: An initial form
+
+        # WHEN displaying the UI and pressing Ok
+        with patch(u'PyQt4.QtGui.QDialog.accept') as mocked_accept:
+            okWidget = self.form.button_box.button(self.form.button_box.Ok)
+            QtTest.QTest.mouseClick(okWidget, QtCore.Qt.LeftButton)
+
+            # THEN the dialog reject should have been called
+            assert mocked_accept.call_count == 1, u'The QDialog.accept should have been called'
+
+    def basic_register_test(self):
+        """
+        Test running the settings form and adding a single function
+        """
+        # GIVEN: An initial form add a register function
+        self.form.register_post_process(u'function1')
+
+        # WHEN displaying the UI and pressing Ok
+        with patch(u'PyQt4.QtGui.QDialog.accept'):
+            okWidget = self.form.button_box.button(self.form.button_box.Ok)
+            QtTest.QTest.mouseClick(okWidget, QtCore.Qt.LeftButton)
+
+            # THEN the processing stack should be empty
+            assert len(self.form.processes) == 0, u'The defined processes have been called'
+
+    def register_multiple_functions_test(self):
+        """
+        Test running the settings form and adding multiple functions
+        """
+        # GIVEN: Registering a single function
+        self.form.register_post_process(u'function1')
+
+        # WHEN testing the processing stack
+        # THEN the processing stack should have one item
+        assert len(self.form.processes) == 1, u'The one defined process is ready to be called'
+
+        # GIVEN: Registering a new function
+        self.form.register_post_process(u'function2')
+
+        # WHEN testing the processing stack
+        # THEN the processing stack should have two items
+        assert len(self.form.processes) == 2, u'The two defined processes is ready to be called'
+
+        # GIVEN: Registering a process for the second time
+        self.form.register_post_process(u'function1')
+
+        # WHEN testing the processing stack
+        # THEN the processing stack should still have two items
+        assert len(self.form.processes) == 2, u'No new processes have been added to the stack'
\ No newline at end of file