From 9996320522801abe70c9ddf7771c41d60de413c2 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 28 Apr 2011 08:44:48 +0200 Subject: [PATCH] fixed verse splitting where not necessary --- openlp/core/lib/renderer.py | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index c2e64dadc..7687ebe9a 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -364,10 +364,6 @@ class Renderer(object): Add line endings after each line of text used for bibles. """ - # In the beginning ... - # - # - # Verse 2 log.debug(u'_paginate_slide_words - Start') line_end = u'' if line_break: @@ -382,6 +378,27 @@ class Renderer(object): self.web.setHtml(html) # Text too long so go to next page if self.web_frame.contentsSize().height() > self.page_height: + # Check if there was a verse before the current one and append + # it, when it fits on the page. + if previous_html: + html = self.page_shell + previous_html + HTML_END + self.web.setHtml(html) + if self.web_frame.contentsSize().height() <= \ + self.page_height: + previous_raw = previous_raw.rstrip(u'
') + formatted.append(previous_raw) + previous_html = u'' + previous_raw = u'' + html = self.page_shell + styled_line + HTML_END + self.web.setHtml(html) + # Now check if the current verse will fit, if it does + # not we have to start to process the verse word by + # word. + if self.web_frame.contentsSize().height() <= \ + self.page_height: + previous_html = styled_line + line_end + previous_raw = line + line_end + continue words = self._words_split(line) for word in words: styled_word = expand_tags(word)