mirror of https://gitlab.com/openlp/openlp.git
More cleanups and start of updates
This commit is contained in:
parent
bb8b0cd435
commit
9652a690b3
|
@ -289,7 +289,7 @@ sup {
|
|||
</html>
|
||||
"""
|
||||
|
||||
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',
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue