forked from openlp/openlp
- improved render performance for service items with the CanSoftBreak capability
- added HTML5 doctype bzr-revno: 1763
This commit is contained in:
commit
d27a75287f
@ -34,8 +34,8 @@ from openlp.core.lib.theme import BackgroundType, BackgroundGradientType, \
|
|||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
# FIXME: Add html5 doctype. However, do not break theme gradients.
|
|
||||||
HTMLSRC = u"""
|
HTMLSRC = u"""
|
||||||
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>OpenLP Display</title>
|
<title>OpenLP Display</title>
|
||||||
@ -404,7 +404,7 @@ def build_background_css(item, width, height):
|
|||||||
background = \
|
background = \
|
||||||
u'background: ' \
|
u'background: ' \
|
||||||
u'-webkit-gradient(linear, left top, left bottom, ' \
|
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)
|
theme.background_end_color)
|
||||||
elif theme.background_direction == \
|
elif theme.background_direction == \
|
||||||
BackgroundGradientType.to_string( \
|
BackgroundGradientType.to_string( \
|
||||||
@ -412,7 +412,7 @@ def build_background_css(item, width, height):
|
|||||||
background = \
|
background = \
|
||||||
u'background: ' \
|
u'background: ' \
|
||||||
u'-webkit-gradient(linear, left top, right bottom, ' \
|
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)
|
theme.background_end_color)
|
||||||
elif theme.background_direction == \
|
elif theme.background_direction == \
|
||||||
BackgroundGradientType.to_string \
|
BackgroundGradientType.to_string \
|
||||||
@ -420,20 +420,21 @@ def build_background_css(item, width, height):
|
|||||||
background = \
|
background = \
|
||||||
u'background: ' \
|
u'background: ' \
|
||||||
u'-webkit-gradient(linear, left bottom, right top, ' \
|
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)
|
theme.background_end_color)
|
||||||
elif theme.background_direction == \
|
elif theme.background_direction == \
|
||||||
BackgroundGradientType.to_string \
|
BackgroundGradientType.to_string \
|
||||||
(BackgroundGradientType.Vertical):
|
(BackgroundGradientType.Vertical):
|
||||||
background = \
|
background = \
|
||||||
u'background: -webkit-gradient(linear, left top, ' \
|
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)
|
(theme.background_start_color, theme.background_end_color)
|
||||||
else:
|
else:
|
||||||
background = \
|
background = \
|
||||||
u'background: -webkit-gradient(radial, %s 50%%, 100, %s ' \
|
u'background: -webkit-gradient(radial, %s 50%%, 100, %s ' \
|
||||||
u'50%%, %s, from(%s), to(%s))' % (width, width, width,
|
u'50%%, %s, from(%s), to(%s)) fixed' % (width, width,
|
||||||
theme.background_start_color, theme.background_end_color)
|
width, theme.background_start_color,
|
||||||
|
theme.background_end_color)
|
||||||
return background
|
return background
|
||||||
|
|
||||||
def build_lyrics_css(item, webkitvers):
|
def build_lyrics_css(item, webkitvers):
|
||||||
|
@ -224,14 +224,10 @@ class Renderer(object):
|
|||||||
# Bibles
|
# Bibles
|
||||||
if item.is_capable(ItemCapabilities.CanWordSplit):
|
if item.is_capable(ItemCapabilities.CanWordSplit):
|
||||||
pages = self._paginate_slide_words(text.split(u'\n'), line_end)
|
pages = self._paginate_slide_words(text.split(u'\n'), line_end)
|
||||||
else:
|
# Songs and Custom
|
||||||
# Clean up line endings.
|
elif item.is_capable(ItemCapabilities.CanSoftBreak):
|
||||||
lines = self._lines_split(text)
|
pages = []
|
||||||
pages = self._paginate_slide(lines, line_end)
|
if u'[---]' in text:
|
||||||
# Songs and Custom
|
|
||||||
if item.is_capable(ItemCapabilities.CanSoftBreak) and \
|
|
||||||
len(pages) > 1 and u'[---]' in text:
|
|
||||||
pages = []
|
|
||||||
while True:
|
while True:
|
||||||
slides = text.split(u'\n[---]\n', 2)
|
slides = text.split(u'\n[---]\n', 2)
|
||||||
# If there are (at least) two occurrences of [---] we use
|
# If there are (at least) two occurrences of [---] we use
|
||||||
@ -272,6 +268,11 @@ class Renderer(object):
|
|||||||
lines = text.strip(u'\n').split(u'\n')
|
lines = text.strip(u'\n').split(u'\n')
|
||||||
pages.extend(self._paginate_slide(lines, line_end))
|
pages.extend(self._paginate_slide(lines, line_end))
|
||||||
break
|
break
|
||||||
|
else:
|
||||||
|
# Clean up line endings.
|
||||||
|
pages = self._paginate_slide(text.split(u'\n'), line_end)
|
||||||
|
else:
|
||||||
|
pages = self._paginate_slide(text.split(u'\n'), line_end)
|
||||||
new_pages = []
|
new_pages = []
|
||||||
for page in pages:
|
for page in pages:
|
||||||
while page.endswith(u'<br>'):
|
while page.endswith(u'<br>'):
|
||||||
@ -585,12 +586,3 @@ class Renderer(object):
|
|||||||
# this parse we are to be wordy
|
# this parse we are to be wordy
|
||||||
line = line.replace(u'\n', u' ')
|
line = line.replace(u'\n', u' ')
|
||||||
return line.split(u' ')
|
return line.split(u' ')
|
||||||
|
|
||||||
def _lines_split(self, text):
|
|
||||||
"""
|
|
||||||
Split the slide up by physical line
|
|
||||||
"""
|
|
||||||
# this parse we do not want to use this so remove it
|
|
||||||
text = text.replace(u'\n[---]', u'')
|
|
||||||
text = text.replace(u'[---]', u'')
|
|
||||||
return text.split(u'\n')
|
|
||||||
|
Loading…
Reference in New Issue
Block a user