From 1576a2c1d400c450ba97f61c6163bc102878151d Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Thu, 7 Feb 2013 07:08:35 +0000 Subject: [PATCH] Config update conversion --- openlp/core/lib/plugin.py | 4 ++-- openlp/core/lib/registry.py | 10 +--------- openlp/plugins/bibles/lib/mediaitem.py | 8 ++++---- openlp/plugins/remotes/remoteplugin.py | 2 +- openlp/plugins/songs/lib/mediaitem.py | 6 +++--- 5 files changed, 11 insertions(+), 19 deletions(-) diff --git a/openlp/core/lib/plugin.py b/openlp/core/lib/plugin.py index 586e35ad8..8b1951726 100644 --- a/openlp/core/lib/plugin.py +++ b/openlp/core/lib/plugin.py @@ -173,7 +173,7 @@ class Plugin(QtCore.QObject): Settings.extend_default_settings(default_settings) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'%s_add_service_item' % self.name), self.processAddServiceEvent) - Registry().register_function(u'%s_config_updated' % self.name, self.configUpdated) + Registry().register_function(u'%s_config_updated' % self.name, self.config_update) def checkPreConditions(self): """ @@ -402,7 +402,7 @@ class Plugin(QtCore.QObject): """ return u'' - def configUpdated(self): + def config_update(self): """ The plugin's config has changed """ diff --git a/openlp/core/lib/registry.py b/openlp/core/lib/registry.py index f9773a6d1..082592172 100644 --- a/openlp/core/lib/registry.py +++ b/openlp/core/lib/registry.py @@ -127,20 +127,12 @@ class Registry(object): for function in self.functions_list[event]: try: result = function(*args, **kwargs) - # allow the result to be viewed in tests only. - if self.running_under_test is True: - self.inspect_result(result,*args, **kwargs) if result: results.append(result) except TypeError: - # Who has called me can help + # Who has called me can help in debugging import inspect log.debug(inspect.currentframe().f_back.f_locals) log.exception(u'Exception for function %s', function) return results - def inspect_result(self, results,*args, **kwargs): - """ - Dummy method for tests to inspect the results of a call. - """ - pass diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index 7ab3444dc..65148143a 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -246,7 +246,7 @@ class BibleMediaItem(MediaManagerItem): # Buttons QtCore.QObject.connect(self.advancedSearchButton, QtCore.SIGNAL(u'clicked()'), self.onAdvancedSearchButton) QtCore.QObject.connect(self.quickSearchButton, QtCore.SIGNAL(u'clicked()'), self.onQuickSearchButton) - Registry().register_function(u'config_updated', self.configUpdated) + Registry().register_function(u'config_updated', self.config_update) # Other stuff QtCore.QObject.connect(self.quickSearchEdit, QtCore.SIGNAL(u'returnPressed()'), self.onQuickSearchButton) QtCore.QObject.connect(self.searchTabBar, QtCore.SIGNAL(u'currentChanged(int)'), @@ -258,8 +258,8 @@ class BibleMediaItem(MediaManagerItem): else: self.advancedBookComboBox.setFocus() - def configUpdated(self): - log.debug(u'configUpdated') + def config_update(self): + log.debug(u'config_update') if Settings().value(self.settingsSection + u'/second bibles'): self.advancedSecondLabel.setVisible(True) self.advancedSecondComboBox.setVisible(True) @@ -313,7 +313,7 @@ class BibleMediaItem(MediaManagerItem): translate('BiblesPlugin.MediaItem', 'Search Text...')) ]) self.quickSearchEdit.setCurrentSearchType(Settings().value(u'%s/last search type' % self.settingsSection)) - self.configUpdated() + self.config_update() log.debug(u'bible manager initialise complete') def loadBibles(self): diff --git a/openlp/plugins/remotes/remoteplugin.py b/openlp/plugins/remotes/remoteplugin.py index 160b7d542..e028dfcbb 100644 --- a/openlp/plugins/remotes/remoteplugin.py +++ b/openlp/plugins/remotes/remoteplugin.py @@ -95,7 +95,7 @@ class RemotesPlugin(Plugin): u'title': translate('RemotePlugin', 'Remote', 'container title') } - def configUpdated(self): + def config_update(self): """ Called when Config is changed to restart the server on new address or port diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index eca29f1e0..62b5d70ac 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -100,7 +100,7 @@ class SongMediaItem(MediaManagerItem): self.addSearchToToolBar() # Signals and slots QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'songs_load_list'), self.onSongListLoad) - Registry().register_function(u'config_updated', self.configUpdated) + Registry().register_function(u'config_updated', self.config_update) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'songs_preview'), self.onPreviewClick) QtCore.QObject.connect(self.searchTextEdit, QtCore.SIGNAL(u'cleared()'), self.onClearTextButtonClick) QtCore.QObject.connect(self.searchTextEdit, QtCore.SIGNAL(u'searchTypeChanged(int)'), @@ -115,7 +115,7 @@ class SongMediaItem(MediaManagerItem): def onFocus(self): self.searchTextEdit.setFocus() - def configUpdated(self): + def config_update(self): self.searchAsYouType = Settings().value(self.settingsSection + u'/search as type') self.updateServiceOnEdit = Settings().value(self.settingsSection + u'/update service on edit') self.addSongFromService = Settings().value(self.settingsSection + u'/add song from service',) @@ -146,7 +146,7 @@ class SongMediaItem(MediaManagerItem): UiStrings().Themes, UiStrings().SearchThemes) ]) self.searchTextEdit.setCurrentSearchType(Settings().value(u'%s/last search type' % self.settingsSection)) - self.configUpdated() + self.config_update() def onSearchTextButtonClicked(self): # Save the current search type to the configuration.