openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #20906
[Merge] lp:~googol/openlp/html-clean-up into lp:openlp
Andreas Preikschat has proposed merging lp:~googol/openlp/html-clean-up into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
For more details, see:
https://code.launchpad.net/~googol/openlp/html-clean-up/+merge/172376
--
https://code.launchpad.net/~googol/openlp/html-clean-up/+merge/172376
Your team OpenLP Core is requested to review the proposed merge of lp:~googol/openlp/html-clean-up into lp:openlp.
=== modified file 'openlp/core/lib/htmlbuilder.py'
--- openlp/core/lib/htmlbuilder.py 2013-06-20 18:42:45 +0000
+++ openlp/core/lib/htmlbuilder.py 2013-07-01 17:33:42 +0000
@@ -114,12 +114,6 @@
document.getElementById('black').style.display = black;
document.getElementById('lyricsmain').style.visibility = lyrics;
document.getElementById('image').style.visibility = lyrics;
- outline = document.getElementById('lyricsoutline')
- if(outline != null)
- outline.style.visibility = lyrics;
- shadow = document.getElementById('lyricsshadow')
- if(shadow != null)
- shadow.style.visibility = lyrics;
document.getElementById('footer').style.visibility = lyrics;
}
@@ -138,9 +132,6 @@
*/
var txt = document.getElementById('lyricsmain');
if(window.getComputedStyle(txt).textAlign == 'justify'){
- var outline = document.getElementById('lyricsoutline');
- if(outline != null)
- txt = outline;
if(window.getComputedStyle(txt).webkitTextStrokeWidth != '0px'){
new_text = new_text.replace(/(\s| )+(?![^<]*>)/g,
function(match) {
@@ -150,8 +141,6 @@
}
}
text_fade('lyricsmain', new_text);
- text_fade('lyricsoutline', new_text);
- text_fade('lyricsshadow', new_text.replace(match, ''));
}
function text_fade(id, new_text){
@@ -190,7 +179,7 @@
<img id="bgimage" class="size" %s />
<img id="image" class="size" %s />
%s
-%s
+<div class="lyricstable"><div id="lyricsmain" style="opacity:1" class="lyricscell lyricsmain"></div></div>
<div id="footer" class="footer"></div>
<div id="black" class="size"></div>
</body>
@@ -222,8 +211,7 @@
"""
width = screen[u'size'].width()
height = screen[u'size'].height()
- theme = item.themedata
- webkit_ver = webkit_version()
+ theme_data = item.themedata
# Image generated and poked in
if background:
bgimage_src = u'src="data:image/png;base64,%s"' % background
@@ -247,12 +235,12 @@
build_background_css(item, width),
css_additions,
build_footer_css(item, height),
- build_lyrics_css(item, webkit_ver),
- u'true' if theme and theme.display_slide_transition and is_live else u'false',
+ build_lyrics_css(item),
+ u'true' if theme_data and theme_data.display_slide_transition and is_live else u'false',
js_additions,
- bgimage_src, image_src,
- html_additions,
- build_lyrics_html(item, webkit_ver)
+ bgimage_src,
+ image_src,
+ html_additions
)
return html
@@ -303,16 +291,13 @@
return background
-def build_lyrics_css(item, webkit_ver):
+def build_lyrics_css(item):
"""
Build the lyrics display css
``item``
Service Item containing theme and location information
- ``webkitvers``
- The version of qtwebkit we're using
-
"""
style = u"""
.lyricstable {
@@ -328,81 +313,44 @@
%s
}
.lyricsmain {
-%s
-}
-.lyricsoutline {
-%s
-}
-.lyricsshadow {
-%s
+ %s
}
"""
- theme = item.themedata
+ theme_data = item.themedata
lyricstable = u''
lyrics = u''
lyricsmain = u''
- outline = u''
- shadow = u''
- if theme and item.main:
+ if theme_data and item.main:
lyricstable = u'left: %spx; top: %spx;' % (item.main.x(), item.main.y())
- lyrics = build_lyrics_format_css(theme, item.main.width(), item.main.height())
- # For performance reasons we want to show as few DIV's as possible, especially when animating/transitions.
- # However some bugs in older versions of qtwebkit mean we need to perform workarounds and add extra divs. Only
- # do these when needed.
- #
- # Before 533.3 the webkit-text-fill colour wasn't displayed, only the stroke (outline) color. So put stroke
- # layer underneath the main text.
- #
- # Up to 534.3 the webkit-text-stroke was sometimes out of alignment with the fill, or normal text.
- # letter-spacing=1 is workaround https://bugs.webkit.org/show_bug.cgi?id=44403
- #
- # Up to 534.3 the text-shadow didn't get displayed when webkit-text-stroke was used. So use an offset text
- # layer underneath. https://bugs.webkit.org/show_bug.cgi?id=19728
- if webkit_ver >= 533.3:
- lyricsmain += build_lyrics_outline_css(theme)
- else:
- outline = build_lyrics_outline_css(theme)
- if theme.font_main_shadow:
- if theme.font_main_outline and webkit_ver <= 534.3:
- shadow = u'padding-left: %spx; padding-top: %spx;' % \
- (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, outline, shadow)
+ lyrics = build_lyrics_format_css(theme_data, item.main.width(), item.main.height())
+ lyricsmain += build_lyrics_outline_css(theme_data)
+ if theme_data.font_main_shadow:
+ lyricsmain += u' text-shadow: %s %spx %spx;' % \
+ (theme_data.font_main_shadow_color, theme_data.font_main_shadow_size, theme_data.font_main_shadow_size)
+ lyrics_css = style % (lyricstable, lyrics, lyricsmain)
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
- ``theme``
+ ``theme_data``
Object containing theme information
-
- ``is_shadow``
- If true, use the shadow colors instead
"""
- if theme.font_main_outline:
- size = float(theme.font_main_outline_size) / 16
- if is_shadow:
- fill_color = theme.font_main_shadow_color
- outline_color = theme.font_main_shadow_color
- else:
- fill_color = theme.font_main_color
- outline_color = theme.font_main_outline_color
+ if theme_data.font_main_outline:
+ size = float(theme_data.font_main_outline_size) / 16
+ fill_color = theme_data.font_main_color
+ outline_color = theme_data.font_main_outline_color
return u' -webkit-text-stroke: %sem %s; -webkit-text-fill-color: %s; ' % (size, outline_color, fill_color)
- else:
- return u''
-
-
-def build_lyrics_format_css(theme, width, height):
+ return u''
+
+
+def build_lyrics_format_css(theme_data, width, height):
"""
Build the css which controls the theme format. Also used by renderer for splitting verses
- ``theme``
+ ``theme_data``
Object containing theme information
``width``
@@ -411,17 +359,17 @@
``height``
Height of the lyrics block
"""
- align = HorizontalType.Names[theme.display_horizontal_align]
- valign = VerticalType.Names[theme.display_vertical_align]
- if theme.font_main_outline:
- left_margin = int(theme.font_main_outline_size) * 2
+ align = HorizontalType.Names[theme_data.display_horizontal_align]
+ valign = VerticalType.Names[theme_data.display_vertical_align]
+ if theme_data.font_main_outline:
+ left_margin = int(theme_data.font_main_outline_size) * 2
else:
left_margin = 0
justify = u'white-space:pre-wrap;'
# fix tag incompatibilities
- if theme.display_horizontal_align == HorizontalType.Justify:
+ if theme_data.display_horizontal_align == HorizontalType.Justify:
justify = u''
- if theme.display_vertical_align == VerticalType.Bottom:
+ if theme_data.display_vertical_align == VerticalType.Bottom:
padding_bottom = u'0.5em'
else:
padding_bottom = u'0'
@@ -429,44 +377,16 @@
'text-align: %s; vertical-align: %s; font-family: %s; ' \
'font-size: %spt; color: %s; line-height: %d%%; margin: 0;' \
'padding: 0; padding-bottom: %s; padding-left: %spx; width: %spx; height: %spx; ' % \
- (justify, align, valign, theme.font_main_name, theme.font_main_size,
- theme.font_main_color, 100 + int(theme.font_main_line_adjustment), padding_bottom, left_margin, width, height)
- if theme.font_main_outline:
- if webkit_version() <= 534.3:
- lyrics += u' letter-spacing: 1px;'
- if theme.font_main_italics:
+ (justify, align, valign, theme_data.font_main_name, theme_data.font_main_size,
+ theme_data.font_main_color, 100 + int(theme_data.font_main_line_adjustment), padding_bottom,
+ left_margin, width, height)
+ if theme_data.font_main_italics:
lyrics += u' font-style:italic; '
- if theme.font_main_bold:
+ if theme_data.font_main_bold:
lyrics += u' font-weight:bold; '
return lyrics
-def build_lyrics_html(item, webkitvers):
- """
- Build the HTML required to show the lyrics
-
- ``item``
- Service Item containing theme and location information
-
- ``webkitvers``
- The version of qtwebkit we're using
- """
- # Bugs in some versions of QtWebKit mean we sometimes need additional divs for outline and shadow, since the CSS
- # doesn't work. To support vertical alignment middle and bottom, nested div's using display:table/display:table-cell
- # are required for each lyric block.
- lyrics = u''
- theme = item.themedata
- if webkitvers <= 534.3 and theme and theme.font_main_outline:
- lyrics += u'<div class="lyricstable"><div id="lyricsshadow" style="opacity:1" ' \
- u'class="lyricscell lyricsshadow"></div></div>'
- if webkitvers < 533.3:
- lyrics += u'<div class="lyricstable"><div id="lyricsoutline" style="opacity:1" ' \
- u'class="lyricscell lyricsoutline"></div></div>'
- lyrics += u'<div class="lyricstable"><div id="lyricsmain" style="opacity:1" ' \
- u'class="lyricscell lyricsmain"></div></div>'
- return lyrics
-
-
def build_footer_css(item, height):
"""
Build the display of the item footer
=== modified file 'openlp/core/ui/maindisplay.py'
--- openlp/core/ui/maindisplay.py 2013-06-24 16:54:23 +0000
+++ openlp/core/ui/maindisplay.py 2013-07-01 17:33:42 +0000
@@ -243,8 +243,6 @@
# Windows if there are many items in the service to re-render.
# Setting the div elements direct seems to solve the issue
self.frame.findFirstElement("#lyricsmain").setInnerXml(slide)
- self.frame.findFirstElement("#lyricsoutline").setInnerXml(slide)
- self.frame.findFirstElement("#lyricsshadow").setInnerXml(slide)
def alert(self, text, location):
"""
Follow ups