From 05a1c5a328f12a1a665502dfff28c1d43f6f5fcf Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Wed, 15 Jul 2009 18:33:31 +0100 Subject: [PATCH] Clean up phase 1 one of render sort out fix bug in render frames (who forgot the footer) --- openlp/core/lib/renderer.py | 32 ++++++++++++++++---------------- openlp/core/lib/rendermanager.py | 6 +++--- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index 52c7aec2e..a7e494302 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -151,13 +151,13 @@ class Renderer(object): lines = verse.split(u'\n') for line in lines: text.append(line) - print text + #print text split_text = self.pre_render_text(text) # print "-----------------------------" # print split_text # split_text = self._split_set_of_lines(text, False) - print "-----------------------------" - print split_text +# print "-----------------------------" +# print split_text log.debug(u'format_slide - End') return split_text @@ -165,28 +165,28 @@ class Renderer(object): metrics = QtGui.QFontMetrics(self.mainFont) #take the width work out approx how many characters and add 50% line_width = self._rect.width() - self._right_margin - #number of lines on a page - page_length = self._rect.height() / metrics.height() + #number of lines on a page - adjust for rounding up. + page_length = int(self._rect.height() / metrics.height()) - 1 ave_line_width = line_width / metrics.averageCharWidth() - print ave_line_width + #print ave_line_width ave_line_width = int(ave_line_width + (ave_line_width * 0.5)) - print ave_line_width + #print ave_line_width split_pages = [] page = [] split_lines = [] count = 0 for line in text: - print line , len(line) + #print line , len(line) if len(line) > ave_line_width: while len(line) > 0: pos = line.find(u' ', ave_line_width) - print ave_line_width, pos, line[:pos] + #print ave_line_width, pos, line[:pos] split_text = line[:pos] - print metrics.width(split_text, -1), line_width + #print metrics.width(split_text, -1), line_width while metrics.width(split_text, -1) > line_width: #Find the next space to the left pos = line[:pos].rfind(u' ') - print ave_line_width, pos, line[:pos] + #print ave_line_width, pos, line[:pos] #no more spaces found if pos == -1: split_text = line @@ -198,11 +198,11 @@ class Renderer(object): if len(line) <= ave_line_width: split_lines.append(line) line = u'' - count += 1 - if count == 50: - a = c - print split_lines - print line +# count += 1 +# if count == 50: +# a = c + #print split_lines + #print line else: split_lines.append(line) line = u'' diff --git a/openlp/core/lib/rendermanager.py b/openlp/core/lib/rendermanager.py index 6c3d11001..3efc03858 100644 --- a/openlp/core/lib/rendermanager.py +++ b/openlp/core/lib/rendermanager.py @@ -138,12 +138,12 @@ class RenderManager(object): main_rect = None footer_rect = None if theme.font_main_override == False: - main_rect = QtCore.QRect(10,0, self.width-1, self.height-1) + main_rect = QtCore.QRect(10,0, self.width - 1, self.footer_start - 20) else: main_rect = QtCore.QRect(int(theme.font_main_x) , int(theme.font_main_y), - int(theme.font_main_width)-1, int(theme.font_main_height)-1) + int(theme.font_main_width)-1, int(theme.font_main_height) - 1) if theme.font_footer_override == False: - footer_rect = QtCore.QRect(10,self.footer_start, self.width-1, self.height-self.footer_start) + footer_rect = QtCore.QRect(10,self.footer_start, self.width - 1, self.height-self.footer_start) else: footer_rect = QtCore.QRect(int(theme.font_footer_x),int(theme.font_footer_y), int(theme.font_footer_width)-1, int(theme.font_footer_height)-1)