Html cleanups

This commit is contained in:
Tim Bentley 2010-07-18 19:01:35 +01:00
parent ea2d0cdb72
commit 44592ae579
2 changed files with 32 additions and 13 deletions

View File

@ -126,22 +126,38 @@ def build_lyrics(item, width, height):
lyrics = """ lyrics = """
#lyrics { #lyrics {
position: absolute; position: absolute;
left: 0px; %s
top: 0px;
width: 1024px;
height: 768px;
z-index:3; z-index:3;
%s; %s;
%s; %s;
font-family %s; %s
font-size: %spx; %s
} }
""" """
theme = item.themedata theme = item.themedata
lyrics_html = u'' lyrics_html = u''
position = u''
shadow = u'' shadow = u''
outline = u'' outline = u''
font = u''
text = u''
if theme: if theme:
position = u' left: %spx; top: %spx; width: %spx; height: %spx; ' %\
(item.main.x(), item.main.y(), item.main.width(), item.main.height())
font = u' font-family %s; font-size: %spx;' %\
(theme.font_main_name, theme.font_main_proportion)
align = u''
if theme.display_horizontalAlign == 2:
align = u'align=center;'
elif theme.display_horizontalAlign == 1:
align = u'align=right;'
if theme.display_verticalAlign == 2:
valign = u'vertical-align=top;'
elif theme.display_verticalAlign == 1:
valign = u'vertical-align=middle;'
else:
valign = u'vertical-align=bottom;'
text = u'color:%s;%s%s' % (theme.font_main_color, align, valign)
if theme.display_shadow: if theme.display_shadow:
shadow = u'text-shadow: %spx %spx %spx %s' %\ shadow = u'text-shadow: %spx %spx %spx %s' %\
(theme.display_shadow_size, theme.display_shadow_size, (theme.display_shadow_size, theme.display_shadow_size,
@ -151,7 +167,7 @@ def build_lyrics(item, width, height):
outline = u'text-outline: %spx 1px %s' %\ outline = u'text-outline: %spx 1px %s' %\
(theme.display_outline_size, theme.display_outline_color) (theme.display_outline_size, theme.display_outline_color)
outline = u'text-shadow: -1px 0 white, 0 1px white, 1px 0 white, 0 -1px white' outline = u'text-shadow: -1px 0 white, 0 1px white, 1px 0 white, 0 -1px white'
lyrics_html = lyrics % (shadow, outline, theme.font_main_name, theme.font_main_proportion) lyrics_html = lyrics % (position, shadow, outline, font, text)
print lyrics_html print lyrics_html
return lyrics_html return lyrics_html

View File

@ -173,12 +173,15 @@ class Renderer(object):
myCursor = QtGui.QTextCursor(doc) myCursor = QtGui.QTextCursor(doc)
layout = doc.documentLayout() layout = doc.documentLayout()
formatted = [] formatted = []
if self._theme.display_horizontalAlign == 2: # if self._theme.display_horizontalAlign == 2:
shell = "<p align=center>%s</font></p>" # shell = """<p color="%s" align=center>""" %\
elif self._theme.display_horizontalAlign == 1: # self._theme.font_main_color
shell = "<p align=right>%s</font></p>" # elif self._theme.display_horizontalAlign == 1:
else: # shell = """<p color="%s" align=right>""" %\
shell = "<p>%s</p>" # self._theme.font_main_color
# else:
# shell = """<p color="%s">""" % self._theme.font_main_color
shell = u'<p>%s</p>'
temp_text = u'' temp_text = u''
old_html_text = u'' old_html_text = u''
page = [] page = []