forked from openlp/openlp
Chords are now being rendered when printing, but the output needs some work
This commit is contained in:
parent
eed89c4024
commit
ad813bdbee
@ -74,6 +74,7 @@ class ServiceItem(RegistryProperties):
|
|||||||
self.name = plugin.name
|
self.name = plugin.name
|
||||||
self._rendered_slides = None
|
self._rendered_slides = None
|
||||||
self._display_slides = None
|
self._display_slides = None
|
||||||
|
self._print_slides = None
|
||||||
self.title = ''
|
self.title = ''
|
||||||
self.slides = []
|
self.slides = []
|
||||||
self.processor = None
|
self.processor = None
|
||||||
@ -209,6 +210,36 @@ class ServiceItem(RegistryProperties):
|
|||||||
self._create_slides()
|
self._create_slides()
|
||||||
return self._display_slides
|
return self._display_slides
|
||||||
|
|
||||||
|
@property
|
||||||
|
def print_slides(self):
|
||||||
|
"""
|
||||||
|
Render the frames for printing and return them
|
||||||
|
|
||||||
|
:param can_render_chords: bool Whether or not to render the chords
|
||||||
|
"""
|
||||||
|
if not self._print_slides:
|
||||||
|
self._print_slides = []
|
||||||
|
previous_pages = {}
|
||||||
|
index = 0
|
||||||
|
if not self.footer_html:
|
||||||
|
self.footer_html = '<br>'.join([_f for _f in self.raw_footer if _f])
|
||||||
|
for raw_slide in self.slides:
|
||||||
|
verse_tag = raw_slide['verse']
|
||||||
|
if verse_tag in previous_pages and previous_pages[verse_tag][0] == raw_slide:
|
||||||
|
pages = previous_pages[verse_tag][1]
|
||||||
|
else:
|
||||||
|
pages = self.renderer.format_slide(raw_slide['text'], self)
|
||||||
|
previous_pages[verse_tag] = (raw_slide, pages)
|
||||||
|
for page in pages:
|
||||||
|
slide = {
|
||||||
|
'title': raw_slide['title'],
|
||||||
|
'text': render_tags(page, can_render_chords=True, is_printing=True),
|
||||||
|
'verse': index,
|
||||||
|
'footer': self.footer_html,
|
||||||
|
}
|
||||||
|
self._print_slides.append(slide)
|
||||||
|
return self._print_slides
|
||||||
|
|
||||||
def add_from_image(self, path, title, background=None, thumbnail=None):
|
def add_from_image(self, path, title, background=None, thumbnail=None):
|
||||||
"""
|
"""
|
||||||
Add an image slide to the service item.
|
Add an image slide to the service item.
|
||||||
|
@ -218,7 +218,7 @@ class PrintServiceForm(QtWidgets.QDialog, Ui_PrintServiceDialog, RegistryPropert
|
|||||||
if item.is_text():
|
if item.is_text():
|
||||||
verse_def = None
|
verse_def = None
|
||||||
verse_html = None
|
verse_html = None
|
||||||
for slide in item.get_frames():
|
for slide in item.print_slides:
|
||||||
if not verse_def or verse_def != slide['verse'] or verse_html == slide['text']:
|
if not verse_def or verse_def != slide['verse'] or verse_html == slide['text']:
|
||||||
text_div = self._add_element('div', parent=div, class_id='itemText')
|
text_div = self._add_element('div', parent=div, class_id='itemText')
|
||||||
elif 'chordspacing' not in slide['text']:
|
elif 'chordspacing' not in slide['text']:
|
||||||
|
Loading…
Reference in New Issue
Block a user