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