try to fix gradient when using html5 doctype

This commit is contained in:
Andreas Preikschat 2011-08-24 10:34:15 +02:00
parent 948f166e06
commit 50b820af4e
2 changed files with 11 additions and 8 deletions

View File

@ -36,6 +36,7 @@ log = logging.getLogger(__name__)
# FIXME: Add html5 doctype. However, do not break theme gradients.
HTMLSRC = u"""
<!DOCTYPE html>
<html>
<head>
<title>OpenLP Display</title>
@ -393,18 +394,18 @@ def build_background_css(item, width, height):
"""
width = int(width) / 2
theme = item.themedata
background = u'background-color: black'
background = u'background-color: black;'
if theme:
if theme.background_type == \
BackgroundType.to_string(BackgroundType.Solid):
background = u'background-color: %s' % theme.background_color
background = u'background-color: %s;' % theme.background_color
else:
if theme.background_direction == BackgroundGradientType.to_string \
(BackgroundGradientType.Horizontal):
background = \
u'background: ' \
u'-webkit-gradient(linear, left top, left bottom, ' \
'from(%s), to(%s))' % (theme.background_start_color,
'from(%s), to(%s)) fixed;' % (theme.background_start_color,
theme.background_end_color)
elif theme.background_direction == \
BackgroundGradientType.to_string( \
@ -412,7 +413,7 @@ def build_background_css(item, width, height):
background = \
u'background: ' \
u'-webkit-gradient(linear, left top, right bottom, ' \
'from(%s), to(%s))' % (theme.background_start_color,
'from(%s), to(%s)) fixed;' % (theme.background_start_color,
theme.background_end_color)
elif theme.background_direction == \
BackgroundGradientType.to_string \
@ -420,20 +421,21 @@ def build_background_css(item, width, height):
background = \
u'background: ' \
u'-webkit-gradient(linear, left bottom, right top, ' \
'from(%s), to(%s))' % (theme.background_start_color,
'from(%s), to(%s)) fixed;' % (theme.background_start_color,
theme.background_end_color)
elif theme.background_direction == \
BackgroundGradientType.to_string \
(BackgroundGradientType.Vertical):
background = \
u'background: -webkit-gradient(linear, left top, ' \
u'right top, from(%s), to(%s))' % \
u'right top, from(%s), to(%s)) fixed;' % \
(theme.background_start_color, theme.background_end_color)
else:
background = \
u'background: -webkit-gradient(radial, %s 50%%, 100, %s ' \
u'50%%, %s, from(%s), to(%s))' % (width, width, width,
theme.background_start_color, theme.background_end_color)
u'50%%, %s, from(%s), to(%s)) fixed;' % (width, width,
width, theme.background_start_color,
theme.background_end_color)
return background
def build_lyrics_css(item, webkitvers):

View File

@ -103,6 +103,7 @@ class MainDisplay(QtGui.QGraphicsView):
self.createMediaObject()
log.debug(u'Setup webView')
self.webView = QtWebKit.QWebView(self)
self.webView.settings().setAttribute(7, True)
self.webView.setGeometry(0, 0,
self.screen[u'size'].width(), self.screen[u'size'].height())
self.page = self.webView.page()