forked from openlp/openlp
fixed ticket 729 and fixed variables to camelCase
This commit is contained in:
parent
e0c5fabc5a
commit
1f5ac7f483
@ -130,6 +130,7 @@ class MainDisplay(Display):
|
|||||||
else:
|
else:
|
||||||
self.audioPlayer = None
|
self.audioPlayer = None
|
||||||
self.firstTime = True
|
self.firstTime = True
|
||||||
|
self.webLoaded = True
|
||||||
self.setStyleSheet(u'border: 0px; margin: 0px; padding: 0px;')
|
self.setStyleSheet(u'border: 0px; margin: 0px; padding: 0px;')
|
||||||
windowFlags = QtCore.Qt.FramelessWindowHint | QtCore.Qt.Tool | \
|
windowFlags = QtCore.Qt.FramelessWindowHint | QtCore.Qt.Tool | \
|
||||||
QtCore.Qt.WindowStaysOnTopHint
|
QtCore.Qt.WindowStaysOnTopHint
|
||||||
@ -194,27 +195,27 @@ class MainDisplay(Display):
|
|||||||
Display.setup(self)
|
Display.setup(self)
|
||||||
if self.isLive:
|
if self.isLive:
|
||||||
# Build the initial frame.
|
# Build the initial frame.
|
||||||
image_file = Settings().value(u'advanced/default image',
|
backgroundColor = QtGui.QColor()
|
||||||
QtCore.QVariant(u':/graphics/openlp-splash-screen.png'))\
|
backgroundColor.setNamedColor(Settings().value(
|
||||||
.toString()
|
|
||||||
background_color = QtGui.QColor()
|
|
||||||
background_color.setNamedColor(Settings().value(
|
|
||||||
u'advanced/default color',
|
u'advanced/default color',
|
||||||
QtCore.QVariant(u'#ffffff')).toString())
|
QtCore.QVariant(u'#ffffff')).toString())
|
||||||
if not background_color.isValid():
|
if not backgroundColor.isValid():
|
||||||
background_color = QtCore.Qt.white
|
backgroundColor = QtCore.Qt.white
|
||||||
splash_image = QtGui.QImage(image_file)
|
imageFile = Settings().value(u'advanced/default image',
|
||||||
|
QtCore.QVariant(u':/graphics/openlp-splash-screen.png'))\
|
||||||
|
.toString()
|
||||||
|
splashImage = QtGui.QImage(imageFile)
|
||||||
self.initialFrame = QtGui.QImage(
|
self.initialFrame = QtGui.QImage(
|
||||||
self.screen[u'size'].width(),
|
self.screen[u'size'].width(),
|
||||||
self.screen[u'size'].height(),
|
self.screen[u'size'].height(),
|
||||||
QtGui.QImage.Format_ARGB32_Premultiplied)
|
QtGui.QImage.Format_ARGB32_Premultiplied)
|
||||||
painter_image = QtGui.QPainter()
|
painterImage = QtGui.QPainter()
|
||||||
painter_image.begin(self.initialFrame)
|
painterImage.begin(self.initialFrame)
|
||||||
painter_image.fillRect(self.initialFrame.rect(), background_color)
|
painterImage.fillRect(self.initialFrame.rect(), backgroundColor)
|
||||||
painter_image.drawImage(
|
painterImage.drawImage(
|
||||||
(self.screen[u'size'].width() - splash_image.width()) / 2,
|
(self.screen[u'size'].width() - splashImage.width()) / 2,
|
||||||
(self.screen[u'size'].height() - splash_image.height()) / 2,
|
(self.screen[u'size'].height() - splashImage.height()) / 2,
|
||||||
splash_image)
|
splashImage)
|
||||||
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,
|
||||||
@ -247,27 +248,27 @@ class MainDisplay(Display):
|
|||||||
log.debug(u'alert to display')
|
log.debug(u'alert to display')
|
||||||
# First we convert <>& marks to html variants, then apply
|
# First we convert <>& marks to html variants, then apply
|
||||||
# formattingtags, finally we double all backslashes for JavaScript.
|
# formattingtags, finally we double all backslashes for JavaScript.
|
||||||
text_prepared = expand_tags(
|
textPrepared = expand_tags(
|
||||||
cgi.escape(text)).replace(u'\\', u'\\\\').replace(u'\"', u'\\\"')
|
cgi.escape(text)).replace(u'\\', u'\\\\').replace(u'\"', u'\\\"')
|
||||||
if self.height() != self.screen[u'size'].height() or not \
|
if self.height() != self.screen[u'size'].height() or not \
|
||||||
self.isVisible():
|
self.isVisible():
|
||||||
shrink = True
|
shrink = True
|
||||||
js = u'show_alert("%s", "%s")' % (text_prepared, u'top')
|
js = u'show_alert("%s", "%s")' % (textPrepared, u'top')
|
||||||
else:
|
else:
|
||||||
shrink = False
|
shrink = False
|
||||||
js = u'show_alert("%s", "")' % text_prepared
|
js = u'show_alert("%s", "")' % textPrepared
|
||||||
height = self.frame.evaluateJavaScript(js)
|
height = self.frame.evaluateJavaScript(js)
|
||||||
if shrink:
|
if shrink:
|
||||||
if text:
|
if text:
|
||||||
alert_height = int(height.toString())
|
alertHeight = int(height.toString())
|
||||||
self.resize(self.width(), alert_height)
|
self.resize(self.width(), alertHeight)
|
||||||
self.setVisible(True)
|
self.setVisible(True)
|
||||||
if location == AlertLocation.Middle:
|
if location == AlertLocation.Middle:
|
||||||
self.move(self.screen[u'size'].left(),
|
self.move(self.screen[u'size'].left(),
|
||||||
(self.screen[u'size'].height() - alert_height) / 2)
|
(self.screen[u'size'].height() - alertHeight) / 2)
|
||||||
elif location == AlertLocation.Bottom:
|
elif location == AlertLocation.Bottom:
|
||||||
self.move(self.screen[u'size'].left(),
|
self.move(self.screen[u'size'].left(),
|
||||||
self.screen[u'size'].height() - alert_height)
|
self.screen[u'size'].height() - alertHeight)
|
||||||
else:
|
else:
|
||||||
self.setVisible(False)
|
self.setVisible(False)
|
||||||
self.setGeometry(self.screen[u'size'])
|
self.setGeometry(self.screen[u'size'])
|
||||||
@ -360,8 +361,8 @@ class MainDisplay(Display):
|
|||||||
|
|
||||||
def buildHtml(self, serviceItem, image=None):
|
def buildHtml(self, serviceItem, image=None):
|
||||||
"""
|
"""
|
||||||
Store the serviceItem and build the new HTML from it. Add the
|
Store the serviceItem and build the new HTML from it. Add the HTML to
|
||||||
HTML to the display
|
the display.
|
||||||
"""
|
"""
|
||||||
log.debug(u'buildHtml')
|
log.debug(u'buildHtml')
|
||||||
self.webLoaded = False
|
self.webLoaded = False
|
||||||
@ -388,11 +389,11 @@ class MainDisplay(Display):
|
|||||||
self.serviceItem.bg_image_bytes = self.imageManager. \
|
self.serviceItem.bg_image_bytes = self.imageManager. \
|
||||||
getImageBytes(self.serviceItem.themedata.theme_name)
|
getImageBytes(self.serviceItem.themedata.theme_name)
|
||||||
if image:
|
if image:
|
||||||
image_bytes = self.imageManager.getImageBytes(image)
|
imageBytes = self.imageManager.getImageBytes(image)
|
||||||
else:
|
else:
|
||||||
image_bytes = None
|
imageBytes = None
|
||||||
html = build_html(self.serviceItem, self.screen, self.isLive,
|
html = build_html(self.serviceItem, self.screen, self.isLive,
|
||||||
background, image_bytes, self.plugins)
|
background, imageBytes, self.plugins)
|
||||||
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')
|
||||||
|
Loading…
Reference in New Issue
Block a user