Looking better

This commit is contained in:
Tim Bentley 2011-04-09 09:11:46 +01:00
parent 9ce234598a
commit 501235a695

View File

@ -381,9 +381,6 @@ class Renderer(object):
previous_line = u'' previous_line = u''
# Loop through the lines # Loop through the lines
for line in lines: for line in lines:
line_added = False
while not line_added:
line_added = True
line_count += 1 line_count += 1
styled_line = expand_tags(line) styled_line = expand_tags(line)
styled_line = line_end + styled_line styled_line = line_end + styled_line
@ -403,7 +400,6 @@ class Renderer(object):
if html_text.endswith(u'<br>'): if html_text.endswith(u'<br>'):
html_text = html_text[:len(html_text)-4] html_text = html_text[:len(html_text)-4]
formatted.append(html_text) formatted.append(html_text)
line_added = False
line = previous_line line = previous_line
line_count = 1 line_count = 1
html_text = u'' html_text = u''
@ -412,23 +408,23 @@ class Renderer(object):
line_count = 0 line_count = 0
words = self._words_split(line) words = self._words_split(line)
styled_text = u'' styled_text = u''
styled_line = u''
for word in words: for word in words:
styled_word = expand_tags(word) styled_word = expand_tags(word)
#styled_line = styled_word
#previous_line = line
#previous_styled = styled_line
styled_text += styled_word styled_text += styled_word
html = self.page_shell + styled_text + HTML_END html = self.page_shell + styled_text + HTML_END
self.web.setHtml(html) self.web.setHtml(html)
# Text too long so go to next page # Text too long so go to next page
print self.web_frame.contentsSize().height() , self.page_height, [line] print self.web_frame.contentsSize().height() , self.page_height, [line]
if self.web_frame.contentsSize().height() >= self.page_height: if self.web_frame.contentsSize().height() > self.page_height:
if html_text.endswith(u'<br>'): if html_text.endswith(u'<br>'):
html_text = html_text[:len(html_text)-4] html_text = html_text[:len(html_text)-4]
formatted.append(html_text) formatted.append(html_text)
html_text = u'' html_text = u''
styled_text = u'' styled_text = u''
html_text += word html_text += word
a=1
else:
styled_text = styled_line styled_text = styled_line
html_text += line + line_end html_text += line + line_end
previous_line = line previous_line = line