forked from openlp/openlp
Fix saving and reloading of media items
This commit is contained in:
parent
9970ae8281
commit
124c511385
@ -38,7 +38,6 @@ class ServiceItemType(object):
|
||||
Text = 1
|
||||
Image = 2
|
||||
Command = 3
|
||||
Video = 4
|
||||
|
||||
class ServiceItem(object):
|
||||
"""
|
||||
@ -156,12 +155,6 @@ class ServiceItem(object):
|
||||
self.service_frames.append(
|
||||
{u'title': frame_title, u'text': None, u'image': image})
|
||||
|
||||
def add_from_media(self, path, frame_title, image):
|
||||
self.service_item_type = ServiceItemType.Video
|
||||
self.service_item_path = path
|
||||
self.service_frames.append(
|
||||
{u'title': frame_title, u'text': None, u'image': image})
|
||||
|
||||
def add_from_text(self, frame_title, raw_slide):
|
||||
"""
|
||||
Add a text slide to the service item.
|
||||
@ -216,10 +209,7 @@ class ServiceItem(object):
|
||||
service_data.append(slide[u'title'])
|
||||
elif self.service_item_type == ServiceItemType.Command:
|
||||
for slide in self.service_frames:
|
||||
service_data.append(slide[u'title'])
|
||||
elif self.service_item_type == ServiceItemType.Video:
|
||||
for slide in self.service_frames:
|
||||
service_data.append(slide[u'title'])
|
||||
service_data.append({u'title':slide[u'title'], u'image':slide[u'image']})
|
||||
return {u'header': service_header, u'data': service_data}
|
||||
|
||||
def set_from_service(self, serviceitem, path=None):
|
||||
@ -252,8 +242,8 @@ class ServiceItem(object):
|
||||
self.add_from_image(path, text_image, real_image)
|
||||
elif self.service_item_type == ServiceItemType.Command:
|
||||
for text_image in serviceitem[u'serviceitem'][u'data']:
|
||||
filename = os.path.join(path, text_image)
|
||||
self.add_from_command(path, text_image)
|
||||
filename = os.path.join(path, text_image[u'title'])
|
||||
self.add_from_command(path, text_image[u'title'], text_image[u'image'] )
|
||||
elif self.service_item_type == ServiceItemType.Video:
|
||||
pass
|
||||
|
||||
@ -283,7 +273,7 @@ class ServiceItem(object):
|
||||
return self.name == u'Songs'
|
||||
|
||||
def isMedia(self):
|
||||
return self.name == u'Media'
|
||||
return self.name.lower() == u'media'
|
||||
|
||||
def isCommand(self):
|
||||
return self.service_item_type == ServiceItemType.Command
|
||||
|
@ -79,7 +79,7 @@ class MediaMediaItem(MediaManagerItem):
|
||||
items = self.ListView.selectedIndexes()
|
||||
if len(items) > 1:
|
||||
return False
|
||||
service_item.title = self.trUtf8(u'Media')
|
||||
service_item.title = unicode(self.trUtf8(u'Media'))
|
||||
for item in items:
|
||||
bitem = self.ListView.item(item.row())
|
||||
filename = unicode((bitem.data(QtCore.Qt.UserRole)).toString())
|
||||
|
Loading…
Reference in New Issue
Block a user