From 42ff12dc4811e8feb9d8ac83c6e46d0a09f288aa Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 2 Feb 2013 07:34:42 +0000 Subject: [PATCH] more tweeks --- openlp/core/lib/mediamanageritem.py | 1 - openlp/core/lib/renderer.py | 1 + openlp/core/lib/settingstab.py | 9 +++++++++ openlp/core/ui/firsttimeform.py | 14 ++++++++++++-- openlp/core/ui/media/playertab.py | 2 +- openlp/core/ui/servicemanagerdialog.py | 2 +- openlp/core/ui/themeform.py | 1 - 7 files changed, 24 insertions(+), 6 deletions(-) diff --git a/openlp/core/lib/mediamanageritem.py b/openlp/core/lib/mediamanageritem.py index f3cfc6e53..4f559837c 100644 --- a/openlp/core/lib/mediamanageritem.py +++ b/openlp/core/lib/mediamanageritem.py @@ -698,4 +698,3 @@ class MediaManagerItem(QtGui.QWidget): theme_manager = property(_get_theme_manager) - diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index a7b0756e3..89966c1db 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -662,3 +662,4 @@ class Renderer(object): return self._theme_manager theme_manager = property(_get_theme_manager) + diff --git a/openlp/core/lib/settingstab.py b/openlp/core/lib/settingstab.py index aee4b1b5a..9882dceb6 100644 --- a/openlp/core/lib/settingstab.py +++ b/openlp/core/lib/settingstab.py @@ -174,4 +174,13 @@ class SettingsTab(QtGui.QWidget): theme_manager = property(_get_theme_manager) + def _get_media_controller(self): + """ + Adds the media controller to the class dynamically + """ + if not hasattr(self, u'_media_controller'): + self._media_controller = Registry().get(u'media_controller') + return self._media_controller + + media_controller = property(_get_media_controller) diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py index c5219320d..6ba8a8df9 100644 --- a/openlp/core/ui/firsttimeform.py +++ b/openlp/core/ui/firsttimeform.py @@ -39,7 +39,7 @@ from ConfigParser import SafeConfigParser from PyQt4 import QtCore, QtGui -from openlp.core.lib import translate, PluginStatus, Receiver, build_icon, check_directory_exists, Settings +from openlp.core.lib import translate, PluginStatus, Receiver, build_icon, check_directory_exists, Settings, Registry from openlp.core.utils import get_web_page, AppLocation, get_filesystem_encoding from firsttimewizard import Ui_FirstTimeWizard, FirstTimePage @@ -198,7 +198,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): self.themeComboBox.addItem(item.text()) if self.hasRunWizard: # Add any existing themes to list. - for theme in self.parent().themeManagerContents.get_themes(): + for theme in self.theme_manager.get_themes(): index = self.themeComboBox.findText(theme) if index == -1: self.themeComboBox.addItem(theme) @@ -461,3 +461,13 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): def _setPluginStatus(self, field, tag): 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, u'_theme_manager'): + self._theme_manager = Registry().get(u'theme_manager') + return self._theme_manager + + theme_manager = property(_get_theme_manager) diff --git a/openlp/core/ui/media/playertab.py b/openlp/core/ui/media/playertab.py index 4d575dfad..f50a32dd9 100644 --- a/openlp/core/ui/media/playertab.py +++ b/openlp/core/ui/media/playertab.py @@ -46,7 +46,7 @@ class PlayerTab(SettingsTab): MediaTab is the Media settings tab in the settings dialog. """ def __init__(self, parent): - self.mediaPlayers = self.main_window.mediaController.mediaPlayers + self.mediaPlayers = self.media_controller.mediaPlayers self.savedUsedPlayers = None self.iconPath = u':/media/multimedia-player.png' player_translated = translate('OpenLP.PlayerTab', 'Players') diff --git a/openlp/core/ui/servicemanagerdialog.py b/openlp/core/ui/servicemanagerdialog.py index 3d0f41b8b..e676d6060 100644 --- a/openlp/core/ui/servicemanagerdialog.py +++ b/openlp/core/ui/servicemanagerdialog.py @@ -265,4 +265,4 @@ class ServiceManagerDialog(object): ``event`` Handle of the event pint passed """ - event.accept() \ No newline at end of file + event.accept() diff --git a/openlp/core/ui/themeform.py b/openlp/core/ui/themeform.py index b2ce16386..c90bbce12 100644 --- a/openlp/core/ui/themeform.py +++ b/openlp/core/ui/themeform.py @@ -546,4 +546,3 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard): return self._theme_manager theme_manager = property(_get_theme_manager) - \ No newline at end of file