This commit is contained in:
Tim Bentley 2011-09-27 05:59:50 +01:00
commit 90cc812592
4 changed files with 30 additions and 29 deletions

View File

@ -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):
@ -557,11 +558,15 @@ def build_lyrics_format_css(theme, width, height):
left_margin = int(theme.font_main_outline_size) * 2 left_margin = int(theme.font_main_outline_size) * 2
else: else:
left_margin = 0 left_margin = 0
lyrics = u'white-space:pre-wrap; word-wrap: break-word; ' \ justify = u'white-space:pre-wrap;'
# fix tag incompatibilities
if theme.display_horizontal_align == HorizontalType.Justify:
justify = u''
lyrics = u'%s word-wrap: break-word; ' \
'text-align: %s; vertical-align: %s; font-family: %s; ' \ 'text-align: %s; vertical-align: %s; font-family: %s; ' \
'font-size: %spt; color: %s; line-height: %d%%; margin: 0;' \ 'font-size: %spt; color: %s; line-height: %d%%; margin: 0;' \
'padding: 0; padding-left: %spx; width: %spx; height: %spx; ' % \ 'padding: 0; padding-left: %spx; width: %spx; height: %spx; ' % \
(align, valign, theme.font_main_name, theme.font_main_size, (justify, align, valign, theme.font_main_name, theme.font_main_size,
theme.font_main_color, 100 + int(theme.font_main_line_adjustment), theme.font_main_color, 100 + int(theme.font_main_line_adjustment),
left_margin, width, height) left_margin, width, height)
if theme.font_main_outline: if theme.font_main_outline:

View File

@ -44,6 +44,7 @@ VERSE = u'The Lord said to {r}Noah{/r}: \n' \
'Get those children out of the muddy, muddy \n' \ 'Get those children out of the muddy, muddy \n' \
'{r}C{/r}{b}h{/b}{bl}i{/bl}{y}l{/y}{g}d{/g}{pk}' \ '{r}C{/r}{b}h{/b}{bl}i{/bl}{y}l{/y}{g}d{/g}{pk}' \
'r{/pk}{o}e{/o}{pp}n{/pp} of the Lord\n' 'r{/pk}{o}e{/o}{pp}n{/pp} of the Lord\n'
VERSE_FOR_LINE_COUNT = u'\n'.join(map(unicode, xrange(50)))
FOOTER = [u'Arky Arky (Unknown)', u'Public Domain', u'CCLI 123456'] FOOTER = [u'Arky Arky (Unknown)', u'Public Domain', u'CCLI 123456']
class Renderer(object): class Renderer(object):
@ -190,7 +191,7 @@ class Renderer(object):
serviceItem.theme = theme_data serviceItem.theme = theme_data
if self.force_page: if self.force_page:
# make big page for theme edit dialog to get line count # make big page for theme edit dialog to get line count
serviceItem.add_from_text(u'', VERSE + VERSE + VERSE) serviceItem.add_from_text(u'', VERSE_FOR_LINE_COUNT)
else: else:
self.imageManager.del_image(theme_data.theme_name) self.imageManager.del_image(theme_data.theme_name)
serviceItem.add_from_text(u'', VERSE) serviceItem.add_from_text(u'', VERSE)
@ -224,14 +225,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:
# Clean up line endings.
lines = self._lines_split(text)
pages = self._paginate_slide(lines, line_end)
# Songs and Custom # Songs and Custom
if item.is_capable(ItemCapabilities.CanSoftBreak) and \ elif item.is_capable(ItemCapabilities.CanSoftBreak):
len(pages) > 1 and u'[---]' in text:
pages = [] pages = []
if u'[---]' in text:
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 +269,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 +587,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')

View File

@ -176,8 +176,9 @@ class HorizontalType(object):
Left = 0 Left = 0
Right = 1 Right = 1
Center = 2 Center = 2
Justify = 3
Names = [u'left', u'right', u'center'] Names = [u'left', u'right', u'center', u'justify']
class VerticalType(object): class VerticalType(object):

View File

@ -246,7 +246,7 @@ class Ui_ThemeWizard(object):
self.horizontalLabel = QtGui.QLabel(self.alignmentPage) self.horizontalLabel = QtGui.QLabel(self.alignmentPage)
self.horizontalLabel.setObjectName(u'HorizontalLabel') self.horizontalLabel.setObjectName(u'HorizontalLabel')
self.horizontalComboBox = QtGui.QComboBox(self.alignmentPage) self.horizontalComboBox = QtGui.QComboBox(self.alignmentPage)
self.horizontalComboBox.addItems([u'', u'', u'']) self.horizontalComboBox.addItems([u'', u'', u'', u''])
self.horizontalComboBox.setObjectName(u'HorizontalComboBox') self.horizontalComboBox.setObjectName(u'HorizontalComboBox')
self.alignmentLayout.addRow(self.horizontalLabel, self.alignmentLayout.addRow(self.horizontalLabel,
self.horizontalComboBox) self.horizontalComboBox)
@ -495,6 +495,8 @@ class Ui_ThemeWizard(object):
translate('OpenLP.ThemeWizard', 'Right')) translate('OpenLP.ThemeWizard', 'Right'))
self.horizontalComboBox.setItemText(HorizontalType.Center, self.horizontalComboBox.setItemText(HorizontalType.Center,
translate('OpenLP.ThemeWizard', 'Center')) translate('OpenLP.ThemeWizard', 'Center'))
self.horizontalComboBox.setItemText(HorizontalType.Justify,
translate('OpenLP.ThemeWizard', 'Justify'))
self.transitionsLabel.setText( self.transitionsLabel.setText(
translate('OpenLP.ThemeWizard', 'Transitions:')) translate('OpenLP.ThemeWizard', 'Transitions:'))
self.areaPositionPage.setTitle( self.areaPositionPage.setTitle(