demo of singleton

This commit is contained in:
Tim Bentley 2013-01-21 20:56:27 +00:00
parent dbf9860c8e
commit 59bb9efdf3
2 changed files with 7 additions and 7 deletions

View File

@ -32,6 +32,7 @@ import logging
from PyQt4 import QtWebKit from PyQt4 import QtWebKit
from openlp.core.lib.theme import BackgroundType, BackgroundGradientType, VerticalType, HorizontalType from openlp.core.lib.theme import BackgroundType, BackgroundGradientType, VerticalType, HorizontalType
from openlp.core.lib import PluginManager
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -248,8 +249,8 @@ def build_html(item, screen, islive, background, image=None,
css_additions = u'' css_additions = u''
js_additions = u'' js_additions = u''
html_additions = u'' html_additions = u''
if plugins: if PluginManager.get_instance().plugins:
for plugin in plugins: for plugin in PluginManager.get_instance().plugins:
css_additions += plugin.getDisplayCss() css_additions += plugin.getDisplayCss()
js_additions += plugin.getDisplayJavaScript() js_additions += plugin.getDisplayJavaScript()
html_additions += plugin.getDisplayHtml() html_additions += plugin.getDisplayHtml()

View File

@ -65,7 +65,6 @@ class Display(QtGui.QGraphicsView):
self.isLive = live self.isLive = live
self.controller = controller self.controller = controller
self.screen = {} self.screen = {}
self.plugins = PluginManager.get_instance().plugins
# FIXME: On Mac OS X (tested on 10.7) the display screen is corrupt with # 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 # 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 # 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 Call the plugins to rebuild the Live display CSS as the screen has
not been rebuild on exit of config. not been rebuild on exit of config.
""" """
if self.rebuildCSS and self.plugins: if self.rebuildCSS and PluginManager.get_instance().plugins:
for plugin in self.plugins: for plugin in PluginManager.get_instance().plugins:
plugin.refreshCss(self.frame) plugin.refreshCss(self.frame)
self.rebuildCSS = False self.rebuildCSS = False
@ -223,7 +222,7 @@ class MainDisplay(Display):
serviceItem = ServiceItem() serviceItem = ServiceItem()
serviceItem.bg_image_bytes = image_to_byte(self.initialFrame) serviceItem.bg_image_bytes = image_to_byte(self.initialFrame)
self.webView.setHtml(build_html(serviceItem, self.screen, self.webView.setHtml(build_html(serviceItem, self.screen,
self.isLive, None, plugins=self.plugins)) self.isLive, None))
self.__hideMouse() self.__hideMouse()
log.debug(u'Finished MainDisplay setup') log.debug(u'Finished MainDisplay setup')
@ -402,7 +401,7 @@ class MainDisplay(Display):
image_bytes = self.imageManager.getImageBytes(image_path, ImageSource.ImagePlugin) image_bytes = self.imageManager.getImageBytes(image_path, ImageSource.ImagePlugin)
else: else:
image_bytes = None 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') log.debug(u'buildHtml - pre setHtml')
self.webView.setHtml(html) self.webView.setHtml(html)
log.debug(u'buildHtml - post setHtml') log.debug(u'buildHtml - post setHtml')