Fixes and notifications

This commit is contained in:
Tim Bentley 2011-12-10 08:45:17 +00:00
parent c5f6dbfa6e
commit 1d673caff4
3 changed files with 25 additions and 4 deletions

View File

@ -119,6 +119,7 @@ class ServiceItem(object):
self.image_border = u'#000000' self.image_border = u'#000000'
self.background_audio = [] self.background_audio = []
self.theme_overwritten = False self.theme_overwritten = False
self.temporary_edit = False
self._new_item() self._new_item()
def _new_item(self): def _new_item(self):

View File

@ -37,7 +37,7 @@ log = logging.getLogger(__name__)
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import OpenLPToolbar, ServiceItem, Receiver, build_icon, \ 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.theme import ThemeLevel
from openlp.core.lib.ui import UiStrings, critical_error_message_box, \ from openlp.core.lib.ui import UiStrings, critical_error_message_box, \
context_menu_action, context_menu_separator, find_and_set_in_combo_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 the item has been processed
if serviceItem._uuid == self.loadItem_uuid: if serviceItem._uuid == self.loadItem_uuid:
serviceItem.edit_id = int(self.loadItem_editId) serviceItem.edit_id = int(self.loadItem_editId)
serviceItem.temporary_edit = self.loadItem_temporary
self.addServiceItem(serviceItem, repaint=False) self.addServiceItem(serviceItem, repaint=False)
delete_file(p_file) delete_file(p_file)
self.setFileName(fileName) self.setFileName(fileName)
@ -999,6 +1000,17 @@ class ServiceManager(QtGui.QWidget):
painter.drawImage(0, 0, overlay) painter.drawImage(0, 0, overlay)
painter.end() painter.end()
treewidgetitem.setIcon(0, build_icon(icon)) 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: else:
treewidgetitem.setIcon(0, serviceitem.iconic_representation) treewidgetitem.setIcon(0, serviceitem.iconic_representation)
else: else:
@ -1006,6 +1018,11 @@ class ServiceManager(QtGui.QWidget):
build_icon(u':/general/general_delete.png')) build_icon(u':/general/general_delete.png'))
treewidgetitem.setText(0, serviceitem.get_display_title()) treewidgetitem.setText(0, serviceitem.get_display_title())
tips = [] tips = []
if serviceitem.temporary_edit:
tips.append(u'<strong>%s:</strong> <em>%s</em>' %
(unicode(translate('OpenLP.ServiceManager', 'Edit')),
(unicode(translate('OpenLP.ServiceManager',
'Service copy only')))))
if serviceitem.theme and serviceitem.theme != -1: if serviceitem.theme and serviceitem.theme != -1:
tips.append(u'<strong>%s:</strong> <em>%s</em>' % tips.append(u'<strong>%s:</strong> <em>%s</em>' %
(unicode(translate('OpenLP.ServiceManager', 'Slide theme')), (unicode(translate('OpenLP.ServiceManager', 'Slide theme')),
@ -1127,8 +1144,9 @@ class ServiceManager(QtGui.QWidget):
Triggered from plugins to update service items. Triggered from plugins to update service items.
Save the values as they will be used as part of the service load 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_editId = int(editId)
self.loadItem_temporary = str_to_bool(temporary)
def replaceServiceItem(self, newItem): def replaceServiceItem(self, newItem):
""" """

View File

@ -540,6 +540,7 @@ class SongMediaItem(MediaManagerItem):
Song.search_title.asc()) Song.search_title.asc())
editId = 0 editId = 0
add_song = True add_song = True
temporary = False
if search_results: if search_results:
for song in search_results: for song in search_results:
author_list = item.data_string[u'authors'] author_list = item.data_string[u'authors']
@ -565,17 +566,18 @@ class SongMediaItem(MediaManagerItem):
self._updateBackgroundAudio(song, item) self._updateBackgroundAudio(song, item)
editId = song.id editId = song.id
self.onSearchTextButtonClick() self.onSearchTextButtonClick()
elif not self.addSongFromService: elif add_song and not self.addSongFromService:
# Make sure we temporary import formatting tags. # Make sure we temporary import formatting tags.
song = self.openLyrics.xml_to_song(item.xml_version, True) song = self.openLyrics.xml_to_song(item.xml_version, True)
# If there's any backing tracks, copy them over. # If there's any backing tracks, copy them over.
if len(item.background_audio) > 0: if len(item.background_audio) > 0:
self._updateBackgroundAudio(song, item) self._updateBackgroundAudio(song, item)
editId = song.id editId = song.id
temporary = True
# Update service with correct song id. # Update service with correct song id.
if editId: if editId:
Receiver.send_message(u'service_item_update', 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): def search(self, string):
""" """