diff --git a/openlp/core/lib/htmlbuilder.py b/openlp/core/lib/htmlbuilder.py index da19cae0e..8e31d8950 100644 --- a/openlp/core/lib/htmlbuilder.py +++ b/openlp/core/lib/htmlbuilder.py @@ -34,8 +34,8 @@ from openlp.core.lib.theme import BackgroundType, BackgroundGradientType, \ log = logging.getLogger(__name__) -# FIXME: Add html5 doctype. However, do not break theme gradients. HTMLSRC = u""" + OpenLP Display @@ -404,7 +404,7 @@ def build_background_css(item, width, height): background = \ u'background: ' \ u'-webkit-gradient(linear, left top, left bottom, ' \ - 'from(%s), to(%s))' % (theme.background_start_color, + 'from(%s), to(%s)) fixed' % (theme.background_start_color, theme.background_end_color) elif theme.background_direction == \ BackgroundGradientType.to_string( \ @@ -412,7 +412,7 @@ def build_background_css(item, width, height): background = \ u'background: ' \ u'-webkit-gradient(linear, left top, right bottom, ' \ - 'from(%s), to(%s))' % (theme.background_start_color, + 'from(%s), to(%s)) fixed' % (theme.background_start_color, theme.background_end_color) elif theme.background_direction == \ BackgroundGradientType.to_string \ @@ -420,20 +420,21 @@ def build_background_css(item, width, height): background = \ u'background: ' \ u'-webkit-gradient(linear, left bottom, right top, ' \ - 'from(%s), to(%s))' % (theme.background_start_color, + 'from(%s), to(%s)) fixed' % (theme.background_start_color, theme.background_end_color) elif theme.background_direction == \ BackgroundGradientType.to_string \ (BackgroundGradientType.Vertical): background = \ u'background: -webkit-gradient(linear, left top, ' \ - u'right top, from(%s), to(%s))' % \ + u'right top, from(%s), to(%s)) fixed' % \ (theme.background_start_color, theme.background_end_color) else: background = \ u'background: -webkit-gradient(radial, %s 50%%, 100, %s ' \ - u'50%%, %s, from(%s), to(%s))' % (width, width, width, - theme.background_start_color, theme.background_end_color) + u'50%%, %s, from(%s), to(%s)) fixed' % (width, width, + width, theme.background_start_color, + theme.background_end_color) return background def build_lyrics_css(item, webkitvers): diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index abfd658ba..6d48707b4 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -44,6 +44,7 @@ VERSE = u'The Lord said to {r}Noah{/r}: \n' \ 'Get those children out of the muddy, muddy \n' \ '{r}C{/r}{b}h{/b}{bl}i{/bl}{y}l{/y}{g}d{/g}{pk}' \ 'r{/pk}{o}e{/o}{pp}n{/pp} of the Lord\n' +VERSE_FOR_LINE_COUNT = u'\n'.join(map(unicode, xrange(50))) FOOTER = [u'Arky Arky (Unknown)', u'Public Domain', u'CCLI 123456'] class Renderer(object): @@ -190,7 +191,7 @@ class Renderer(object): serviceItem.theme = theme_data if self.force_page: # make big page for theme edit dialog to get line count - serviceItem.add_from_text(u'', VERSE + VERSE + VERSE) + serviceItem.add_from_text(u'', VERSE_FOR_LINE_COUNT) else: self.imageManager.del_image(theme_data.theme_name) serviceItem.add_from_text(u'', VERSE) @@ -224,14 +225,10 @@ class Renderer(object): # Bibles if item.is_capable(ItemCapabilities.CanWordSplit): pages = self._paginate_slide_words(text.split(u'\n'), line_end) - else: - # Clean up line endings. - lines = self._lines_split(text) - pages = self._paginate_slide(lines, line_end) - # Songs and Custom - if item.is_capable(ItemCapabilities.CanSoftBreak) and \ - len(pages) > 1 and u'[---]' in text: - pages = [] + # Songs and Custom + elif item.is_capable(ItemCapabilities.CanSoftBreak): + pages = [] + if u'[---]' in text: while True: slides = text.split(u'\n[---]\n', 2) # If there are (at least) two occurrences of [---] we use @@ -272,6 +269,11 @@ class Renderer(object): lines = text.strip(u'\n').split(u'\n') pages.extend(self._paginate_slide(lines, line_end)) break + else: + # Clean up line endings. + pages = self._paginate_slide(text.split(u'\n'), line_end) + else: + pages = self._paginate_slide(text.split(u'\n'), line_end) new_pages = [] for page in pages: while page.endswith(u'
'): @@ -585,12 +587,3 @@ class Renderer(object): # this parse we are to be wordy line = line.replace(u'\n', u' ') return line.split(u' ') - - def _lines_split(self, text): - """ - Split the slide up by physical line - """ - # this parse we do not want to use this so remove it - text = text.replace(u'\n[---]', u'') - text = text.replace(u'[---]', u'') - return text.split(u'\n') diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 911b04674..c9f058351 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -660,14 +660,17 @@ class ServiceManager(QtGui.QWidget): for item in items: self.mainwindow.incrementProgressBar() serviceItem = ServiceItem() - serviceItem.from_service = True serviceItem.renderer = self.mainwindow.renderer serviceItem.set_from_service(item, self.servicePath) self.validateItem(serviceItem) - self.addServiceItem(serviceItem, repaint=False) + self.loadItem_uuid = 0 if serviceItem.is_capable(ItemCapabilities.OnLoadUpdate): Receiver.send_message(u'%s_service_load' % serviceItem.name.lower(), serviceItem) + # if the item has been processed + if serviceItem._uuid == self.loadItem_uuid: + serviceItem.edit_id = int(self.loadItem_editId) + self.addServiceItem(serviceItem, repaint=False) delete_file(p_file) self.setFileName(fileName) self.mainwindow.addRecentFile(fileName) @@ -1122,12 +1125,10 @@ class ServiceManager(QtGui.QWidget): def serviceItemUpdate(self, message): """ Triggered from plugins to update service items. + Save the values as they will be used as part of the service load """ - editId, uuid = message.split(u':') - for item in self.serviceItems: - if item[u'service_item']._uuid == uuid: - item[u'service_item'].edit_id = int(editId) - self.setModified() + editId, self.loadItem_uuid = message.split(u':') + self.loadItem_editId = int(editId) def replaceServiceItem(self, newItem): """ diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index 166e49246..98b2d3f24 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -510,7 +510,8 @@ class SongMediaItem(MediaManagerItem): # Add the audio file to the service item. if len(song.media_files) > 0: service_item.add_capability(ItemCapabilities.HasBackgroundAudio) - service_item.background_audio = [m.file_name for m in song.media_files] + service_item.background_audio = \ + [m.file_name for m in song.media_files] return True def serviceLoad(self, item):