forked from openlp/openlp
Head
This commit is contained in:
commit
90cc812592
@ -34,8 +34,8 @@ from openlp.core.lib.theme import BackgroundType, BackgroundGradientType, \
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
# FIXME: Add html5 doctype. However, do not break theme gradients.
|
||||
HTMLSRC = u"""
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>OpenLP Display</title>
|
||||
@ -404,7 +404,7 @@ def build_background_css(item, width, height):
|
||||
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 +412,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 +420,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):
|
||||
@ -557,11 +558,15 @@ def build_lyrics_format_css(theme, width, height):
|
||||
left_margin = int(theme.font_main_outline_size) * 2
|
||||
else:
|
||||
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; ' \
|
||||
'font-size: %spt; color: %s; line-height: %d%%; margin: 0;' \
|
||||
'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),
|
||||
left_margin, width, height)
|
||||
if theme.font_main_outline:
|
||||
|
@ -44,6 +44,7 @@ VERSE = u'The Lord said to {r}Noah{/r}: \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{/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']
|
||||
|
||||
class Renderer(object):
|
||||
@ -190,7 +191,7 @@ class Renderer(object):
|
||||
serviceItem.theme = theme_data
|
||||
if self.force_page:
|
||||
# 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:
|
||||
self.imageManager.del_image(theme_data.theme_name)
|
||||
serviceItem.add_from_text(u'', VERSE)
|
||||
@ -224,14 +225,10 @@ class Renderer(object):
|
||||
# Bibles
|
||||
if item.is_capable(ItemCapabilities.CanWordSplit):
|
||||
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
|
||||
if item.is_capable(ItemCapabilities.CanSoftBreak) and \
|
||||
len(pages) > 1 and u'[---]' in text:
|
||||
elif item.is_capable(ItemCapabilities.CanSoftBreak):
|
||||
pages = []
|
||||
if u'[---]' in text:
|
||||
while True:
|
||||
slides = text.split(u'\n[---]\n', 2)
|
||||
# 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')
|
||||
pages.extend(self._paginate_slide(lines, line_end))
|
||||
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 = []
|
||||
for page in pages:
|
||||
while page.endswith(u'<br>'):
|
||||
@ -585,12 +587,3 @@ class Renderer(object):
|
||||
# this parse we are to be wordy
|
||||
line = line.replace(u'\n', 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')
|
||||
|
@ -176,8 +176,9 @@ class HorizontalType(object):
|
||||
Left = 0
|
||||
Right = 1
|
||||
Center = 2
|
||||
Justify = 3
|
||||
|
||||
Names = [u'left', u'right', u'center']
|
||||
Names = [u'left', u'right', u'center', u'justify']
|
||||
|
||||
|
||||
class VerticalType(object):
|
||||
|
@ -246,7 +246,7 @@ class Ui_ThemeWizard(object):
|
||||
self.horizontalLabel = QtGui.QLabel(self.alignmentPage)
|
||||
self.horizontalLabel.setObjectName(u'HorizontalLabel')
|
||||
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.alignmentLayout.addRow(self.horizontalLabel,
|
||||
self.horizontalComboBox)
|
||||
@ -495,6 +495,8 @@ class Ui_ThemeWizard(object):
|
||||
translate('OpenLP.ThemeWizard', 'Right'))
|
||||
self.horizontalComboBox.setItemText(HorizontalType.Center,
|
||||
translate('OpenLP.ThemeWizard', 'Center'))
|
||||
self.horizontalComboBox.setItemText(HorizontalType.Justify,
|
||||
translate('OpenLP.ThemeWizard', 'Justify'))
|
||||
self.transitionsLabel.setText(
|
||||
translate('OpenLP.ThemeWizard', 'Transitions:'))
|
||||
self.areaPositionPage.setTitle(
|
||||
|
Loading…
Reference in New Issue
Block a user