forked from openlp/openlp
Bible text display cleanups
This commit is contained in:
parent
6d5eae7377
commit
f3e62c9f14
@ -138,7 +138,7 @@ class Renderer(object):
|
||||
if self.bg_frame is None:
|
||||
self._generate_background_frame()
|
||||
|
||||
def format_slide(self, words):
|
||||
def format_slide(self, words, line_break):
|
||||
"""
|
||||
Figure out how much text can appear on a slide, using the current
|
||||
theme settings.
|
||||
@ -147,6 +147,9 @@ class Renderer(object):
|
||||
The words to be fitted on the slide.
|
||||
"""
|
||||
log.debug(u'format_slide - Start')
|
||||
line_end = u''
|
||||
if line_break:
|
||||
line_end = u'<br>'
|
||||
words = words.replace(u'\r\n', u'\n')
|
||||
verses_text = words.split(u'\n')
|
||||
text = []
|
||||
@ -171,7 +174,7 @@ class Renderer(object):
|
||||
old_html_text = u''
|
||||
for line in text:
|
||||
# mark line ends
|
||||
temp_text = temp_text + line + u'<br>'
|
||||
temp_text = temp_text + line + line_end
|
||||
html_text = shell % temp_text
|
||||
doc.setHtml(html_text)
|
||||
#Text too long so gone to next mage
|
||||
|
@ -210,7 +210,7 @@ class RenderManager(object):
|
||||
frame, raw_html = serviceItem.get_rendered_frame(0)
|
||||
return self.display.text(raw_html)
|
||||
|
||||
def format_slide(self, words):
|
||||
def format_slide(self, words, line_break):
|
||||
"""
|
||||
Calculate how much text can fit on a slide.
|
||||
|
||||
@ -219,7 +219,7 @@ class RenderManager(object):
|
||||
"""
|
||||
log.debug(u'format slide')
|
||||
self.build_text_rectangle(self.themedata)
|
||||
return self.renderer.format_slide(words)
|
||||
return self.renderer.format_slide(words, line_break)
|
||||
|
||||
# def generate_slide(self, main_text):
|
||||
# """
|
||||
|
@ -57,6 +57,7 @@ class ItemCapabilities(object):
|
||||
RequiresMedia = 4
|
||||
AllowsLoop = 5
|
||||
AllowsAdditions = 6
|
||||
NoLineBreaks = 7
|
||||
|
||||
class ServiceItem(object):
|
||||
"""
|
||||
@ -140,6 +141,9 @@ class ServiceItem(object):
|
||||
log.debug(u'Render called')
|
||||
self._display_frames = []
|
||||
self.bg_frame = None
|
||||
line_break = True
|
||||
if self.is_capable(ItemCapabilities.NoLineBreaks):
|
||||
line_break = False
|
||||
if self.service_item_type == ServiceItemType.Text:
|
||||
log.debug(u'Formatting slides')
|
||||
theme = None
|
||||
@ -151,7 +155,8 @@ class ServiceItem(object):
|
||||
self.themedata = self.render_manager.themedata
|
||||
for slide in self._raw_frames:
|
||||
before = time.time()
|
||||
formated = self.render_manager.format_slide(slide[u'raw_slide'])
|
||||
formated = self.render_manager \
|
||||
.format_slide(slide[u'raw_slide'], line_break)
|
||||
for page in formated:
|
||||
self._display_frames.append(
|
||||
{u'title': self.render_manager.clean(page),
|
||||
|
@ -544,9 +544,11 @@ class BibleMediaItem(MediaManagerItem):
|
||||
else:
|
||||
#Paragraph style force new line per verse
|
||||
if self.parent.settings_tab.layout_style == 1:
|
||||
text = text + u'\n\n'
|
||||
text = text + u'\n'
|
||||
else:
|
||||
text = text + u'\ngus '
|
||||
# split the line but do not replace line breaks in renderer
|
||||
service_item.add_capability(ItemCapabilities.NoLineBreaks)
|
||||
text = text + u'\n'
|
||||
bible_text = u'%s %s %s' % (bible_text, verse_text, text)
|
||||
#if we are verse per slide then create slide
|
||||
if self.parent.settings_tab.layout_style == 0:
|
||||
|
Loading…
Reference in New Issue
Block a user