From 91769118102e820714847cccb1960f084fb0a227 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Tue, 11 Oct 2011 19:10:53 +0100 Subject: [PATCH 1/9] Try 1 --- openlp/core/lib/pluginmanager.py | 5 +++++ openlp/core/ui/maindisplay.py | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/openlp/core/lib/pluginmanager.py b/openlp/core/lib/pluginmanager.py index 2248d0ddd..4b706a4c6 100644 --- a/openlp/core/lib/pluginmanager.py +++ b/openlp/core/lib/pluginmanager.py @@ -42,6 +42,10 @@ class PluginManager(object): """ log.info(u'Plugin manager loaded') + @staticmethod + def get_instance(): + return PluginManager.instance + def __init__(self, plugin_dir): """ The constructor for the plugin manager. Passes the controllers on to @@ -51,6 +55,7 @@ class PluginManager(object): The directory to search for plugins. """ log.info(u'Plugin manager Initialising') + PluginManager.instance = self if not plugin_dir in sys.path: log.debug(u'Inserting %s into sys.path', plugin_dir) sys.path.insert(0, plugin_dir) diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index d6eff912c..0cf47ae5e 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -35,7 +35,7 @@ from PyQt4 import QtCore, QtGui, QtWebKit from PyQt4.phonon import Phonon from openlp.core.lib import Receiver, build_html, ServiceItem, image_to_byte, \ - translate + translate, PluginManager from openlp.core.ui import HideMode, ScreenList @@ -56,6 +56,7 @@ class MainDisplay(QtGui.QGraphicsView): self.isLive = live self.imageManager = imageManager self.screens = ScreenList.get_instance() + self.plugins = PluginManager.get_instance().plugins self.alertTab = None self.hideMode = None self.videoHide = False From e87b4658d89c14ff965ead26a64b0bd1d64d86d8 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Tue, 11 Oct 2011 20:54:18 +0100 Subject: [PATCH 2/9] fix up alert changing triggers --- openlp/core/ui/maindisplay.py | 15 +++++++++++++++ openlp/core/ui/settingsform.py | 2 +- openlp/plugins/alerts/lib/alertstab.py | 12 +++++++++++- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index 0cf47ae5e..f3aed92cb 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -58,6 +58,7 @@ class MainDisplay(QtGui.QGraphicsView): self.screens = ScreenList.get_instance() self.plugins = PluginManager.get_instance().plugins self.alertTab = None + self.rebuildCSS = False self.hideMode = None self.videoHide = False self.override = {} @@ -81,6 +82,20 @@ class MainDisplay(QtGui.QGraphicsView): QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'openlp_phonon_creation'), self.createMediaObject) + QtCore.QObject.connect(Receiver.get_receiver(), + QtCore.SIGNAL(u'alertTab_updated'), self.alertTabChanged) + QtCore.QObject.connect(Receiver.get_receiver(), + QtCore.SIGNAL(u'config_updated'), self.configChanged) + + def alertTabChanged(self): + print "alert" + self.rebuildCSS = True + + def configChanged(self): + print "config" + if self.rebuildCSS: + print "Need to rebuild" + self.rebuildCSS = False def retranslateUi(self): """ diff --git a/openlp/core/ui/settingsform.py b/openlp/core/ui/settingsform.py index 49d27a466..37da93b5b 100644 --- a/openlp/core/ui/settingsform.py +++ b/openlp/core/ui/settingsform.py @@ -58,7 +58,7 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog): # load all the settings self.settingListWidget.clear() for tabIndex in range(0, self.stackedLayout.count() + 1): - # take at 0 and the rest shuffell up. + # take at 0 and the rest shuffle up. self.stackedLayout.takeAt(0) self.insertTab(self.generalTab, 0, PluginStatus.Active) self.insertTab(self.themesTab, 1, PluginStatus.Active) diff --git a/openlp/plugins/alerts/lib/alertstab.py b/openlp/plugins/alerts/lib/alertstab.py index 15577fd0e..a6ed18fd1 100644 --- a/openlp/plugins/alerts/lib/alertstab.py +++ b/openlp/plugins/alerts/lib/alertstab.py @@ -27,7 +27,7 @@ from PyQt4 import QtCore, QtGui -from openlp.core.lib import SettingsTab, translate +from openlp.core.lib import SettingsTab, translate, Receiver from openlp.core.lib.ui import UiStrings, create_valign_combo class AlertsTab(SettingsTab): @@ -140,6 +140,7 @@ class AlertsTab(SettingsTab): def onTimeoutSpinBoxChanged(self): self.timeout = self.timeoutSpinBox.value() + self.changed = True def onFontSizeSpinBoxChanged(self): self.font_size = self.fontSizeSpinBox.value() @@ -171,10 +172,15 @@ class AlertsTab(SettingsTab): font.setFamily(self.font_face) self.fontComboBox.setCurrentFont(font) self.updateDisplay() + self.changed = False def save(self): settings = QtCore.QSettings() settings.beginGroup(self.settingsSection) + # Check value has changed as no event handles this field + if settings.value(u'location', QtCore.QVariant(1)).toInt()[0] != \ + self.verticalComboBox.currentIndex(): + self.changed = True settings.setValue(u'background color', QtCore.QVariant(self.bg_color)) settings.setValue(u'font color', QtCore.QVariant(self.font_color)) settings.setValue(u'font size', QtCore.QVariant(self.font_size)) @@ -184,6 +190,9 @@ class AlertsTab(SettingsTab): self.location = self.verticalComboBox.currentIndex() settings.setValue(u'location', QtCore.QVariant(self.location)) settings.endGroup() + if self.changed: + Receiver.send_message(u'alertTab_updated') + self.changed = False def updateDisplay(self): font = QtGui.QFont() @@ -193,4 +202,5 @@ class AlertsTab(SettingsTab): self.fontPreview.setFont(font) self.fontPreview.setStyleSheet(u'background-color: %s; color: %s' % (self.bg_color, self.font_color)) + self.changed = True From bb8b0cd4351be15bf32454cfbf0e8d1b321cb8eb Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Thu, 13 Oct 2011 06:14:03 +0100 Subject: [PATCH 3/9] Move the Alert web code back to the plugin --- openlp/core/lib/htmlbuilder.py | 61 ++++++++++----------------- openlp/core/lib/plugin.py | 18 ++++++++ openlp/core/ui/maindisplay.py | 2 +- openlp/plugins/alerts/alertsplugin.py | 61 +++++++++++++++++++++++++++ 4 files changed, 102 insertions(+), 40 deletions(-) diff --git a/openlp/core/lib/htmlbuilder.py b/openlp/core/lib/htmlbuilder.py index 8e31d8950..bc571d04d 100644 --- a/openlp/core/lib/htmlbuilder.py +++ b/openlp/core/lib/htmlbuilder.py @@ -73,13 +73,7 @@ body { #video2 { z-index: 3; } -#alert { - position: absolute; - left: 0px; - top: 0px; - z-index: 10; - %s -} +%s #footer { position: absolute; z-index: 6; @@ -179,7 +173,7 @@ sup { break; } } - + %s function show_image(src){ var img = document.getElementById('image'); img.src = src; @@ -225,34 +219,6 @@ sup { } } - function show_alert(alerttext, position){ - var text = document.getElementById('alert'); - text.innerHTML = alerttext; - if(alerttext == '') { - text.style.visibility = 'hidden'; - return 0; - } - if(position == ''){ - position = getComputedStyle(text, '').verticalAlign; - } - switch(position) - { - case 'top': - text.style.top = '0px'; - break; - case 'middle': - text.style.top = ((window.innerHeight - text.clientHeight) / 2) - + 'px'; - break; - case 'bottom': - text.style.top = (window.innerHeight - text.clientHeight) - + 'px'; - break; - } - text.style.visibility = 'visible'; - return text.clientHeight; - } - function show_footer(footertext){ document.getElementById('footer').innerHTML = footertext; } @@ -316,14 +282,15 @@ sup { %s +%s
- """ -def build_html(item, screen, alert, islive, background, image=None): +def build_html(item, screen, alert, islive, background, image=None, + plugins=None): """ Build the full web paged structure for display @@ -344,6 +311,9 @@ def build_html(item, screen, alert, islive, background, image=None): ``image`` Image media item - bytes + + ``plugins`` + The List of available plugins """ width = screen[u'size'].width() height = screen[u'size'].height() @@ -360,14 +330,27 @@ def build_html(item, screen, alert, islive, background, image=None): image_src = u'src="data:image/png;base64,%s"' % image else: image_src = u'style="display:none;"' + css_additions = u'' + js_additions = u'' + html_additions = u'' + if plugins: + for plugin in plugins: + print plugin + css_additions += plugin.getDisplayCss() + js_additions += plugin.getDisplayJavaScript() + html_additions += plugin.getDisplayHtml() + print js_additions html = HTMLSRC % (build_background_css(item, width, height), width, height, - build_alert_css(alert, width), + css_additions, + #build_alert_css(alert, width), build_footer_css(item, height), build_lyrics_css(item, webkitvers), u'true' if theme and theme.display_slide_transition and islive \ else u'false', + js_additions, bgimage_src, image_src, + html_additions, build_lyrics_html(item, webkitvers)) return html diff --git a/openlp/core/lib/plugin.py b/openlp/core/lib/plugin.py index db7d4845b..358906d58 100644 --- a/openlp/core/lib/plugin.py +++ b/openlp/core/lib/plugin.py @@ -369,3 +369,21 @@ class Plugin(QtCore.QObject): """ self.textStrings[name] = {u'title': title, u'tooltip': tooltip} + def getDisplayCss(self): + """ + Add css style sheets to htmlbuilder + """ + return u'' + + def getDisplayJavaScript(self): + """ + Add javascript functions to htmlbuilder + """ + return u'' + + def getDisplayHtml(self): + """ + Add html code to htmlbuilder + """ + return u'' + diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index f3aed92cb..129b5a827 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -508,7 +508,7 @@ class MainDisplay(QtGui.QGraphicsView): else: image_bytes = None html = build_html(self.serviceItem, self.screen, self.alertTab, - self.isLive, background, image_bytes) + self.isLive, background, image_bytes, self.plugins) log.debug(u'buildHtml - pre setHtml') self.webView.setHtml(html) log.debug(u'buildHtml - post setHtml') diff --git a/openlp/plugins/alerts/alertsplugin.py b/openlp/plugins/alerts/alertsplugin.py index 21db1972a..c9adabca2 100644 --- a/openlp/plugins/alerts/alertsplugin.py +++ b/openlp/plugins/alerts/alertsplugin.py @@ -32,6 +32,7 @@ from PyQt4 import QtCore from openlp.core.lib import Plugin, StringContent, build_icon, translate from openlp.core.lib.db import Manager from openlp.core.lib.ui import icon_action, UiStrings +from openlp.core.lib.theme import VerticalType from openlp.core.utils.actions import ActionList from openlp.plugins.alerts.lib import AlertsManager, AlertsTab from openlp.plugins.alerts.lib.db import init_schema @@ -39,6 +40,54 @@ from openlp.plugins.alerts.forms import AlertForm log = logging.getLogger(__name__) +JAVASCRIPT = """ + function show_alert(alerttext, position){ + var text = document.getElementById('alert'); + text.innerHTML = alerttext; + if(alerttext == '') { + text.style.visibility = 'hidden'; + return 0; + } + if(position == ''){ + position = getComputedStyle(text, '').verticalAlign; + } + switch(position) + { + case 'top': + text.style.top = '0px'; + break; + case 'middle': + text.style.top = ((window.innerHeight - text.clientHeight) / 2) + + 'px'; + break; + case 'bottom': + text.style.top = (window.innerHeight - text.clientHeight) + + 'px'; + break; + } + text.style.visibility = 'visible'; + return text.clientHeight; + } +""" +CSS = """ + #alert { + position: absolute; + left: 0px; + top: 0px; + z-index: 10; + width: 100%%; + vertical-align: %s; + font-family: %s; + font-size: %spt; + color: %s; + background-color: %s; + } +""" + +HTML = """ + +""" + class AlertsPlugin(Plugin): log.info(u'Alerts Plugin loaded') @@ -121,3 +170,15 @@ class AlertsPlugin(Plugin): u'title': translate('AlertsPlugin', 'Alerts', 'container title') } + def getDisplayJavaScript(self): + return JAVASCRIPT + + def getDisplayCss(self): + align = VerticalType.Names[self.settings_tab.location] + alert = CSS % (align, self.settings_tab.font_face, + self.settings_tab.font_size, self.settings_tab.font_color, + self.settings_tab.bg_color) + return alert + + def getDisplayHtml(self): + return HTML From 9652a690b3adf4c3b55d868257e9f76fed080ad6 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 15 Oct 2011 07:32:01 +0100 Subject: [PATCH 4/9] More cleanups and start of updates --- openlp/core/lib/htmlbuilder.py | 10 ++-------- openlp/core/lib/plugin.py | 6 ++++++ openlp/core/ui/maindisplay.py | 26 ++++++++++++++++---------- openlp/core/ui/slidecontroller.py | 2 -- openlp/plugins/alerts/alertsplugin.py | 17 ++++++++++++++++- openlp/plugins/alerts/lib/alertstab.py | 2 +- 6 files changed, 41 insertions(+), 22 deletions(-) diff --git a/openlp/core/lib/htmlbuilder.py b/openlp/core/lib/htmlbuilder.py index bc571d04d..7d91195a7 100644 --- a/openlp/core/lib/htmlbuilder.py +++ b/openlp/core/lib/htmlbuilder.py @@ -289,7 +289,7 @@ sup { """ -def build_html(item, screen, alert, islive, background, image=None, +def build_html(item, screen, islive, background, image=None, plugins=None): """ Build the full web paged structure for display @@ -300,9 +300,6 @@ def build_html(item, screen, alert, islive, background, image=None, ``screen`` Current display information - ``alert`` - Alert display display information - ``islive`` Item is going live, rather than preview/theme building @@ -335,16 +332,13 @@ def build_html(item, screen, alert, islive, background, image=None, html_additions = u'' if plugins: for plugin in plugins: - print plugin css_additions += plugin.getDisplayCss() js_additions += plugin.getDisplayJavaScript() html_additions += plugin.getDisplayHtml() - print js_additions html = HTMLSRC % (build_background_css(item, width, height), width, height, css_additions, - #build_alert_css(alert, width), - build_footer_css(item, height), + build_footer_css(item, height), build_lyrics_css(item, webkitvers), u'true' if theme and theme.display_slide_transition and islive \ else u'false', diff --git a/openlp/core/lib/plugin.py b/openlp/core/lib/plugin.py index 358906d58..9a5d2d547 100644 --- a/openlp/core/lib/plugin.py +++ b/openlp/core/lib/plugin.py @@ -381,6 +381,12 @@ class Plugin(QtCore.QObject): """ return u'' + def refreshCss(self, frame): + """ + Allow plugins to refresh javascript of displayed screen + """ + return u'' + def getDisplayHtml(self): """ Add html code to htmlbuilder diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index 129b5a827..8c4ba2eba 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -57,7 +57,6 @@ class MainDisplay(QtGui.QGraphicsView): self.imageManager = imageManager self.screens = ScreenList.get_instance() self.plugins = PluginManager.get_instance().plugins - self.alertTab = None self.rebuildCSS = False self.hideMode = None self.videoHide = False @@ -83,18 +82,24 @@ class MainDisplay(QtGui.QGraphicsView): QtCore.SIGNAL(u'openlp_phonon_creation'), self.createMediaObject) QtCore.QObject.connect(Receiver.get_receiver(), - QtCore.SIGNAL(u'alertTab_updated'), self.alertTabChanged) + QtCore.SIGNAL(u'css_update'), self.cssChanged) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'config_updated'), self.configChanged) - def alertTabChanged(self): - print "alert" + def cssChanged(self): + """ + We may need to rebuild the CSS on the live display. + """ self.rebuildCSS = True def configChanged(self): - print "config" - if self.rebuildCSS: - print "Need to rebuild" + """ + 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: + plugin.refreshCss(self.frame) self.rebuildCSS = False def retranslateUi(self): @@ -127,6 +132,7 @@ class MainDisplay(QtGui.QGraphicsView): self.screen[u'size'].width(), self.screen[u'size'].height()) self.page = self.webView.page() self.frame = self.page.mainFrame() + self.webView.settings().setAttribute(7, True) QtCore.QObject.connect(self.webView, QtCore.SIGNAL(u'loadFinished(bool)'), self.isWebLoaded) self.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) @@ -169,7 +175,7 @@ class MainDisplay(QtGui.QGraphicsView): serviceItem = ServiceItem() serviceItem.bg_image_bytes = image_to_byte(self.initialFrame) self.webView.setHtml(build_html(serviceItem, self.screen, - self.alertTab, self.isLive, None)) + self.isLive, None)) self.__hideMouse() # To display or not to display? if not self.screen[u'primary']: @@ -507,8 +513,8 @@ class MainDisplay(QtGui.QGraphicsView): image_bytes = self.imageManager.get_image_bytes(image) else: image_bytes = None - html = build_html(self.serviceItem, self.screen, self.alertTab, - self.isLive, background, image_bytes, self.plugins) + html = build_html(self.serviceItem, self.screen, self.isLive, + background, image_bytes, self.plugins) log.debug(u'buildHtml - pre setHtml') self.webView.setHtml(html) log.debug(u'buildHtml - post setHtml') diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 354cfa168..7e6e0d54e 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -79,7 +79,6 @@ class SlideController(QtGui.QWidget): self.songEdit = False self.selectedRow = 0 self.serviceItem = None - self.alertTab = None self.panel = QtGui.QWidget(parent.controlSplitter) self.slideList = {} # Layout for holding panel @@ -423,7 +422,6 @@ class SlideController(QtGui.QWidget): if self.display: self.display.close() self.display = MainDisplay(self, self.imageManager, self.isLive) - self.display.alertTab = self.alertTab self.display.setup() if self.isLive: self.__addActionsToWidget(self.display) diff --git a/openlp/plugins/alerts/alertsplugin.py b/openlp/plugins/alerts/alertsplugin.py index c9adabca2..057c1075f 100644 --- a/openlp/plugins/alerts/alertsplugin.py +++ b/openlp/plugins/alerts/alertsplugin.py @@ -68,6 +68,16 @@ JAVASCRIPT = """ text.style.visibility = 'visible'; return text.clientHeight; } + + function update_css(align, font, size, color, bgcolor){ + var text = document.getElementById('alert'); + alert("Hello"); + document.getElementById('alert').style.verticalalign = align; + text.style.fontfamily = font; + text.style.size = size; + text.style.color = color; + text.style.backgroundColor = bgcolor; + } """ CSS = """ #alert { @@ -128,7 +138,6 @@ class AlertsPlugin(Plugin): self.toolsAlertItem.setVisible(True) action_list = ActionList.get_instance() action_list.add_action(self.toolsAlertItem, UiStrings().Tools) - self.liveController.alertTab = self.settings_tab def finalise(self): """ @@ -182,3 +191,9 @@ class AlertsPlugin(Plugin): def getDisplayHtml(self): return HTML + + def refreshCss(self, frame): + align = VerticalType.Names[self.settings_tab.location] + frame.evaluateJavaScript(u'update_css("%s,%s,%s,%s,%s")' % (align, + self.settings_tab.font_face, self.settings_tab.font_size, + self.settings_tab.font_color, self.settings_tab.bg_color)) diff --git a/openlp/plugins/alerts/lib/alertstab.py b/openlp/plugins/alerts/lib/alertstab.py index a6ed18fd1..8d709a3b8 100644 --- a/openlp/plugins/alerts/lib/alertstab.py +++ b/openlp/plugins/alerts/lib/alertstab.py @@ -191,7 +191,7 @@ class AlertsTab(SettingsTab): settings.setValue(u'location', QtCore.QVariant(self.location)) settings.endGroup() if self.changed: - Receiver.send_message(u'alertTab_updated') + Receiver.send_message(u'css_update') self.changed = False def updateDisplay(self): From 8ebf7ff131ff120354d8dcb018c8aa19348712c2 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 16 Oct 2011 08:59:21 +0100 Subject: [PATCH 5/9] Finish dynamic Alert updates --- openlp/core/ui/maindisplay.py | 4 +++- openlp/plugins/alerts/alertsplugin.py | 11 +++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index 8c4ba2eba..5e9077e2f 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -132,7 +132,9 @@ class MainDisplay(QtGui.QGraphicsView): self.screen[u'size'].width(), self.screen[u'size'].height()) self.page = self.webView.page() self.frame = self.page.mainFrame() - self.webView.settings().setAttribute(7, True) + if self.isLive and log.getEffectiveLevel() == logging.DEBUG: + self.webView.settings().setAttribute( + QtWebKit.QWebSettings.DeveloperExtrasEnabled, True) QtCore.QObject.connect(self.webView, QtCore.SIGNAL(u'loadFinished(bool)'), self.isWebLoaded) self.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) diff --git a/openlp/plugins/alerts/alertsplugin.py b/openlp/plugins/alerts/alertsplugin.py index 057c1075f..461525a70 100644 --- a/openlp/plugins/alerts/alertsplugin.py +++ b/openlp/plugins/alerts/alertsplugin.py @@ -71,10 +71,9 @@ JAVASCRIPT = """ function update_css(align, font, size, color, bgcolor){ var text = document.getElementById('alert'); - alert("Hello"); - document.getElementById('alert').style.verticalalign = align; - text.style.fontfamily = font; - text.style.size = size; + text.style.verticalAlign = align; + text.style.fontSize = size + "pt"; + text.style.fontFamily = font; text.style.color = color; text.style.backgroundColor = bgcolor; } @@ -194,6 +193,6 @@ class AlertsPlugin(Plugin): def refreshCss(self, frame): align = VerticalType.Names[self.settings_tab.location] - frame.evaluateJavaScript(u'update_css("%s,%s,%s,%s,%s")' % (align, - self.settings_tab.font_face, self.settings_tab.font_size, + frame.evaluateJavaScript(u'update_css("%s", "%s", "%s", "%s", "%s")' % + (align, self.settings_tab.font_face, self.settings_tab.font_size, self.settings_tab.font_color, self.settings_tab.bg_color)) From 2f36c33f621496d0850668ca734170357e3cd874 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 16 Oct 2011 09:25:27 +0100 Subject: [PATCH 6/9] Review fixes --- openlp/core/lib/htmlbuilder.py | 2 +- openlp/core/lib/plugin.py | 8 ++++---- openlp/plugins/alerts/alertsplugin.py | 3 +-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/openlp/core/lib/htmlbuilder.py b/openlp/core/lib/htmlbuilder.py index 7d91195a7..863943e40 100644 --- a/openlp/core/lib/htmlbuilder.py +++ b/openlp/core/lib/htmlbuilder.py @@ -338,7 +338,7 @@ def build_html(item, screen, islive, background, image=None, html = HTMLSRC % (build_background_css(item, width, height), width, height, css_additions, - build_footer_css(item, height), + build_footer_css(item, height), build_lyrics_css(item, webkitvers), u'true' if theme and theme.display_slide_transition and islive \ else u'false', diff --git a/openlp/core/lib/plugin.py b/openlp/core/lib/plugin.py index 9a5d2d547..ad6f77116 100644 --- a/openlp/core/lib/plugin.py +++ b/openlp/core/lib/plugin.py @@ -371,25 +371,25 @@ class Plugin(QtCore.QObject): def getDisplayCss(self): """ - Add css style sheets to htmlbuilder + Add css style sheets to htmlbuilder. """ return u'' def getDisplayJavaScript(self): """ - Add javascript functions to htmlbuilder + Add javascript functions to htmlbuilder. """ return u'' def refreshCss(self, frame): """ - Allow plugins to refresh javascript of displayed screen + Allow plugins to refresh javascript on displayed screen. """ return u'' def getDisplayHtml(self): """ - Add html code to htmlbuilder + Add html code to htmlbuilder. """ return u'' diff --git a/openlp/plugins/alerts/alertsplugin.py b/openlp/plugins/alerts/alertsplugin.py index 461525a70..594649e53 100644 --- a/openlp/plugins/alerts/alertsplugin.py +++ b/openlp/plugins/alerts/alertsplugin.py @@ -183,10 +183,9 @@ class AlertsPlugin(Plugin): def getDisplayCss(self): align = VerticalType.Names[self.settings_tab.location] - alert = CSS % (align, self.settings_tab.font_face, + return CSS % (align, self.settings_tab.font_face, self.settings_tab.font_size, self.settings_tab.font_color, self.settings_tab.bg_color) - return alert def getDisplayHtml(self): return HTML From bf2ada0b670679b17ff84700804de16606193165 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 16 Oct 2011 16:39:49 +0100 Subject: [PATCH 7/9] Fix up review comments --- openlp/core/lib/eventreceiver.py | 5 +++++ openlp/core/lib/pluginmanager.py | 3 +++ openlp/core/ui/maindisplay.py | 2 +- openlp/plugins/alerts/alertsplugin.py | 15 +++++++++++++++ openlp/plugins/alerts/lib/alertstab.py | 2 +- 5 files changed, 25 insertions(+), 2 deletions(-) diff --git a/openlp/core/lib/eventreceiver.py b/openlp/core/lib/eventreceiver.py index 1b957e5df..ef21ffde4 100644 --- a/openlp/core/lib/eventreceiver.py +++ b/openlp/core/lib/eventreceiver.py @@ -219,6 +219,11 @@ class EventReceiver(QtCore.QObject): ``cursor_normal`` Resets the cursor to default + + ``maindisplay_css_updated`` + CSS has been updated which needs to be changed on the main display. + + """ def __init__(self): """ diff --git a/openlp/core/lib/pluginmanager.py b/openlp/core/lib/pluginmanager.py index 4b706a4c6..277842167 100644 --- a/openlp/core/lib/pluginmanager.py +++ b/openlp/core/lib/pluginmanager.py @@ -44,6 +44,9 @@ class PluginManager(object): @staticmethod def get_instance(): + """ + Obtain a single instance of class. + """ return PluginManager.instance def __init__(self, plugin_dir): diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index 5e9077e2f..01b616d9d 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -82,7 +82,7 @@ class MainDisplay(QtGui.QGraphicsView): QtCore.SIGNAL(u'openlp_phonon_creation'), self.createMediaObject) QtCore.QObject.connect(Receiver.get_receiver(), - QtCore.SIGNAL(u'css_update'), self.cssChanged) + QtCore.SIGNAL(u'maindisplay_css_updated'), self.cssChanged) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'config_updated'), self.configChanged) diff --git a/openlp/plugins/alerts/alertsplugin.py b/openlp/plugins/alerts/alertsplugin.py index 594649e53..b5a6de8c7 100644 --- a/openlp/plugins/alerts/alertsplugin.py +++ b/openlp/plugins/alerts/alertsplugin.py @@ -179,18 +179,33 @@ class AlertsPlugin(Plugin): } def getDisplayJavaScript(self): + """ + Add Javascript to the main display. + """ return JAVASCRIPT def getDisplayCss(self): + """ + Add CSS to the main display. + """ align = VerticalType.Names[self.settings_tab.location] return CSS % (align, self.settings_tab.font_face, self.settings_tab.font_size, self.settings_tab.font_color, self.settings_tab.bg_color) def getDisplayHtml(self): + """ + Add HTML to the main display. + """ return HTML def refreshCss(self, frame): + """ + Trigger an update of the CSS in the maindisplay. + + `frame` + The Web frame holding the page + """ align = VerticalType.Names[self.settings_tab.location] frame.evaluateJavaScript(u'update_css("%s", "%s", "%s", "%s", "%s")' % (align, self.settings_tab.font_face, self.settings_tab.font_size, diff --git a/openlp/plugins/alerts/lib/alertstab.py b/openlp/plugins/alerts/lib/alertstab.py index 8d709a3b8..3cf3c0ab3 100644 --- a/openlp/plugins/alerts/lib/alertstab.py +++ b/openlp/plugins/alerts/lib/alertstab.py @@ -191,7 +191,7 @@ class AlertsTab(SettingsTab): settings.setValue(u'location', QtCore.QVariant(self.location)) settings.endGroup() if self.changed: - Receiver.send_message(u'css_update') + Receiver.send_message(u'maindisplay_css_updated') self.changed = False def updateDisplay(self): From bdcf15d87ba305e5bf389cf36c9e29ebc9412196 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Mon, 17 Oct 2011 19:01:07 +0100 Subject: [PATCH 8/9] Fix comments --- openlp/core/lib/plugin.py | 3 +++ openlp/plugins/alerts/alertsplugin.py | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/openlp/core/lib/plugin.py b/openlp/core/lib/plugin.py index ad6f77116..0d925f582 100644 --- a/openlp/core/lib/plugin.py +++ b/openlp/core/lib/plugin.py @@ -384,6 +384,9 @@ class Plugin(QtCore.QObject): def refreshCss(self, frame): """ Allow plugins to refresh javascript on displayed screen. + + ``frame`` + The Web frame holding the page. """ return u'' diff --git a/openlp/plugins/alerts/alertsplugin.py b/openlp/plugins/alerts/alertsplugin.py index b5a6de8c7..213c6814f 100644 --- a/openlp/plugins/alerts/alertsplugin.py +++ b/openlp/plugins/alerts/alertsplugin.py @@ -203,8 +203,8 @@ class AlertsPlugin(Plugin): """ Trigger an update of the CSS in the maindisplay. - `frame` - The Web frame holding the page + ``frame`` + The Web frame holding the page. """ align = VerticalType.Names[self.settings_tab.location] frame.evaluateJavaScript(u'update_css("%s", "%s", "%s", "%s", "%s")' % From 4d3dd6dbb5f5e73a19f81da96de0dfd0d6a0c541 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Wed, 19 Oct 2011 18:53:07 +0100 Subject: [PATCH 9/9] Rename signal --- openlp/core/lib/eventreceiver.py | 3 +-- openlp/core/ui/maindisplay.py | 2 +- openlp/plugins/alerts/lib/alertstab.py | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/openlp/core/lib/eventreceiver.py b/openlp/core/lib/eventreceiver.py index ef21ffde4..2d4134ee3 100644 --- a/openlp/core/lib/eventreceiver.py +++ b/openlp/core/lib/eventreceiver.py @@ -219,8 +219,7 @@ class EventReceiver(QtCore.QObject): ``cursor_normal`` Resets the cursor to default - - ``maindisplay_css_updated`` + ``update_display_css`` CSS has been updated which needs to be changed on the main display. diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index 01b616d9d..dafda8ccf 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -82,7 +82,7 @@ class MainDisplay(QtGui.QGraphicsView): QtCore.SIGNAL(u'openlp_phonon_creation'), self.createMediaObject) QtCore.QObject.connect(Receiver.get_receiver(), - QtCore.SIGNAL(u'maindisplay_css_updated'), self.cssChanged) + QtCore.SIGNAL(u'update_display_css'), self.cssChanged) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'config_updated'), self.configChanged) diff --git a/openlp/plugins/alerts/lib/alertstab.py b/openlp/plugins/alerts/lib/alertstab.py index 3cf3c0ab3..8720c5111 100644 --- a/openlp/plugins/alerts/lib/alertstab.py +++ b/openlp/plugins/alerts/lib/alertstab.py @@ -191,7 +191,7 @@ class AlertsTab(SettingsTab): settings.setValue(u'location', QtCore.QVariant(self.location)) settings.endGroup() if self.changed: - Receiver.send_message(u'maindisplay_css_updated') + Receiver.send_message(u'update_display_css') self.changed = False def updateDisplay(self):