diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py index b12a27f1d..62064dc06 100644 --- a/openlp/core/lib/serviceitem.py +++ b/openlp/core/lib/serviceitem.py @@ -119,6 +119,7 @@ class ServiceItem(object): self.image_border = u'#000000' self.background_audio = [] self.theme_overwritten = False + self.temporary_edit = False self._new_item() def _new_item(self): diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 8ad2db9c2..fa1ccede0 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -37,7 +37,7 @@ log = logging.getLogger(__name__) from PyQt4 import QtCore, QtGui from openlp.core.lib import OpenLPToolbar, ServiceItem, Receiver, build_icon, \ - ItemCapabilities, SettingsManager, translate + ItemCapabilities, SettingsManager, translate, str_to_bool from openlp.core.lib.theme import ThemeLevel from openlp.core.lib.ui import UiStrings, critical_error_message_box, \ context_menu_action, context_menu_separator, find_and_set_in_combo_box @@ -670,6 +670,7 @@ class ServiceManager(QtGui.QWidget): # if the item has been processed if serviceItem._uuid == self.loadItem_uuid: serviceItem.edit_id = int(self.loadItem_editId) + serviceItem.temporary_edit = self.loadItem_temporary self.addServiceItem(serviceItem, repaint=False) delete_file(p_file) self.setFileName(fileName) @@ -999,6 +1000,17 @@ class ServiceManager(QtGui.QWidget): painter.drawImage(0, 0, overlay) painter.end() treewidgetitem.setIcon(0, build_icon(icon)) + elif serviceitem.temporary_edit: + icon = QtGui.QImage(serviceitem.icon) + icon = icon.scaled(80, 80, QtCore.Qt.KeepAspectRatio, + QtCore.Qt.SmoothTransformation) + overlay = QtGui.QImage(':/general/general_export.png') + overlay = overlay.scaled(40, 40, QtCore.Qt.KeepAspectRatio, + QtCore.Qt.SmoothTransformation) + painter = QtGui.QPainter(icon) + painter.drawImage(40, 0, overlay) + painter.end() + treewidgetitem.setIcon(0, build_icon(icon)) else: treewidgetitem.setIcon(0, serviceitem.iconic_representation) else: @@ -1006,6 +1018,11 @@ class ServiceManager(QtGui.QWidget): build_icon(u':/general/general_delete.png')) treewidgetitem.setText(0, serviceitem.get_display_title()) tips = [] + if serviceitem.temporary_edit: + tips.append(u'%s: %s' % + (unicode(translate('OpenLP.ServiceManager', 'Edit')), + (unicode(translate('OpenLP.ServiceManager', + 'Service copy only'))))) if serviceitem.theme and serviceitem.theme != -1: tips.append(u'%s: %s' % (unicode(translate('OpenLP.ServiceManager', 'Slide theme')), @@ -1127,8 +1144,9 @@ class ServiceManager(QtGui.QWidget): Triggered from plugins to update service items. Save the values as they will be used as part of the service load """ - editId, self.loadItem_uuid = message.split(u':') + editId, self.loadItem_uuid, temporary = message.split(u':') self.loadItem_editId = int(editId) + self.loadItem_temporary = str_to_bool(temporary) def replaceServiceItem(self, newItem): """ diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index be6dfa6be..052fb5b7b 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -540,6 +540,7 @@ class SongMediaItem(MediaManagerItem): Song.search_title.asc()) editId = 0 add_song = True + temporary = False if search_results: for song in search_results: author_list = item.data_string[u'authors'] @@ -565,17 +566,18 @@ class SongMediaItem(MediaManagerItem): self._updateBackgroundAudio(song, item) editId = song.id self.onSearchTextButtonClick() - elif not self.addSongFromService: + elif add_song and not self.addSongFromService: # Make sure we temporary import formatting tags. song = self.openLyrics.xml_to_song(item.xml_version, True) # If there's any backing tracks, copy them over. if len(item.background_audio) > 0: self._updateBackgroundAudio(song, item) editId = song.id + temporary = True # Update service with correct song id. if editId: Receiver.send_message(u'service_item_update', - u'%s:%s' % (editId, item._uuid)) + u'%s:%s:%s' % (editId, item._uuid, temporary)) def search(self, string): """