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 {
position: absolute;
left: 0px;
top: 0px;
width: 1024px;
height: 768px;
%s
z-index:3;
%s;
%s;
font-family %s;
font-size: %spx;
%s
%s
}
"""
theme = item.themedata
lyrics_html = u''
position = u''
shadow = u''
outline = u''
font = u''
text = u''
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:
shadow = u'text-shadow: %spx %spx %spx %s' %\
(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' %\
(theme.display_outline_size, theme.display_outline_color)
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
return lyrics_html

View File

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