forked from openlp/openlp
Alerts now work
This commit is contained in:
parent
f3e62c9f14
commit
821911503e
@ -47,9 +47,9 @@ HTMLSRC = u"""
|
||||
var t = null;
|
||||
var transition = %s;
|
||||
|
||||
function displayAlert(alert){
|
||||
function displayAlert(alerttext){
|
||||
var text1 = document.getElementById('alertmain');
|
||||
text1.innerHTML = alert;
|
||||
text1.innerHTML = alerttext;
|
||||
}
|
||||
|
||||
function startfade(newtext){
|
||||
@ -136,7 +136,9 @@ HTMLSRC = u"""
|
||||
<tr><td id="lyricsshadow2" class="lyricsshadow lyrics"></td></tr>
|
||||
</table>
|
||||
<table class="alerttable">
|
||||
<tr><td id="alertmain" class="alert"></td></tr>
|
||||
<tr><td class="alertcell">
|
||||
<div class="alert" id="alertmain"></div>
|
||||
</td></tr>
|
||||
</table>
|
||||
<div id="footer" class="footer"></div>
|
||||
<video id="video"></video>
|
||||
@ -342,22 +344,24 @@ def build_alert(width, height, alertTab):
|
||||
"""
|
||||
style = """
|
||||
.alerttable { position: absolute; z-index:8; left 0px; top 0px; %s }
|
||||
.alertcell { %s }
|
||||
.alert { %s }
|
||||
table {border=0; margin=0; padding=0; }
|
||||
"""
|
||||
alertcommon = u''
|
||||
valign = u''
|
||||
alerttable = u''
|
||||
alertcell = u''
|
||||
alert = u''
|
||||
if alertTab:
|
||||
alertcommon = u'width: %spx; height: %spx; ' \
|
||||
u'font-family %s; font-size: %spx; color: %s; ' % \
|
||||
(width, height, alertTab.font_face, alertTab.font_size,
|
||||
alertTab.bg_color)
|
||||
if alertTab.location == 2:
|
||||
valign = u'vertical-align:bottom;'
|
||||
alertcell = u'vertical-align:bottom;'
|
||||
elif alertTab.location == 1:
|
||||
valign = u'vertical-align:middle;'
|
||||
alertcell = u'vertical-align:middle;'
|
||||
else:
|
||||
valign = u'vertical-align:top;'
|
||||
alert_html = style % (alertcommon, valign)
|
||||
alertcell = u'vertical-align:top;'
|
||||
alerttable = u'width: %spx; height: %spx; ' % (width, height)
|
||||
alert = u'font-family %s; font-size: %spx; color: %s; ' \
|
||||
u'background-color: %s' % \
|
||||
(alertTab.font_face, alertTab.font_size, alertTab.font_color,
|
||||
alertTab.bg_color)
|
||||
alert_html = style % (alerttable, alertcell, alert)
|
||||
print alert_html
|
||||
return alert_html
|
||||
|
@ -146,7 +146,7 @@ class MainDisplay(DisplayWidget):
|
||||
splash_image)
|
||||
serviceItem = ServiceItem()
|
||||
serviceItem.bg_frame = initialFrame
|
||||
self.webView.setHtml(build_html(serviceItem, self.screen, None))
|
||||
self.webView.setHtml(build_html(serviceItem, self.screen, self.parent.alertTab))
|
||||
self.show()
|
||||
# To display or not to display?
|
||||
if not self.screen[u'primary']:
|
||||
@ -175,8 +175,10 @@ class MainDisplay(DisplayWidget):
|
||||
The slide text to be displayed
|
||||
"""
|
||||
log.debug(u'alert')
|
||||
self.frame.evaluateJavaScript("displayAlert('" +
|
||||
text.replace("\\", "\\\\").replace("\'", "\\\'") + "')")
|
||||
js = "displayAlert('" + \
|
||||
text.replace("\\", "\\\\").replace("\'", "\\\'") + "')"
|
||||
print js
|
||||
self.frame.evaluateJavaScript(js)
|
||||
|
||||
def image(self, image):
|
||||
"""
|
||||
|
@ -32,15 +32,6 @@ from openlp.core.lib import Receiver, translate
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
HTMLCODE = u"""
|
||||
<p style=\"color:%s;
|
||||
background-color:%s;
|
||||
font-family:%s;
|
||||
font-size: %spt; \">
|
||||
%s
|
||||
</p>
|
||||
"""
|
||||
|
||||
class AlertsManager(QtCore.QObject):
|
||||
"""
|
||||
AlertsTab is the Alerts settings tab in the settings dialog.
|
||||
@ -94,8 +85,6 @@ class AlertsManager(QtCore.QObject):
|
||||
return
|
||||
text = self.alertList.pop(0)
|
||||
alertTab = self.parent.alertsTab
|
||||
text = HTMLCODE % (alertTab.font_color, alertTab.bg_color,
|
||||
alertTab.font_face, alertTab.font_size, text)
|
||||
self.parent.liveController.display.alert(text)
|
||||
# check to see if we have a timer running
|
||||
if self.timer_id == 0:
|
||||
|
Loading…
Reference in New Issue
Block a user