More Renderer work

This commit is contained in:
Tim Bentley 2009-06-02 05:09:43 +01:00
commit b891b58bad
1 changed files with 12 additions and 8 deletions

View File

@ -109,6 +109,7 @@ class Renderer:
""" """
External API to sort out the text to pe placed on the frame External API to sort out the text to pe placed on the frame
""" """
print "########## Format Slide ##################"
log.debug(u'format_slide %s', words) log.debug(u'format_slide %s', words)
verses = [] verses = []
words = words.replace("\r\n", "\n") words = words.replace("\r\n", "\n")
@ -120,10 +121,6 @@ class Renderer:
text.append(line) text.append(line)
print self._split_set_of_lines(text, False) print self._split_set_of_lines(text, False)
#verses_text = []
#for verse in verses:
# for line in verse:
# verses_text.append(line)
print "text ", text print "text ", text
return text return text
@ -141,10 +138,13 @@ class Renderer:
def generate_frame_from_lines(self, lines, footer_lines=None): def generate_frame_from_lines(self, lines, footer_lines=None):
""" """
render a set of lines according to the theme, return bounding box Render a set of lines according to the theme, return bounding box
""" """
print "########## Generate frame from lines ##################"
log.debug(u'generate_frame_from_lines - Start') log.debug(u'generate_frame_from_lines - Start')
print "Render Lines ", lines
bbox = self._render_lines_unaligned(lines, False) bbox = self._render_lines_unaligned(lines, False)
if footer_lines is not None: if footer_lines is not None:
bbox1 = self._render_lines_unaligned(footer_lines, True) bbox1 = self._render_lines_unaligned(footer_lines, True)
@ -204,10 +204,7 @@ class Renderer:
painter.drawPath(rectPath) painter.drawPath(rectPath)
elif self._theme.background_type== u'image': # image elif self._theme.background_type== u'image': # image
#r = self._frame.rect()
#log.debug(u'Image size details %d %d %d %d ', r.x(), r.y(), r.width(),r.height())
if self.bg_image is not None: if self.bg_image is not None:
#painter.drawPixmap(self.background_offsetx,self.background_offsety, self.bg_image)
painter.drawPixmap(0 ,0 , self.bg_image) painter.drawPixmap(0 ,0 , self.bg_image)
else: else:
painter.fillRect(self._frame.rect(), QtGui.QColor(u'#000000')) painter.fillRect(self._frame.rect(), QtGui.QColor(u'#000000'))
@ -225,6 +222,11 @@ class Renderer:
We'll do this by getting the bounding box of each line, and then summing them appropriately We'll do this by getting the bounding box of each line, and then summing them appropriately
Returns a list of [lists of lines], one set for each screenful Returns a list of [lists of lines], one set for each screenful
""" """
############ THIS IS WRONG SO FIX IT
log.debug(u'Split set of lines') log.debug(u'Split set of lines')
bboxes = [] bboxes = []
print "Lines ", lines print "Lines ", lines
@ -368,6 +370,8 @@ class Renderer:
else: else:
align = int(self._theme .display_horizontalAlign) align = int(self._theme .display_horizontalAlign)
print "wrap ", lines
for linenum in range(len(lines)): for linenum in range(len(lines)):
line = lines[linenum] line = lines[linenum]
#find out how wide line is #find out how wide line is