forked from openlp/openlp
fix up rest of service load updates
This commit is contained in:
parent
bdc924093e
commit
68b38aa88c
@ -102,6 +102,8 @@ class ServiceItem(object):
|
||||
self.footer = None
|
||||
self.bg_image_bytes = None
|
||||
self._new_item()
|
||||
self.search_string = u''
|
||||
self.data_string = u''
|
||||
|
||||
def _new_item(self):
|
||||
"""
|
||||
@ -259,7 +261,9 @@ class ServiceItem(object):
|
||||
u'audit':self.audit,
|
||||
u'notes':self.notes,
|
||||
u'from_plugin':self.from_plugin,
|
||||
u'capabilities':self.capabilities
|
||||
u'capabilities':self.capabilities,
|
||||
u'search':self.search_string,
|
||||
u'data':self.data_string
|
||||
}
|
||||
service_data = []
|
||||
if self.service_item_type == ServiceItemType.Text:
|
||||
@ -297,6 +301,10 @@ class ServiceItem(object):
|
||||
self.notes = header[u'notes']
|
||||
self.from_plugin = header[u'from_plugin']
|
||||
self.capabilities = header[u'capabilities']
|
||||
# Added later so may not be present in older services.
|
||||
if u'search' in header:
|
||||
self.search_string = header[u'search']
|
||||
self.data_string = header[u'data']
|
||||
if self.service_item_type == ServiceItemType.Text:
|
||||
for slide in serviceitem[u'serviceitem'][u'data']:
|
||||
self._raw_frames.append(slide)
|
||||
|
@ -810,9 +810,13 @@ class ServiceManager(QtGui.QWidget):
|
||||
"""
|
||||
Triggered from plugins to update service items.
|
||||
"""
|
||||
editId, uuid = message.split(u':')
|
||||
print message
|
||||
for item in self.serviceItems:
|
||||
print item[u'service_item'].title, item[u'service_item']._uuid
|
||||
if item[u'service_item']._uuid == uuid:
|
||||
print u'match'
|
||||
item[u'service_item'].editId = editId
|
||||
|
||||
def addServiceItem(self, item, rebuild=False, expand=True, replace=False):
|
||||
"""
|
||||
|
@ -372,11 +372,31 @@ class SongMediaItem(MediaManagerItem):
|
||||
service_item.audit = [
|
||||
song.title, author_audit, song.copyright, unicode(song.ccli_number)
|
||||
]
|
||||
service_item.data_string = {u'title':song.search_title, u'authors':author_list}
|
||||
return True
|
||||
|
||||
def serviceLoad(self, item):
|
||||
"""
|
||||
Triggered by a song being loaded by the service item
|
||||
"""
|
||||
Receiver.send_message(u'service_item_update', u'0:0')
|
||||
print item.data_string[u'title'].split(u'@')[0]
|
||||
search_results = self.parent.manager.get_all_objects(Song,
|
||||
Song.search_title.like(u'%' + item.data_string[u'title'].split(u'@')[0] + u'%'),
|
||||
Song.search_title.asc())
|
||||
print item.data_string[u'authors'].split(u',')
|
||||
author_list = item.data_string[u'authors'].split(u',')
|
||||
editId = 0
|
||||
uuid = 0
|
||||
if search_results:
|
||||
for song in search_results:
|
||||
count = 0
|
||||
for author in song.authors:
|
||||
if author.display_name in author_list:
|
||||
count += 1
|
||||
if count == len(author_list):
|
||||
editId = song.id
|
||||
uuid = item._uuid
|
||||
if editId != 0:
|
||||
Receiver.send_message(u'service_item_update',
|
||||
u'%s:%s' %(editId, uuid))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user