forked from openlp/openlp
renames
This commit is contained in:
parent
9b4518467a
commit
8ee3e7265c
|
@ -211,8 +211,7 @@ def build_html(item, screen, is_live, background, image=None, plugins=None):
|
||||||
"""
|
"""
|
||||||
width = screen[u'size'].width()
|
width = screen[u'size'].width()
|
||||||
height = screen[u'size'].height()
|
height = screen[u'size'].height()
|
||||||
theme = item.themedata
|
theme_data = item.themedata
|
||||||
webkit_ver = webkit_version()
|
|
||||||
# Image generated and poked in
|
# Image generated and poked in
|
||||||
if background:
|
if background:
|
||||||
bgimage_src = u'src="data:image/png;base64,%s"' % background
|
bgimage_src = u'src="data:image/png;base64,%s"' % background
|
||||||
|
@ -236,10 +235,11 @@ def build_html(item, screen, is_live, background, image=None, plugins=None):
|
||||||
build_background_css(item, width),
|
build_background_css(item, width),
|
||||||
css_additions,
|
css_additions,
|
||||||
build_footer_css(item, height),
|
build_footer_css(item, height),
|
||||||
build_lyrics_css(item, webkit_ver),
|
build_lyrics_css(item),
|
||||||
u'true' if theme and theme.display_slide_transition and is_live else u'false',
|
u'true' if theme_data and theme_data.display_slide_transition and is_live else u'false',
|
||||||
js_additions,
|
js_additions,
|
||||||
bgimage_src, image_src,
|
bgimage_src,
|
||||||
|
image_src,
|
||||||
html_additions
|
html_additions
|
||||||
)
|
)
|
||||||
return html
|
return html
|
||||||
|
@ -291,16 +291,13 @@ def build_background_css(item, width):
|
||||||
return background
|
return background
|
||||||
|
|
||||||
|
|
||||||
def build_lyrics_css(item, webkit_ver):
|
def build_lyrics_css(item):
|
||||||
"""
|
"""
|
||||||
Build the lyrics display css
|
Build the lyrics display css
|
||||||
|
|
||||||
``item``
|
``item``
|
||||||
Service Item containing theme and location information
|
Service Item containing theme and location information
|
||||||
|
|
||||||
``webkitvers``
|
|
||||||
The version of qtwebkit we're using
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
style = u"""
|
style = u"""
|
||||||
.lyricstable {
|
.lyricstable {
|
||||||
|
@ -319,55 +316,41 @@ def build_lyrics_css(item, webkit_ver):
|
||||||
%s
|
%s
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
theme = item.themedata
|
theme_data = item.themedata
|
||||||
lyricstable = u''
|
lyricstable = u''
|
||||||
lyrics = u''
|
lyrics = u''
|
||||||
lyricsmain = u''
|
lyricsmain = u''
|
||||||
if theme and item.main:
|
if theme_data and item.main:
|
||||||
lyricstable = u'left: %spx; top: %spx;' % (item.main.x(), item.main.y())
|
lyricstable = u'left: %spx; top: %spx;' % (item.main.x(), item.main.y())
|
||||||
lyrics = build_lyrics_format_css(theme, item.main.width(), item.main.height())
|
lyrics = build_lyrics_format_css(theme_data, item.main.width(), item.main.height())
|
||||||
lyricsmain += build_lyrics_outline_css(theme)
|
lyricsmain += build_lyrics_outline_css(theme_data)
|
||||||
if theme.font_main_shadow:
|
if theme_data.font_main_shadow:
|
||||||
if theme.font_main_outline and webkit_ver <= 534.3:
|
lyricsmain += u' text-shadow: %s %spx %spx;' % \
|
||||||
shadow = u'padding-left: %spx; padding-top: %spx;' % \
|
(theme_data.font_main_shadow_color, theme_data.font_main_shadow_size, theme_data.font_main_shadow_size)
|
||||||
(int(theme.font_main_shadow_size) + (int(theme.font_main_outline_size) * 2),
|
|
||||||
theme.font_main_shadow_size)
|
|
||||||
shadow += build_lyrics_outline_css(theme, True)
|
|
||||||
else:
|
|
||||||
lyricsmain += u' text-shadow: %s %spx %spx;' % \
|
|
||||||
(theme.font_main_shadow_color, theme.font_main_shadow_size, theme.font_main_shadow_size)
|
|
||||||
lyrics_css = style % (lyricstable, lyrics, lyricsmain)
|
lyrics_css = style % (lyricstable, lyrics, lyricsmain)
|
||||||
return lyrics_css
|
return lyrics_css
|
||||||
|
|
||||||
|
|
||||||
def build_lyrics_outline_css(theme, is_shadow=False):
|
def build_lyrics_outline_css(theme_data):
|
||||||
"""
|
"""
|
||||||
Build the css which controls the theme outline. Also used by renderer for splitting verses
|
Build the css which controls the theme outline. Also used by renderer for splitting verses
|
||||||
|
|
||||||
``theme``
|
``theme_data``
|
||||||
Object containing theme information
|
Object containing theme information
|
||||||
|
|
||||||
``is_shadow``
|
|
||||||
If true, use the shadow colors instead
|
|
||||||
"""
|
"""
|
||||||
if theme.font_main_outline:
|
if theme_data.font_main_outline:
|
||||||
size = float(theme.font_main_outline_size) / 16
|
size = float(theme_data.font_main_outline_size) / 16
|
||||||
if is_shadow:
|
fill_color = theme_data.font_main_color
|
||||||
fill_color = theme.font_main_shadow_color
|
outline_color = theme_data.font_main_outline_color
|
||||||
outline_color = theme.font_main_shadow_color
|
|
||||||
else:
|
|
||||||
fill_color = theme.font_main_color
|
|
||||||
outline_color = theme.font_main_outline_color
|
|
||||||
return u' -webkit-text-stroke: %sem %s; -webkit-text-fill-color: %s; ' % (size, outline_color, fill_color)
|
return u' -webkit-text-stroke: %sem %s; -webkit-text-fill-color: %s; ' % (size, outline_color, fill_color)
|
||||||
else:
|
return u''
|
||||||
return u''
|
|
||||||
|
|
||||||
|
|
||||||
def build_lyrics_format_css(theme, width, height):
|
def build_lyrics_format_css(theme_data, width, height):
|
||||||
"""
|
"""
|
||||||
Build the css which controls the theme format. Also used by renderer for splitting verses
|
Build the css which controls the theme format. Also used by renderer for splitting verses
|
||||||
|
|
||||||
``theme``
|
``theme_data``
|
||||||
Object containing theme information
|
Object containing theme information
|
||||||
|
|
||||||
``width``
|
``width``
|
||||||
|
@ -376,17 +359,17 @@ def build_lyrics_format_css(theme, width, height):
|
||||||
``height``
|
``height``
|
||||||
Height of the lyrics block
|
Height of the lyrics block
|
||||||
"""
|
"""
|
||||||
align = HorizontalType.Names[theme.display_horizontal_align]
|
align = HorizontalType.Names[theme_data.display_horizontal_align]
|
||||||
valign = VerticalType.Names[theme.display_vertical_align]
|
valign = VerticalType.Names[theme_data.display_vertical_align]
|
||||||
if theme.font_main_outline:
|
if theme_data.font_main_outline:
|
||||||
left_margin = int(theme.font_main_outline_size) * 2
|
left_margin = int(theme_data.font_main_outline_size) * 2
|
||||||
else:
|
else:
|
||||||
left_margin = 0
|
left_margin = 0
|
||||||
justify = u'white-space:pre-wrap;'
|
justify = u'white-space:pre-wrap;'
|
||||||
# fix tag incompatibilities
|
# fix tag incompatibilities
|
||||||
if theme.display_horizontal_align == HorizontalType.Justify:
|
if theme_data.display_horizontal_align == HorizontalType.Justify:
|
||||||
justify = u''
|
justify = u''
|
||||||
if theme.display_vertical_align == VerticalType.Bottom:
|
if theme_data.display_vertical_align == VerticalType.Bottom:
|
||||||
padding_bottom = u'0.5em'
|
padding_bottom = u'0.5em'
|
||||||
else:
|
else:
|
||||||
padding_bottom = u'0'
|
padding_bottom = u'0'
|
||||||
|
@ -394,11 +377,12 @@ def build_lyrics_format_css(theme, width, height):
|
||||||
'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-bottom: %s; padding-left: %spx; width: %spx; height: %spx; ' % \
|
'padding: 0; padding-bottom: %s; padding-left: %spx; width: %spx; height: %spx; ' % \
|
||||||
(justify, align, valign, theme.font_main_name, theme.font_main_size,
|
(justify, align, valign, theme_data.font_main_name, theme_data.font_main_size,
|
||||||
theme.font_main_color, 100 + int(theme.font_main_line_adjustment), padding_bottom, left_margin, width, height)
|
theme_data.font_main_color, 100 + int(theme_data.font_main_line_adjustment), padding_bottom,
|
||||||
if theme.font_main_italics:
|
left_margin, width, height)
|
||||||
|
if theme_data.font_main_italics:
|
||||||
lyrics += u' font-style:italic; '
|
lyrics += u' font-style:italic; '
|
||||||
if theme.font_main_bold:
|
if theme_data.font_main_bold:
|
||||||
lyrics += u' font-weight:bold; '
|
lyrics += u' font-weight:bold; '
|
||||||
return lyrics
|
return lyrics
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue