From 59bb9efdf3722c5bb59c7918751ed3a9f7ff5f96 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Mon, 21 Jan 2013 20:56:27 +0000 Subject: [PATCH] demo of singleton --- openlp/core/lib/htmlbuilder.py | 5 +++-- openlp/core/ui/maindisplay.py | 9 ++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/openlp/core/lib/htmlbuilder.py b/openlp/core/lib/htmlbuilder.py index 3f2b4dfad..9b3c97164 100644 --- a/openlp/core/lib/htmlbuilder.py +++ b/openlp/core/lib/htmlbuilder.py @@ -32,6 +32,7 @@ import logging from PyQt4 import QtWebKit from openlp.core.lib.theme import BackgroundType, BackgroundGradientType, VerticalType, HorizontalType +from openlp.core.lib import PluginManager log = logging.getLogger(__name__) @@ -248,8 +249,8 @@ def build_html(item, screen, islive, background, image=None, css_additions = u'' js_additions = u'' html_additions = u'' - if plugins: - for plugin in plugins: + if PluginManager.get_instance().plugins: + for plugin in PluginManager.get_instance().plugins: css_additions += plugin.getDisplayCss() js_additions += plugin.getDisplayJavaScript() html_additions += plugin.getDisplayHtml() diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index ce4f3efe4..084c1d36b 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -65,7 +65,6 @@ class Display(QtGui.QGraphicsView): self.isLive = live self.controller = controller self.screen = {} - self.plugins = PluginManager.get_instance().plugins # FIXME: On Mac OS X (tested on 10.7) the display screen is corrupt with # OpenGL. Only white blank screen is shown on the 2nd monitor all the # time. We need to investigate more how to use OpenGL properly on Mac OS @@ -182,8 +181,8 @@ class MainDisplay(Display): Call the plugins to rebuild the Live display CSS as the screen has not been rebuild on exit of config. """ - if self.rebuildCSS and self.plugins: - for plugin in self.plugins: + if self.rebuildCSS and PluginManager.get_instance().plugins: + for plugin in PluginManager.get_instance().plugins: plugin.refreshCss(self.frame) self.rebuildCSS = False @@ -223,7 +222,7 @@ class MainDisplay(Display): serviceItem = ServiceItem() serviceItem.bg_image_bytes = image_to_byte(self.initialFrame) self.webView.setHtml(build_html(serviceItem, self.screen, - self.isLive, None, plugins=self.plugins)) + self.isLive, None)) self.__hideMouse() log.debug(u'Finished MainDisplay setup') @@ -402,7 +401,7 @@ class MainDisplay(Display): image_bytes = self.imageManager.getImageBytes(image_path, ImageSource.ImagePlugin) else: image_bytes = None - html = build_html(self.serviceItem, self.screen, self.isLive, background, image_bytes, self.plugins) + html = build_html(self.serviceItem, self.screen, self.isLive, background, image_bytes) log.debug(u'buildHtml - pre setHtml') self.webView.setHtml(html) log.debug(u'buildHtml - post setHtml')