forked from openlp/openlp
Clean up phase 1 one of render sort out
fix bug in render frames (who forgot the footer)
This commit is contained in:
parent
511088b73b
commit
05a1c5a328
@ -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''
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user