forked from openlp/openlp
More cleanups - page break bibles
This commit is contained in:
parent
44592ae579
commit
bf0dad308f
@ -173,18 +173,9 @@ class Renderer(object):
|
||||
myCursor = QtGui.QTextCursor(doc)
|
||||
layout = doc.documentLayout()
|
||||
formatted = []
|
||||
# if self._theme.display_horizontalAlign == 2:
|
||||
# shell = """<p color="%s" align=center>""" %\
|
||||
# self._theme.font_main_color
|
||||
# elif self._theme.display_horizontalAlign == 1:
|
||||
# shell = """<p color="%s" align=right>""" %\
|
||||
# self._theme.font_main_color
|
||||
# else:
|
||||
# shell = """<p color="%s">""" % self._theme.font_main_color
|
||||
shell = u'<p>%s</p>'
|
||||
temp_text = u''
|
||||
old_html_text = u''
|
||||
page = []
|
||||
for line in text:
|
||||
# mark line ends
|
||||
temp_text = temp_text + line + u'<br>'
|
||||
@ -192,12 +183,10 @@ class Renderer(object):
|
||||
doc.setHtml(html_text)
|
||||
#Text too long so gone to next mage
|
||||
if layout.pageCount() != 1:
|
||||
page.append(shell % old_html_text)
|
||||
formatted.append(page)
|
||||
formatted.append(shell % old_html_text)
|
||||
temp_text = line
|
||||
old_html_text = temp_text
|
||||
page.append(shell % old_html_text)
|
||||
formatted.append(page)
|
||||
formatted.append(shell % old_html_text)
|
||||
log.debug(u'format_slide - End')
|
||||
#return split_text
|
||||
return formatted
|
||||
|
@ -90,7 +90,7 @@ class ServiceItem(object):
|
||||
self.from_plugin = False
|
||||
self.capabilities = []
|
||||
self.is_valid = True
|
||||
self.cache = {}
|
||||
#self.cache = {}
|
||||
self.icon = None
|
||||
self.themedata = None
|
||||
|
||||
@ -132,7 +132,7 @@ class ServiceItem(object):
|
||||
"""
|
||||
log.debug(u'Render called')
|
||||
self._display_frames = []
|
||||
self.clear_cache()
|
||||
#self.clear_cache()
|
||||
self.bg_frame = None
|
||||
self.just_rendered = True
|
||||
if self.service_item_type == ServiceItemType.Text:
|
||||
@ -147,17 +147,11 @@ class ServiceItem(object):
|
||||
before = time.time()
|
||||
formated = self.render_manager.format_slide(slide[u'raw_slide'])
|
||||
for format in formated:
|
||||
lines = u''
|
||||
title = u''
|
||||
for line in format:
|
||||
if title == u'':
|
||||
title = line
|
||||
lines += line + u'\n'
|
||||
self._display_frames.append({u'title': title,
|
||||
u'text': lines.rstrip(),
|
||||
self._display_frames.append({u'title': format,
|
||||
u'text': format.rstrip(),
|
||||
u'verseTag': slide[u'verseTag'] })
|
||||
if len(self._display_frames) in self.cache.keys():
|
||||
del self.cache[len(self._display_frames)]
|
||||
# if len(self._display_frames) in self.cache.keys():
|
||||
# del self.cache[len(self._display_frames)]
|
||||
log.log(15, u'Formatting took %4s' % (time.time() - before))
|
||||
elif self.service_item_type == ServiceItemType.Image:
|
||||
for slide in self._raw_frames:
|
||||
@ -189,7 +183,7 @@ class ServiceItem(object):
|
||||
# else:
|
||||
# frame = self.render_manager.generate_slide(raw_html, u'')
|
||||
frame = None
|
||||
self.cache[row] = frame
|
||||
#self.cache[row] = frame
|
||||
return frame, raw_html[0]
|
||||
|
||||
def add_from_image(self, path, title, image):
|
||||
@ -393,8 +387,8 @@ class ServiceItem(object):
|
||||
"""
|
||||
return self._raw_frames[row][u'path']
|
||||
|
||||
def clear_cache(self):
|
||||
"""
|
||||
Clear's the service item's cache.
|
||||
"""
|
||||
self.cache = {}
|
||||
# def clear_cache(self):
|
||||
# """
|
||||
# Clear's the service item's cache.
|
||||
# """
|
||||
# self.cache = {}
|
||||
|
@ -545,8 +545,8 @@ class SlideController(QtGui.QWidget):
|
||||
self.PreviewListWidget.setCursor(QtCore.Qt.PointingHandCursor)
|
||||
before = time.time()
|
||||
#Clear the old serviceItem cache to release memory
|
||||
if self.serviceItem and self.serviceItem is not serviceItem:
|
||||
self.serviceItem.clear_cache()
|
||||
# if self.serviceItem and self.serviceItem is not serviceItem:
|
||||
# self.serviceItem.clear_cache()
|
||||
self.serviceItem = serviceItem
|
||||
self.PreviewListWidget.clear()
|
||||
self.PreviewListWidget.setRowCount(0)
|
||||
|
Loading…
Reference in New Issue
Block a user