From 445c63ce8b848712e16efc72d444192e6971fab5 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 12 Jun 2011 20:38:04 +0200 Subject: [PATCH 01/29] --- openlp/core/lib/renderer.py | 162 ++++++++++++++++++--------------- openlp/core/lib/serviceitem.py | 4 + 2 files changed, 95 insertions(+), 71 deletions(-) diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index f9af00f6e..decf30435 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -324,34 +324,28 @@ class Renderer(object): """ log.debug(u'_paginate_slide - Start') - line_end = u'' + line_end = u' ' if line_break: line_end = u'
' formatted = [] + raw_text = u'' html_text = u'' - styled_text = u'' - line_count = 0 - for line in lines: - if line_count != -1: - line_count += 1 - styled_line = expand_tags(line) + line_end - styled_text += styled_line - html = self.page_shell + styled_text + HTML_END - self.web.setHtml(html) - # Text too long so go to next page. - if self.web_frame.contentsSize().height() > self.page_height: - if force_page and line_count > 0: - Receiver.send_message(u'theme_line_count', line_count - 1) - line_count = -1 - while html_text.endswith(u'
'): - html_text = html_text[:-4] - formatted.append(html_text) - html_text = u'' - styled_text = styled_line - html_text += line + line_end - while html_text.endswith(u'
'): - html_text = html_text[:-4] - formatted.append(html_text) + html_words = map(expand_tags, lines) + html = self.page_shell + u''.join(html_words) + HTML_END + self.web.setHtml(html) + # Text too long so go to next page. + if self.web_frame.contentsSize().height() > self.page_height: + lines = [u'%s
' % line for line in lines] + html_text, raw_text, index = self._binary_chop( + formatted, html_text, raw_text, lines, line_end) + if force_page: + Receiver.send_message(u'theme_line_count', index + 1) + else: + formatted.append(line_end.join(html_words)) + while raw_text.endswith(u'
'): + raw_text = raw_text[:-4] + if raw_text: + formatted.append(raw_text) log.debug(u'_paginate_slide - End') return formatted @@ -408,53 +402,8 @@ class Renderer(object): # Figure out how many words of the line will fit on screen by # using the algorithm known as "binary chop". raw_words = self._words_split(line) - html_words = [expand_tags(word) for word in raw_words] - smallest_index = 0 - highest_index = len(html_words) - 1 - index = int(highest_index / 2) - while True: - html = self.page_shell + previous_html + \ - u''.join(html_words[:index + 1]).strip() + HTML_END - self.web.setHtml(html) - if self.web_frame.contentsSize().height() > \ - self.page_height: - # We know that it does not fit, so change/calculate the - # new index and highest_index accordingly. - highest_index = index - index = int(index - (index - smallest_index) / 2) - else: - smallest_index = index - index = int(index + (highest_index - index) / 2) - # We found the number of words which will fit. - if smallest_index == index or highest_index == index: - index = smallest_index - formatted.append(previous_raw.rstrip(u'
') + - u''.join(raw_words[:index + 1])) - previous_html = u'' - previous_raw = u'' - else: - continue - # Check if the rest of the line fits on the slide. If it - # does we do not have to do the much more intensive "word by - # word" checking. - html = self.page_shell + \ - u''.join(html_words[index + 1:]).strip() + HTML_END - self.web.setHtml(html) - if self.web_frame.contentsSize().height() <= \ - self.page_height: - previous_html = \ - u''.join(html_words[index + 1:]).strip() + line_end - previous_raw = \ - u''.join(raw_words[index + 1:]).strip() + line_end - break - else: - # The other words do not fit, thus reset the indexes, - # create a new list and continue with "word by word". - raw_words = raw_words[index + 1:] - html_words = html_words[index + 1:] - smallest_index = 0 - highest_index = len(html_words) - 1 - index = int(highest_index / 2) + previous_html, previous_raw, index = self._binary_chop( + formatted, previous_html, previous_raw, raw_words, line_end, u'
') else: previous_html += styled_line + line_end previous_raw += line + line_end @@ -464,6 +413,77 @@ class Renderer(object): log.debug(u'_paginate_slide_words - End') return formatted + def _binary_chop(self, formatted, previous_html, previous_raw, raw_text, + line_end): + """ + This implements the binary chop algorithm for faster rendering. However, + it is assumed that this method is **only** called, when the text to be + rendered does not fit as a whole. + + ``formatted`` + The list of slides. + + ``previous_html`` + The html text which is know to fit on a slide, but is not yet added + to the list of slides. + + ``previous_raw`` + The raw text (with display tags) which is know to fit on a slide, + but is not yet added to the list of slides. + + ``raw_text`` + The text which does not fit on a slide and needs to be processed + using the binary chop. The text can contain display tags. + + ``line_end`` + The + """ + html_words = map(expand_tags, raw_text) + smallest_index = 0 + highest_index = len(html_words) - 1 + index = int(highest_index / 2) + while True: + html = self.page_shell + previous_html + \ + separator.join(html_words[:index + 1]).strip() + HTML_END + self.web.setHtml(html) + if self.web_frame.contentsSize().height() > self.page_height: + # We know that it does not fit, so change/calculate the + # new index and highest_index accordingly. + highest_index = index + index = int(index - (index - smallest_index) / 2) + else: + smallest_index = index + index = int(index + (highest_index - index) / 2) + # We found the number of words which will fit. + if smallest_index == index or highest_index == index: + index = smallest_index + formatted.append(previous_raw.rstrip(u'
') + + u''.join(raw_text[:index + 1])) + previous_html = u'' + previous_raw = u'' + else: + continue + # Check if the rest of the line fits on the slide. If it + # does we do not have to do the much more intensive "word by + # word" checking. + html = self.page_shell + \ + u''.join(html_words[index + 1:]).strip() + HTML_END + self.web.setHtml(html) + if self.web_frame.contentsSize().height() <= self.page_height: + previous_html = \ + u''.join(html_words[index + 1:]).strip() + line_end + previous_raw = u''.join(raw_text[index + 1:]).strip() + line_end + break + else: + # The other words do not fit, thus reset the indexes, + # create a new list and continue with "word by word". + raw_text = raw_text[index + 1:] + html_words = html_words[index + 1:] + smallest_index = 0 + highest_index = len(html_words) - 1 + index = int(highest_index / 2) + return previous_html, previous_raw, index + def _words_split(self, line): """ Split the slide up by word so can wrap better diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py index cf682abc6..62d29d8be 100644 --- a/openlp/core/lib/serviceitem.py +++ b/openlp/core/lib/serviceitem.py @@ -172,6 +172,9 @@ class ServiceItem(object): self.themedata = self.renderer.theme_data if self.service_item_type == ServiceItemType.Text: log.debug(u'Formatting slides') + import time + import datetime + start = time.time() for slide in self._raw_frames: formatted = self.renderer \ .format_slide(slide[u'raw_slide'], line_break, self) @@ -184,6 +187,7 @@ class ServiceItem(object): u'html': html.replace(u'&nbsp;', u' '), u'verseTag': slide[u'verseTag'] }) + print unicode(datetime.timedelta(seconds=time.time() - start)) elif self.service_item_type == ServiceItemType.Image or \ self.service_item_type == ServiceItemType.Command: pass From d7ea2183426fc5e437312a41014cf224412ffeac Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 13 Jun 2011 10:16:50 +0200 Subject: [PATCH 02/29] clean ups --- openlp/core/lib/renderer.py | 55 ++++++++++++++++------------------ openlp/core/lib/serviceitem.py | 6 ++-- 2 files changed, 27 insertions(+), 34 deletions(-) diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index 6d921f509..d25fb0aae 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -206,20 +206,24 @@ class Renderer(object): self._calculate_default(self.screens.current[u'size']) return preview - def format_slide(self, text, line_break, item): + def format_slide(self, text, item): """ Calculate how much text can fit on a slide. ``text`` The words to go on the slides. - ``line_break`` - Add line endings after each line of text used for bibles. + ``item`` + The service item object. """ log.debug(u'format slide') + # Add line endings after each line of text used for bibles. + line_end = u'
' + if item.is_capable(ItemCapabilities.NoLineBreaks): + line_end = u' ' # clean up line endings lines = self._lines_split(text) - pages = self._paginate_slide(lines, line_break, self.force_page) + pages = self._paginate_slide(lines, line_end) if len(pages) > 1: # Songs and Custom if item.is_capable(ItemCapabilities.AllowsVirtualSplit): @@ -228,12 +232,11 @@ class Renderer(object): pages = [] for slide in slides: lines = slide.strip(u'\n').split(u'\n') - new_pages = self._paginate_slide(lines, line_break, - self.force_page) + new_pages = self._paginate_slide(lines, line_end) pages.extend(new_pages) # Bibles elif item.is_capable(ItemCapabilities.AllowsWordSplit): - pages = self._paginate_slide_words(text, line_break) + pages = self._paginate_slide_words(text, line_end) return pages def _calculate_default(self, screen): @@ -241,7 +244,7 @@ class Renderer(object): Calculate the default dimentions of the screen. ``screen`` - The QSize of the screen. + The screen to calculate the default of. """ log.debug(u'_calculate default %s', screen) self.width = screen.width() @@ -308,25 +311,19 @@ class Renderer(object): (build_lyrics_format_css(self.theme_data, self.page_width, self.page_height), build_lyrics_outline_css(self.theme_data)) - def _paginate_slide(self, lines, line_break, force_page=False): + def _paginate_slide(self, lines, line_end): """ Figure out how much text can appear on a slide, using the current theme settings. ``lines`` - The words to be fitted on the slide split into lines. + The text to be fitted on the slide split into lines. - ``line_break`` + ``line_end`` Add line endings after each line of text (used for bibles). - - ``force_page`` - Flag to tell message lines in page. - """ log.debug(u'_paginate_slide - Start') - line_end = u'' - if line_break: - line_end = u'
' + #print line_end formatted = [] previous_html = u'' previous_raw = u'' @@ -336,11 +333,8 @@ class Renderer(object): self.web.setHtml(html) # Text too long so go to next page. if self.web_frame.contentsSize().height() > self.page_height: - html_text, previous_raw, index = self._binary_chop( - formatted, previous_html, previous_raw, html_lines, lines, - line_end) - if force_page: - Receiver.send_message(u'theme_line_count', index + 1) + html_text, previous_raw = self._binary_chop(formatted, + previous_html, previous_raw, html_lines, lines, line_end) else: previous_raw = u''.join(lines) while previous_raw.endswith(u'
'): @@ -350,7 +344,7 @@ class Renderer(object): log.debug(u'_paginate_slide - End') return formatted - def _paginate_slide_words(self, text, line_break): + def _paginate_slide_words(self, text, line_end): """ Figure out how much text can appear on a slide, using the current theme settings. This version is to handle text which needs to be split @@ -359,14 +353,11 @@ class Renderer(object): ``text`` The words to be fitted on the slide split into lines. - ``line_break`` + ``line_end`` Add line endings after each line of text used for bibles. """ log.debug(u'_paginate_slide_words - Start') - line_end = u' ' - if line_break: - line_end = u'
' formatted = [] previous_html = u'' previous_raw = u'' @@ -404,7 +395,7 @@ class Renderer(object): # using the algorithm known as "binary chop". raw_words = self._words_split(line) html_words = map(expand_tags, raw_text) - previous_html, previous_raw, index = self._binary_chop( + previous_html, previous_raw = self._binary_chop( formatted, previous_html, previous_raw, html_words, raw_words, line_end) else: @@ -466,6 +457,10 @@ class Renderer(object): u''.join(raw_list[:index + 1])) previous_html = u'' previous_raw = u'' + # Stop here as the theme line count was requested. + if self.force_page: + Receiver.send_message(u'theme_line_count', index + 1) + break else: continue # Check if the rest of the line fits on the slide. If it @@ -487,7 +482,7 @@ class Renderer(object): smallest_index = 0 highest_index = len(html_list) - 1 index = int(highest_index / 2) - return previous_html, previous_raw, index + return previous_html, previous_raw def _words_split(self, line): """ diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py index 1eb1a908b..6a8ba81c4 100644 --- a/openlp/core/lib/serviceitem.py +++ b/openlp/core/lib/serviceitem.py @@ -165,7 +165,6 @@ class ServiceItem(object): log.debug(u'Render called') self._display_frames = [] self.bg_image_bytes = None - line_break = not self.is_capable(ItemCapabilities.NoLineBreaks) theme = self.theme if self.theme else None self.main, self.footer = \ self.renderer.set_override_theme(theme, use_override) @@ -176,9 +175,8 @@ class ServiceItem(object): import datetime start = time.time() for slide in self._raw_frames: - formatted = self.renderer \ - .format_slide(slide[u'raw_slide'], line_break, self) - for page in formatted: + pages = self.renderer.format_slide(slide[u'raw_slide'], self) + for page in pages: page = page.replace(u'
', u'{br}') html = expand_tags(cgi.escape(page.rstrip())) self._display_frames.append({ From ded49f74a3e7951a77e01460b17068ebd5919842 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 13 Jun 2011 11:05:22 +0200 Subject: [PATCH 03/29] clean ups --- openlp/core/lib/renderer.py | 39 +++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index d25fb0aae..b6061d474 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -214,7 +214,7 @@ class Renderer(object): The words to go on the slides. ``item`` - The service item object. + The :class:`~openlp.core.lib.serviceitem` item object. """ log.debug(u'format slide') # Add line endings after each line of text used for bibles. @@ -232,12 +232,16 @@ class Renderer(object): pages = [] for slide in slides: lines = slide.strip(u'\n').split(u'\n') - new_pages = self._paginate_slide(lines, line_end) - pages.extend(new_pages) + pages.extend(self._paginate_slide(lines, line_end)) # Bibles elif item.is_capable(ItemCapabilities.AllowsWordSplit): pages = self._paginate_slide_words(text, line_end) - return pages + new_pages = [] + for page in pages: + while page.endswith(u'
'): + page = page[:-4] + new_pages.append(page) + return new_pages def _calculate_default(self, screen): """ @@ -320,10 +324,9 @@ class Renderer(object): The text to be fitted on the slide split into lines. ``line_end`` - Add line endings after each line of text (used for bibles). + The text added after each line. Either ``u' '`` or ``u'
``. """ log.debug(u'_paginate_slide - Start') - #print line_end formatted = [] previous_html = u'' previous_raw = u'' @@ -337,8 +340,6 @@ class Renderer(object): previous_html, previous_raw, html_lines, lines, line_end) else: previous_raw = u''.join(lines) - while previous_raw.endswith(u'
'): - previous_raw = previous_raw[:-4] if previous_raw: formatted.append(previous_raw) log.debug(u'_paginate_slide - End') @@ -354,8 +355,8 @@ class Renderer(object): The words to be fitted on the slide split into lines. ``line_end`` - Add line endings after each line of text used for bibles. - + The text added after each line. Either ``u' '`` or ``u'
``. This + is needed for bibles. """ log.debug(u'_paginate_slide_words - Start') formatted = [] @@ -364,8 +365,8 @@ class Renderer(object): lines = text.split(u'\n') for line in lines: line = line.strip() - styled_line = expand_tags(line) - html = self.page_shell + previous_html + styled_line + HTML_END + html_line = expand_tags(line) + html = self.page_shell + previous_html + html_line + HTML_END self.web.setHtml(html) # Text too long so go to next page. if self.web_frame.contentsSize().height() > self.page_height: @@ -376,33 +377,29 @@ class Renderer(object): self.web.setHtml(html) if self.web_frame.contentsSize().height() <= \ self.page_height: - while previous_raw.endswith(u'
'): - previous_raw = previous_raw[:-4] formatted.append(previous_raw) previous_html = u'' previous_raw = u'' - html = self.page_shell + styled_line + HTML_END + html = self.page_shell + html_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_html = html_line + line_end previous_raw = line + line_end continue - # Figure out how many words of the line will fit on screen by - # using the algorithm known as "binary chop". + # Figure out how many words of the line will fit on screen as + # the line will not fit as a whole. raw_words = self._words_split(line) html_words = map(expand_tags, raw_text) previous_html, previous_raw = self._binary_chop( formatted, previous_html, previous_raw, html_words, raw_words, line_end) else: - previous_html += styled_line + line_end + previous_html += html_line + line_end previous_raw += line + line_end - while previous_raw.endswith(u'
'): - previous_raw = previous_raw[:-4] formatted.append(previous_raw) log.debug(u'_paginate_slide_words - End') return formatted From 772c36ed19a0b26ae79fbf42987875b04be059ac Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 13 Jun 2011 11:47:18 +0200 Subject: [PATCH 04/29] more clean ups, doc --- openlp/core/lib/renderer.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index b6061d474..28bd8c513 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -101,7 +101,7 @@ class Renderer(object): The global-level theme to be set. ``theme_level`` - Defaults to *``ThemeLevel.Global``*. The theme level, can be + Defaults to ``ThemeLevel.Global``. The theme level, can be ``ThemeLevel.Global``, ``ThemeLevel.Service`` or ``ThemeLevel.Song``. """ @@ -205,6 +205,7 @@ class Renderer(object): # Reset the real screen size for subsequent render requests self._calculate_default(self.screens.current[u'size']) return preview + self.force_page = False def format_slide(self, text, item): """ @@ -214,7 +215,7 @@ class Renderer(object): The words to go on the slides. ``item`` - The :class:`~openlp.core.lib.serviceitem` item object. + The :class:`~openlp.core.lib.serviceitem.ServiceItem` item object. """ log.debug(u'format slide') # Add line endings after each line of text used for bibles. @@ -423,14 +424,16 @@ class Renderer(object): but is not yet added to the list of slides. (unicode string) ``html_list`` - + The text which does not fit on a slide and needs to be processed + using the binary chop. The text contains html. ``raw_list`` The text which does not fit on a slide and needs to be processed using the binary chop. The text can contain display tags. ``line_end`` - The + The text added after each line. Either ``u' '`` or ``u'
``. This + is needed for bibles. """ smallest_index = 0 highest_index = len(html_list) - 1 From f4c00009ed7da61375a903d3831909f0c2e9d0b2 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 13 Jun 2011 13:20:47 +0200 Subject: [PATCH 05/29] made _binary_shop less 'word by word' specific --- openlp/core/lib/renderer.py | 38 ++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index 28bd8c513..5c80ce71c 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -331,16 +331,16 @@ class Renderer(object): formatted = [] previous_html = u'' previous_raw = u'' - lines = [u'%s
' % line for line in lines] + separator = u'
' html_lines = map(expand_tags, lines) - html = self.page_shell + u''.join(html_lines) + HTML_END + html = self.page_shell + separator.join(html_lines) + HTML_END self.web.setHtml(html) # Text too long so go to next page. if self.web_frame.contentsSize().height() > self.page_height: html_text, previous_raw = self._binary_chop(formatted, - previous_html, previous_raw, html_lines, lines, line_end) + previous_html, previous_raw, html_lines, lines, separator, u'') else: - previous_raw = u''.join(lines) + previous_raw = separator.join(lines) if previous_raw: formatted.append(previous_raw) log.debug(u'_paginate_slide - End') @@ -394,10 +394,10 @@ class Renderer(object): # Figure out how many words of the line will fit on screen as # the line will not fit as a whole. raw_words = self._words_split(line) - html_words = map(expand_tags, raw_text) + html_words = map(expand_tags, raw_words) previous_html, previous_raw = self._binary_chop( formatted, previous_html, previous_raw, html_words, - raw_words, line_end) + raw_words, u' ', line_end) else: previous_html += html_line + line_end previous_raw += line + line_end @@ -406,7 +406,7 @@ class Renderer(object): return formatted def _binary_chop(self, formatted, previous_html, previous_raw, html_list, - raw_list, line_end): + raw_list, separator, line_end): """ This implements the binary chop algorithm for faster rendering. However, it is assumed that this method is **only** called, when the text to be @@ -431,16 +431,20 @@ class Renderer(object): The text which does not fit on a slide and needs to be processed using the binary chop. The text can contain display tags. + ``separator`` + The separator for the elements. For lines this is `u'
'`` and for + words this is u' '. + ``line_end`` - The text added after each line. Either ``u' '`` or ``u'
``. This - is needed for bibles. + The text added after each "element line". Either ``u' '`` or + ``u'
``. This is needed for bibles. """ smallest_index = 0 highest_index = len(html_list) - 1 index = int(highest_index / 2) while True: html = self.page_shell + previous_html + \ - u''.join(html_list[:index + 1]).strip() + HTML_END + separator.join(html_list[:index + 1]).strip() + HTML_END self.web.setHtml(html) if self.web_frame.contentsSize().height() > self.page_height: # We know that it does not fit, so change/calculate the @@ -454,7 +458,7 @@ class Renderer(object): if smallest_index == index or highest_index == index: index = smallest_index formatted.append(previous_raw.rstrip(u'
') + - u''.join(raw_list[:index + 1])) + separator.join(raw_list[:index + 1])) previous_html = u'' previous_raw = u'' # Stop here as the theme line count was requested. @@ -467,12 +471,13 @@ class Renderer(object): # does we do not have to do the much more intensive "word by # word" checking. html = self.page_shell + \ - u''.join(html_list[index + 1:]).strip() + HTML_END + separator.join(html_list[index + 1:]).strip() + HTML_END self.web.setHtml(html) if self.web_frame.contentsSize().height() <= self.page_height: - previous_html = \ - u''.join(html_list[index + 1:]).strip() + line_end - previous_raw = u''.join(raw_list[index + 1:]).strip() + line_end + previous_html = separator.join( + html_list[index + 1:]).strip() + line_end + previous_raw = separator.join( + raw_list[index + 1:]).strip() + line_end break else: # The other words do not fit, thus reset the indexes, @@ -490,8 +495,7 @@ class Renderer(object): """ # this parse we are to be wordy line = line.replace(u'\n', u' ') - words = line.split(u' ') - return [word + u' ' for word in words] + return line.split(u' ') def _lines_split(self, text): """ From f22e1385be9422e8178a6590d612522431f00a8d Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 13 Jun 2011 13:26:06 +0200 Subject: [PATCH 06/29] _paginate_slide_words detects long verses itself --- openlp/core/lib/renderer.py | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index 5c80ce71c..a6db56614 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -222,21 +222,23 @@ class Renderer(object): line_end = u'
' if item.is_capable(ItemCapabilities.NoLineBreaks): line_end = u' ' - # clean up line endings - lines = self._lines_split(text) - pages = self._paginate_slide(lines, line_end) - if len(pages) > 1: - # Songs and Custom - if item.is_capable(ItemCapabilities.AllowsVirtualSplit): - # Do not forget the line breaks ! - slides = text.split(u'[---]') - pages = [] - for slide in slides: - lines = slide.strip(u'\n').split(u'\n') - pages.extend(self._paginate_slide(lines, line_end)) - # Bibles - elif item.is_capable(ItemCapabilities.AllowsWordSplit): - pages = self._paginate_slide_words(text, line_end) + # Bibles + if item.is_capable(ItemCapabilities.AllowsWordSplit): + pages = self._paginate_slide_words(text, line_end) + else: + # Clean up line endings. + lines = self._lines_split(text) + pages = self._paginate_slide(lines, line_end) + #TODO: Maybe move the detection to _paginate_slide. + if len(pages) > 1: + # Songs and Custom + if item.is_capable(ItemCapabilities.AllowsVirtualSplit): + # Do not forget the line breaks! + slides = text.split(u'[---]') + pages = [] + for slide in slides: + lines = slide.strip(u'\n').split(u'\n') + pages.extend(self._paginate_slide(lines, line_end)) new_pages = [] for page in pages: while page.endswith(u'
'): From 9b10c81e7b7afac4c17105f93fe8ea3dee2f0d78 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 13 Jun 2011 14:59:52 +0200 Subject: [PATCH 07/29] comments --- openlp/core/lib/renderer.py | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index a6db56614..04f8f0404 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -229,7 +229,6 @@ class Renderer(object): # Clean up line endings. lines = self._lines_split(text) pages = self._paginate_slide(lines, line_end) - #TODO: Maybe move the detection to _paginate_slide. if len(pages) > 1: # Songs and Custom if item.is_capable(ItemCapabilities.AllowsVirtualSplit): @@ -410,12 +409,13 @@ class Renderer(object): def _binary_chop(self, formatted, previous_html, previous_raw, html_list, raw_list, separator, line_end): """ - This implements the binary chop algorithm for faster rendering. However, - it is assumed that this method is **only** called, when the text to be - rendered does not fit as a whole. + This implements the binary chop algorithm for faster rendering. This + algorithm works line based (line by line) and word based (word by word). + It is assumed that this method is **only** called, when the lines/words to be + rendered do not fit as a whole. ``formatted`` - The list of slides. + The list to append any slides. ``previous_html`` The html text which is know to fit on a slide, but is not yet added @@ -426,12 +426,12 @@ class Renderer(object): but is not yet added to the list of slides. (unicode string) ``html_list`` - The text which does not fit on a slide and needs to be processed + The elements which do not fit on a slide and needs to be processed using the binary chop. The text contains html. ``raw_list`` - The text which does not fit on a slide and needs to be processed - using the binary chop. The text can contain display tags. + The elements which do not fit on a slide and needs to be processed + using the binary chop. The elements can contain display tags. ``separator`` The separator for the elements. For lines this is `u'
'`` and for @@ -469,9 +469,7 @@ class Renderer(object): break else: continue - # Check if the rest of the line fits on the slide. If it - # does we do not have to do the much more intensive "word by - # word" checking. + # Check if the remaining elements fit on the slide. html = self.page_shell + \ separator.join(html_list[index + 1:]).strip() + HTML_END self.web.setHtml(html) @@ -482,8 +480,8 @@ class Renderer(object): raw_list[index + 1:]).strip() + line_end break else: - # The other words do not fit, thus reset the indexes, - # create a new list and continue with "word by word". + # The remaining elements do not fit, thus reset the indexes, + # create a new list and continue. raw_list = raw_list[index + 1:] html_list = html_list[index + 1:] smallest_index = 0 From 24e737fa99d2d078c6154f15f2756d9983dbca0d Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 13 Jun 2011 16:36:18 +0200 Subject: [PATCH 08/29] fixed long line --- openlp/core/lib/renderer.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index 04f8f0404..1ec6edfa6 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -73,6 +73,8 @@ class Renderer(object): self.screens = ScreenList.get_instance() self.service_theme = u'' self.theme_level = u'' + self._binary_chop( + ) self.override_background = None self.theme_data = None self.bg_frame = None @@ -411,8 +413,8 @@ class Renderer(object): """ This implements the binary chop algorithm for faster rendering. This algorithm works line based (line by line) and word based (word by word). - It is assumed that this method is **only** called, when the lines/words to be - rendered do not fit as a whole. + It is assumed that this method is **only** called, when the lines/words + to be rendered do not fit as a whole. ``formatted`` The list to append any slides. From 254cf20b9fbed6814b7e3eb11e08581e1429e64e Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 13 Jun 2011 16:41:52 +0200 Subject: [PATCH 09/29] fixed non sense --- openlp/core/lib/renderer.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index 1ec6edfa6..696d49095 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -73,8 +73,6 @@ class Renderer(object): self.screens = ScreenList.get_instance() self.service_theme = u'' self.theme_level = u'' - self._binary_chop( - ) self.override_background = None self.theme_data = None self.bg_frame = None From 7d5e349602727d8ccfb9a3b47b37e2ada46a7cf5 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 13 Jun 2011 17:19:49 +0200 Subject: [PATCH 10/29] removed test lines --- openlp/core/lib/serviceitem.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py index 6a8ba81c4..fa1b4b92b 100644 --- a/openlp/core/lib/serviceitem.py +++ b/openlp/core/lib/serviceitem.py @@ -171,9 +171,6 @@ class ServiceItem(object): self.themedata = self.renderer.theme_data if self.service_item_type == ServiceItemType.Text: log.debug(u'Formatting slides') - import time - import datetime - start = time.time() for slide in self._raw_frames: pages = self.renderer.format_slide(slide[u'raw_slide'], self) for page in pages: @@ -185,7 +182,6 @@ class ServiceItem(object): u'html': html.replace(u'&nbsp;', u' '), u'verseTag': slide[u'verseTag'] }) - print unicode(datetime.timedelta(seconds=time.time() - start)) elif self.service_item_type == ServiceItemType.Image or \ self.service_item_type == ServiceItemType.Command: pass From bd6733eef13f63e0d6a82aced981051ae0942cb5 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Tue, 14 Jun 2011 08:58:49 +0200 Subject: [PATCH 11/29] we can replace before splitting --- openlp/core/lib/renderer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index 696d49095..a8f4e842f 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -503,5 +503,5 @@ class Renderer(object): """ # this parse we do not want to use this so remove it text = text.replace(u'\n[---]', u'') - lines = text.split(u'\n') - return [line.replace(u'[---]', u'') for line in lines] + text = text.replace(u'[---]', u'') + return text.split(u'\n') From 4d20334cce1d24d65732c5fb4178c12962badbed Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 23 Jun 2011 15:32:32 +0200 Subject: [PATCH 12/29] changed instance variable to camelCase as the class is Qt based --- openlp/core/lib/renderer.py | 14 +++++++------- openlp/core/lib/serviceitem.py | 2 +- openlp/core/ui/maindisplay.py | 14 +++++++------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index a8f4e842f..7c3189789 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -56,11 +56,11 @@ class Renderer(object): """ log.info(u'Renderer Loaded') - def __init__(self, image_manager, theme_manager): + def __init__(self, imageManager, theme_manager): """ Initialise the render manager. - ``image_manager`` + ``imageManager`` A ImageManager instance which takes care of e. g. caching and resizing images. @@ -69,7 +69,7 @@ class Renderer(object): """ log.debug(u'Initialisation started') self.theme_manager = theme_manager - self.image_manager = image_manager + self.imageManager = imageManager self.screens = ScreenList.get_instance() self.service_theme = u'' self.theme_level = u'' @@ -77,7 +77,7 @@ class Renderer(object): self.theme_data = None self.bg_frame = None self.force_page = False - self.display = MainDisplay(None, self.image_manager, False) + self.display = MainDisplay(None, self.imageManager, False) self.display.setup() def update_display(self): @@ -88,7 +88,7 @@ class Renderer(object): self._calculate_default(self.screens.current[u'size']) if self.display: self.display.close() - self.display = MainDisplay(None, self.image_manager, False) + self.display = MainDisplay(None, self.imageManager, False) self.display.setup() self.bg_frame = None self.theme_data = None @@ -167,7 +167,7 @@ class Renderer(object): self._build_text_rectangle(self.theme_data) # if No file do not update cache if self.theme_data.background_filename: - self.image_manager.add_image(self.theme_data.theme_name, + self.imageManager.add_image(self.theme_data.theme_name, self.theme_data.background_filename) return self._rect, self._rect_footer @@ -193,7 +193,7 @@ class Renderer(object): # make big page for theme edit dialog to get line count serviceItem.add_from_text(u'', VERSE + VERSE + VERSE) else: - self.image_manager.del_image(theme_data.theme_name) + self.imageManager.del_image(theme_data.theme_name) serviceItem.add_from_text(u'', VERSE) serviceItem.renderer = self serviceItem.raw_footer = FOOTER diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py index ced78ad68..2ab09dbeb 100644 --- a/openlp/core/lib/serviceitem.py +++ b/openlp/core/lib/serviceitem.py @@ -208,7 +208,7 @@ class ServiceItem(object): """ self.service_item_type = ServiceItemType.Image self._raw_frames.append({u'title': title, u'path': path}) - self.renderer.image_manager.add_image(title, path) + self.renderer.imageManager.add_image(title, path) self._new_item() def add_from_text(self, title, raw_slide, verse_tag=None): diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index b661b1e49..1b9098816 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -48,13 +48,13 @@ class MainDisplay(QtGui.QGraphicsView): """ This is the display screen. """ - def __init__(self, parent, image_manager, live): + def __init__(self, parent, imageManager, live): if live: QtGui.QGraphicsView.__init__(self) else: QtGui.QGraphicsView.__init__(self, parent) self.isLive = live - self.image_manager = image_manager + self.imageManager = imageManager self.screens = ScreenList.get_instance() self.alertTab = None self.hideMode = None @@ -232,7 +232,7 @@ class MainDisplay(QtGui.QGraphicsView): """ API for replacement backgrounds so Images are added directly to cache """ - self.image_manager.add_image(name, path) + self.imageManager.add_image(name, path) self.image(name) if hasattr(self, u'serviceItem'): self.override[u'image'] = name @@ -247,7 +247,7 @@ class MainDisplay(QtGui.QGraphicsView): The name of the image to be displayed """ log.debug(u'image to display') - image = self.image_manager.get_image_bytes(name) + image = self.imageManager.get_image_bytes(name) self.resetVideo() self.displayImage(image) return self.preview() @@ -477,13 +477,13 @@ class MainDisplay(QtGui.QGraphicsView): self.override = {} else: # replace the background - background = self.image_manager. \ + background = self.imageManager. \ get_image_bytes(self.override[u'image']) if self.serviceItem.themedata.background_filename: - self.serviceItem.bg_image_bytes = self.image_manager. \ + self.serviceItem.bg_image_bytes = self.imageManager. \ get_image_bytes(self.serviceItem.themedata.theme_name) if image: - image_bytes = self.image_manager.get_image_bytes(image) + image_bytes = self.imageManager.get_image_bytes(image) else: image_bytes = None html = build_html(self.serviceItem, self.screen, self.alertTab, From 39caaca8d95e10feb86a69ac37171e41664583f8 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 23 Jun 2011 16:34:43 +0200 Subject: [PATCH 13/29] comment fixes --- openlp/core/lib/renderer.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index 7c3189789..11653533c 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -412,7 +412,7 @@ class Renderer(object): This implements the binary chop algorithm for faster rendering. This algorithm works line based (line by line) and word based (word by word). It is assumed that this method is **only** called, when the lines/words - to be rendered do not fit as a whole. + to be rendered do **not** fit as a whole. ``formatted`` The list to append any slides. @@ -434,8 +434,8 @@ class Renderer(object): using the binary chop. The elements can contain display tags. ``separator`` - The separator for the elements. For lines this is `u'
'`` and for - words this is u' '. + The separator for the elements. For lines this is ``u'
'`` and + for words this is ``u' '``. ``line_end`` The text added after each "element line". Either ``u' '`` or From 74d2b2d25c7d43dd84dc16383b114bef0726855f Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 27 Jun 2011 13:44:57 +0200 Subject: [PATCH 14/29] replaced
by
--- openlp/core/lib/__init__.py | 2 +- openlp/core/lib/renderer.py | 16 ++++++++-------- openlp/core/lib/serviceitem.py | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/openlp/core/lib/__init__.py b/openlp/core/lib/__init__.py index 7fbd5243c..187226272 100644 --- a/openlp/core/lib/__init__.py +++ b/openlp/core/lib/__init__.py @@ -202,7 +202,7 @@ def clean_tags(text): """ Remove Tags from text for display """ - text = text.replace(u'
', u'\n') + text = text.replace(u'
', u'\n') text = text.replace(u'{br}', u'\n') text = text.replace(u' ', u' ') for tag in DisplayTags.get_html_tags(): diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index 11653533c..3832cb75c 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -219,7 +219,7 @@ class Renderer(object): """ log.debug(u'format slide') # Add line endings after each line of text used for bibles. - line_end = u'
' + line_end = u'
' if item.is_capable(ItemCapabilities.NoLineBreaks): line_end = u' ' # Bibles @@ -240,7 +240,7 @@ class Renderer(object): pages.extend(self._paginate_slide(lines, line_end)) new_pages = [] for page in pages: - while page.endswith(u'
'): + while page.endswith(u'
'): page = page[:-4] new_pages.append(page) return new_pages @@ -326,13 +326,13 @@ class Renderer(object): The text to be fitted on the slide split into lines. ``line_end`` - The text added after each line. Either ``u' '`` or ``u'
``. + The text added after each line. Either ``u' '`` or ``u'
``. """ log.debug(u'_paginate_slide - Start') formatted = [] previous_html = u'' previous_raw = u'' - separator = u'
' + separator = u'
' html_lines = map(expand_tags, lines) html = self.page_shell + separator.join(html_lines) + HTML_END self.web.setHtml(html) @@ -357,7 +357,7 @@ class Renderer(object): The words to be fitted on the slide split into lines. ``line_end`` - The text added after each line. Either ``u' '`` or ``u'
``. This + The text added after each line. Either ``u' '`` or ``u'
``. This is needed for bibles. """ log.debug(u'_paginate_slide_words - Start') @@ -434,12 +434,12 @@ class Renderer(object): using the binary chop. The elements can contain display tags. ``separator`` - The separator for the elements. For lines this is ``u'
'`` and + The separator for the elements. For lines this is ``u'
'`` and for words this is ``u' '``. ``line_end`` The text added after each "element line". Either ``u' '`` or - ``u'
``. This is needed for bibles. + ``u'
``. This is needed for bibles. """ smallest_index = 0 highest_index = len(html_list) - 1 @@ -459,7 +459,7 @@ class Renderer(object): # We found the number of words which will fit. if smallest_index == index or highest_index == index: index = smallest_index - formatted.append(previous_raw.rstrip(u'
') + + formatted.append(previous_raw.rstrip(u'
') + separator.join(raw_list[:index + 1])) previous_html = u'' previous_raw = u'' diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py index 2ab09dbeb..e5a6c4033 100644 --- a/openlp/core/lib/serviceitem.py +++ b/openlp/core/lib/serviceitem.py @@ -174,7 +174,7 @@ class ServiceItem(object): for slide in self._raw_frames: pages = self.renderer.format_slide(slide[u'raw_slide'], self) for page in pages: - page = page.replace(u'
', u'{br}') + page = page.replace(u'
', u'{br}') html = expand_tags(cgi.escape(page.rstrip())) self._display_frames.append({ u'title': clean_tags(page), @@ -194,7 +194,7 @@ class ServiceItem(object): if self.raw_footer is None: self.raw_footer = [] self.foot_text = \ - u'
'.join([footer for footer in self.raw_footer if footer]) + u'
'.join([footer for footer in self.raw_footer if footer]) def add_from_image(self, path, title): """ From 86c0eea4733fdd2d79f92fa38c1cd93e58d0f263 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 27 Jun 2011 13:51:25 +0200 Subject: [PATCH 15/29] changed theme_manager to themeManager as it is Qt based --- openlp/core/lib/renderer.py | 10 +++++----- openlp/plugins/songs/forms/editsongform.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index 3832cb75c..2b20900a9 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -56,7 +56,7 @@ class Renderer(object): """ log.info(u'Renderer Loaded') - def __init__(self, imageManager, theme_manager): + def __init__(self, imageManager, themeManager): """ Initialise the render manager. @@ -64,11 +64,11 @@ class Renderer(object): A ImageManager instance which takes care of e. g. caching and resizing images. - ``theme_manager`` + ``themeManager`` The ThemeManager instance, used to get the current theme details. """ log.debug(u'Initialisation started') - self.theme_manager = theme_manager + self.themeManager = themeManager self.imageManager = imageManager self.screens = ScreenList.get_instance() self.service_theme = u'' @@ -108,7 +108,7 @@ class Renderer(object): self.global_theme = global_theme self.theme_level = theme_level self.global_theme_data = \ - self.theme_manager.getThemeData(self.global_theme) + self.themeManager.getThemeData(self.global_theme) self.theme_data = None def set_service_theme(self, service_theme): @@ -162,7 +162,7 @@ class Renderer(object): if override_levels: self.theme_data = override_theme else: - self.theme_data = self.theme_manager.getThemeData(theme) + self.theme_data = self.themeManager.getThemeData(theme) self._calculate_default(self.screens.current[u'size']) self._build_text_rectangle(self.theme_data) # if No file do not update cache diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index 05c891a55..171564b24 100644 --- a/openlp/plugins/songs/forms/editsongform.py +++ b/openlp/plugins/songs/forms/editsongform.py @@ -90,7 +90,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): self.onVerseListViewPressed) QtCore.QObject.connect(self.themeAddButton, QtCore.SIGNAL(u'clicked()'), - self.mediaitem.plugin.renderer.theme_manager.onAddTheme) + self.mediaitem.plugin.renderer.themeManager.onAddTheme) QtCore.QObject.connect(self.maintenanceButton, QtCore.SIGNAL(u'clicked()'), self.onMaintenanceButtonClicked) QtCore.QObject.connect(Receiver.get_receiver(), From 95743de19f5a76196ae36b396dc1b53a69b26e0f Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Wed, 29 Jun 2011 09:38:04 +0200 Subject: [PATCH 16/29] more html fixes --- openlp/core/lib/displaytags.py | 2 +- openlp/core/lib/renderer.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/openlp/core/lib/displaytags.py b/openlp/core/lib/displaytags.py index 95ce13bda..addab4d75 100644 --- a/openlp/core/lib/displaytags.py +++ b/openlp/core/lib/displaytags.py @@ -111,7 +111,7 @@ class DisplayTags(object): u'start html': u'', u'end tag': u'{/u}', u'end html': u'', u'protected': True}) base_tags.append({u'desc': translate('OpenLP.DisplayTags', 'Break'), - u'start tag': u'{br}', u'start html': u'
', u'end tag': u'', + u'start tag': u'{br}', u'start html': u'
', u'end tag': u'', u'end html': u'', u'protected': True}) DisplayTags.add_html_tags(base_tags) diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index 2b20900a9..4f4a3e4c9 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -241,7 +241,7 @@ class Renderer(object): new_pages = [] for page in pages: while page.endswith(u'
'): - page = page[:-4] + page = page[:-6] new_pages.append(page) return new_pages @@ -357,8 +357,8 @@ class Renderer(object): The words to be fitted on the slide split into lines. ``line_end`` - The text added after each line. Either ``u' '`` or ``u'
``. This - is needed for bibles. + The text added after each line. Either ``u' '`` or ``u'
``. + This is needed for bibles. """ log.debug(u'_paginate_slide_words - Start') formatted = [] From 47e43404aaab2684f0fe2cfb19db01784289df28 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 16 Jul 2011 11:00:30 +0200 Subject: [PATCH 17/29] - added doctype to html - added encoding to html - changed
to
- removed obsolete language attribute --- openlp/core/lib/__init__.py | 2 +- openlp/core/lib/displaytags.py | 2 +- openlp/core/lib/htmlbuilder.py | 8 ++++-- openlp/core/lib/renderer.py | 45 +++++++++++++++++++++--------- openlp/core/lib/serviceitem.py | 6 ++-- openlp/core/ui/printserviceform.py | 2 +- openlp/core/ui/servicemanager.py | 2 +- 7 files changed, 44 insertions(+), 23 deletions(-) diff --git a/openlp/core/lib/__init__.py b/openlp/core/lib/__init__.py index 187226272..7fbd5243c 100644 --- a/openlp/core/lib/__init__.py +++ b/openlp/core/lib/__init__.py @@ -202,7 +202,7 @@ def clean_tags(text): """ Remove Tags from text for display """ - text = text.replace(u'
', u'\n') + text = text.replace(u'
', u'\n') text = text.replace(u'{br}', u'\n') text = text.replace(u' ', u' ') for tag in DisplayTags.get_html_tags(): diff --git a/openlp/core/lib/displaytags.py b/openlp/core/lib/displaytags.py index addab4d75..95ce13bda 100644 --- a/openlp/core/lib/displaytags.py +++ b/openlp/core/lib/displaytags.py @@ -111,7 +111,7 @@ class DisplayTags(object): u'start html': u'', u'end tag': u'{/u}', u'end html': u'', u'protected': True}) base_tags.append({u'desc': translate('OpenLP.DisplayTags', 'Break'), - u'start tag': u'{br}', u'start html': u'
', u'end tag': u'', + u'start tag': u'{br}', u'start html': u'
', u'end tag': u'', u'end html': u'', u'protected': True}) DisplayTags.add_html_tags(base_tags) diff --git a/openlp/core/lib/htmlbuilder.py b/openlp/core/lib/htmlbuilder.py index 1f50e0d65..295a6c1ad 100644 --- a/openlp/core/lib/htmlbuilder.py +++ b/openlp/core/lib/htmlbuilder.py @@ -35,8 +35,10 @@ from openlp.core.lib.theme import BackgroundType, BackgroundGradientType, \ log = logging.getLogger(__name__) HTMLSRC = u""" + + OpenLP Display -