diff --git a/openlp/core/ui/themeform.py b/openlp/core/ui/themeform.py index 310b34095..eaf54bdb9 100644 --- a/openlp/core/ui/themeform.py +++ b/openlp/core/ui/themeform.py @@ -435,8 +435,10 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard): """ Background style Combo box has changed. """ - self.theme.background_type = BackgroundType.to_string(index) - self.setBackgroundPageValues() + # do not allow updates when screen is building for the first time. + if self.updateThemeAllowed: + self.theme.background_type = BackgroundType.to_string(index) + self.setBackgroundPageValues() def onGradientComboBoxCurrentIndexChanged(self, index): """ diff --git a/openlp/plugins/images/lib/mediaitem.py b/openlp/plugins/images/lib/mediaitem.py index 3aa1523e2..e7f2a7df4 100644 --- a/openlp/plugins/images/lib/mediaitem.py +++ b/openlp/plugins/images/lib/mediaitem.py @@ -31,7 +31,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \ context_menu_action, ItemCapabilities, SettingsManager, translate, \ - check_item_selected + check_item_selected, Receiver from openlp.core.utils import AppLocation, get_images_filter log = logging.getLogger(__name__) @@ -195,6 +195,9 @@ class ImageMediaItem(MediaManagerItem): self.parent.liveController.display.resetImage() def onReplaceClick(self): + """ + Called to replace Live backgound with the video selected + """ if check_item_selected(self.listView, translate('ImagePlugin.MediaItem', 'You must select an image to replace the background with.')): @@ -206,11 +209,12 @@ class ImageMediaItem(MediaManagerItem): self.parent.liveController.display.directImage(name, filename) self.resetAction.setVisible(True) else: - QtGui.QMessageBox.critical(self, - translate('ImagePlugin.MediaItem', 'Live Background Could ' - 'Not Be Replaced'), - unicode(translate('ImagePlugin.MediaItem', - 'The image %s no longer exists.')) % filename) + Receiver.send_message(u'openlp_error_message', { + u'title': translate('ImagePlugin.MediaItem', + 'Live Background Error'), + u'message': unicode(translate('ImagePlugin.MediaItem', + 'There was a problem replacing your background, ' + 'the image file %s no longer exists.')) % filename}) def onPreviewClick(self): MediaManagerItem.onPreviewClick(self) diff --git a/openlp/plugins/media/lib/mediaitem.py b/openlp/plugins/media/lib/mediaitem.py index 8193ca765..cdd075741 100644 --- a/openlp/plugins/media/lib/mediaitem.py +++ b/openlp/plugins/media/lib/mediaitem.py @@ -31,7 +31,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \ ItemCapabilities, SettingsManager, translate, check_item_selected, \ - context_menu_action + context_menu_action, Receiver log = logging.getLogger(__name__) @@ -97,12 +97,21 @@ class MediaMediaItem(MediaManagerItem): def onReplaceClick(self): if check_item_selected(self.listView, - translate('ImagePlugin.MediaItem', + translate('MediaPlugin.MediaItem', 'You must select a media file to replace the background with.')): item = self.listView.currentItem() filename = unicode(item.data(QtCore.Qt.UserRole).toString()) - self.parent.liveController.display.video(filename, 0, True) - self.resetAction.setVisible(True) + if os.path.exists(filename): + (path, name) = os.path.split(filename) + self.parent.liveController.display.video(filename, 0, True) + self.resetAction.setVisible(True) + else: + Receiver.send_message(u'openlp_error_message', { + u'title': translate('MediaPlugin.MediaItem', + 'Live Background Error'), + u'message': unicode(translate('MediaPlugin.MediaItem', + 'There was a problem replacing your background, ' + 'the media file %s no longer exists.')) % filename}) def generateSlideData(self, service_item, item=None, xmlVersion=False): if item is None: diff --git a/openlp/plugins/media/mediaplugin.py b/openlp/plugins/media/mediaplugin.py index 64caaa0de..ad6087daf 100644 --- a/openlp/plugins/media/mediaplugin.py +++ b/openlp/plugins/media/mediaplugin.py @@ -79,7 +79,7 @@ class MediaPlugin(Plugin): return MediaTab(self.name) def getMediaManagerItem(self): - # Create the MediaManagerItem object + # Create the MediaManagerItem object. return MediaMediaItem(self, self, self.icon) def about(self): diff --git a/openlp/plugins/songs/lib/songbeamerimport.py b/openlp/plugins/songs/lib/songbeamerimport.py index f30c40a09..12ff53428 100644 --- a/openlp/plugins/songs/lib/songbeamerimport.py +++ b/openlp/plugins/songs/lib/songbeamerimport.py @@ -27,10 +27,11 @@ The :mod:`songbeamerimport` module provides the functionality for importing SongBeamer songs into the OpenLP database. """ -import logging -import os import chardet import codecs +import logging +import os +import re from openlp.core.lib import translate from openlp.plugins.songs.lib.songimport import SongImport @@ -151,23 +152,25 @@ class SongBeamerImport(SongImport): (u'', u'{/it}'), (u'', u'{u}'), (u'', u'{/u}'), - (u'
', u'{st}'), - (u'
', u'{st}'), - (u'', u'{st}'), (u'

', u'{p}'), (u'

', u'{/p}'), (u'', u'{su}'), (u'', u'{/su}'), (u'', u'{sb}'), (u'', u'{/sb}'), - (u'', u''), - (u'', u''), - (u'', u''), - (u'', u'') + (u'<[/]?br.*?>', u'{st}'), + (u'<[/]?wordwrap>', u''), + (u'<[/]?strike>', u''), + (u'<[/]?h.*?>', u''), + (u'<[/]?s.*?>', u''), + (u'<[/]?linespacing.*?>', u''), + (u'<[/]?c.*?>', u''), + (u'', u''), + (u'', u'') ] for pair in tag_pairs: - self.current_verse = self.current_verse.replace(pair[0], pair[1]) - # TODO: check for unsupported tags (see wiki) and remove them as well. + self.current_verse = re.compile(pair[0]).sub(pair[1], + self.current_verse) def parse_tags(self, line): """