Allow images to blank to theme.

As none defined cos it's an image use global

Fixes: https://launchpad.net/bugs/630254
This commit is contained in:
Tim Bentley 2010-09-05 17:11:50 +01:00
parent 789147ad94
commit a4d8e225c0
3 changed files with 15 additions and 11 deletions

View File

@ -145,6 +145,7 @@ body {
} }
document.getElementById('black').style.display = black; document.getElementById('black').style.display = black;
document.getElementById('lyricsmain').style.visibility = lyrics; document.getElementById('lyricsmain').style.visibility = lyrics;
document.getElementById('image').style.visibility = lyrics;
outline = document.getElementById('lyricsoutline') outline = document.getElementById('lyricsoutline')
if(outline!=null) if(outline!=null)
outline.style.visibility = lyrics; outline.style.visibility = lyrics;
@ -327,7 +328,7 @@ def build_background_css(item, width, height):
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))' % (width, width, width,
theme.background_startColor, theme.background_endColor) theme.background_startColor, theme.background_endColor)
return background return background
@ -370,10 +371,10 @@ def build_lyrics_css(item, webkitvers):
lyricsmain = u'' lyricsmain = u''
outline = u'' outline = u''
shadow = u'' shadow = u''
if theme: if theme and item.main:
lyricstable = u'left: %spx; top: %spx;' % \ lyricstable = u'left: %spx; top: %spx;' % \
(item.main.x(), item.main.y()) (item.main.x(), item.main.y())
lyrics = build_lyrics_format_css(theme, item.main.width(), lyrics = build_lyrics_format_css(theme, item.main.width(),
item.main.height()) item.main.height())
# For performance reasons we want to show as few DIV's as possible, # For performance reasons we want to show as few DIV's as possible,
# especially when animating/transitions. # especially when animating/transitions.
@ -393,7 +394,7 @@ def build_lyrics_css(item, webkitvers):
if webkitvers >= 533.3: if webkitvers >= 533.3:
lyricsmain += build_lyrics_outline_css(theme) lyricsmain += build_lyrics_outline_css(theme)
else: else:
outline = build_lyrics_outline_css(theme) outline = build_lyrics_outline_css(theme)
if theme.display_shadow: if theme.display_shadow:
if theme.display_outline and webkitvers < 534.3: if theme.display_outline and webkitvers < 534.3:
shadow = u'padding-left: %spx; padding-top: %spx ' % \ shadow = u'padding-left: %spx; padding-top: %spx ' % \
@ -405,7 +406,7 @@ def build_lyrics_css(item, webkitvers):
theme.display_shadow_size) theme.display_shadow_size)
lyrics_css = style % (lyricstable, lyrics, lyricsmain, outline, shadow) lyrics_css = style % (lyricstable, lyrics, lyricsmain, outline, shadow)
return lyrics_css return lyrics_css
def build_lyrics_outline_css(theme, is_shadow=False): def build_lyrics_outline_css(theme, is_shadow=False):
""" """
Build the css which controls the theme outline Build the css which controls the theme outline
@ -413,7 +414,7 @@ def build_lyrics_outline_css(theme, is_shadow=False):
`theme` `theme`
Object containing theme information Object containing theme information
`is_shadow` `is_shadow`
If true, use the shadow colors instead If true, use the shadow colors instead
""" """
@ -437,7 +438,7 @@ def build_lyrics_format_css(theme, width, height):
`theme` `theme`
Object containing theme information Object containing theme information
`width` `width`
Width of the lyrics block Width of the lyrics block
@ -461,8 +462,8 @@ 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%%; ' \ 'font-size: %spt; color: %s; line-height: %d%%; ' \
'margin:0; padding:0; width: %spx; height: %spx; ' % \ 'margin:0; padding:0; width: %spx; height: %spx; ' % \
(align, valign, theme.font_main_name, theme.font_main_proportion, (align, valign, theme.font_main_name, theme.font_main_proportion,
theme.font_main_color, 100 + int(theme.font_main_line_adjustment), theme.font_main_color, 100 + int(theme.font_main_line_adjustment),
width, height) width, height)
if theme.display_outline: if theme.display_outline:
if webkit_version() < 534.3: if webkit_version() < 534.3:
@ -472,7 +473,7 @@ def build_lyrics_format_css(theme, width, height):
if theme.font_main_weight == u'Bold': if theme.font_main_weight == u'Bold':
lyrics += u' font-weight:bold; ' lyrics += u' font-weight:bold; '
return lyrics return lyrics
def build_lyrics_html(item, webkitvers): def build_lyrics_html(item, webkitvers):
""" """
Build the HTML required to show the lyrics Build the HTML required to show the lyrics
@ -520,7 +521,7 @@ def build_footer_css(item):
text-align: %s; text-align: %s;
""" """
theme = item.themedata theme = item.themedata
if not theme: if not theme or not item.footer:
return u'' return u''
if theme.display_horizontalAlign == 2: if theme.display_horizontalAlign == 2:
align = u'center' align = u'center'

View File

@ -93,6 +93,8 @@ class RenderManager(object):
""" """
self.global_theme = global_theme self.global_theme = global_theme
self.theme_level = theme_level self.theme_level = theme_level
self.global_theme_data = \
self.theme_manager.getThemeData(self.global_theme)
self.themedata = None self.themedata = None
def set_service_theme(self, service_theme): def set_service_theme(self, service_theme):

View File

@ -170,6 +170,7 @@ class ServiceItem(object):
u'verseTag': slide[u'verseTag'] }) u'verseTag': slide[u'verseTag'] })
log.log(15, u'Formatting took %4s' % (time.time() - before)) log.log(15, u'Formatting took %4s' % (time.time() - before))
elif self.service_item_type == ServiceItemType.Image: elif self.service_item_type == ServiceItemType.Image:
self.themedata = self.render_manager.global_theme_data
for slide in self._raw_frames: for slide in self._raw_frames:
slide[u'image'] = resize_image(slide[u'image'], slide[u'image'] = resize_image(slide[u'image'],
self.render_manager.width, self.render_manager.height) self.render_manager.width, self.render_manager.height)