forked from openlp/openlp
Clean up ServiceItem usage in ServiceManager
This commit is contained in:
parent
26dd28d083
commit
4158ae458e
@ -276,6 +276,10 @@ class ServiceItem(object):
|
|||||||
def is_image(self):
|
def is_image(self):
|
||||||
return self.service_item_type == ServiceItemType.Image
|
return self.service_item_type == ServiceItemType.Image
|
||||||
|
|
||||||
|
def uses_file(self):
|
||||||
|
return self.service_item_type == ServiceItemType.Image or \
|
||||||
|
self.service_item_type == ServiceItemType.Command
|
||||||
|
|
||||||
def is_text(self):
|
def is_text(self):
|
||||||
return self.service_item_type == ServiceItemType.Text
|
return self.service_item_type == ServiceItemType.Text
|
||||||
|
|
||||||
|
@ -411,6 +411,7 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
* An osd which is a pickle of the service items
|
* An osd which is a pickle of the service items
|
||||||
* All image, presentation and video files needed to run the service.
|
* All image, presentation and video files needed to run the service.
|
||||||
"""
|
"""
|
||||||
|
log.debug(u'onSaveService')
|
||||||
if not quick or self.isNew:
|
if not quick or self.isNew:
|
||||||
filename = QtGui.QFileDialog.getSaveFileName(self,
|
filename = QtGui.QFileDialog.getSaveFileName(self,
|
||||||
u'Save Service', self.config.get_last_dir())
|
u'Save Service', self.config.get_last_dir())
|
||||||
@ -430,13 +431,12 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
try:
|
try:
|
||||||
zip = zipfile.ZipFile(unicode(filename), 'w')
|
zip = zipfile.ZipFile(unicode(filename), 'w')
|
||||||
for item in self.serviceItems:
|
for item in self.serviceItems:
|
||||||
service.append(
|
service.append({u'serviceitem':item[u'service_item'].get_service_repr()})
|
||||||
{u'serviceitem':item[u'service_item'].get_service_repr()})
|
if item[u'service_item'].uses_file():
|
||||||
if item[u'service_item'].service_item_type == ServiceItemType.Image or \
|
|
||||||
item[u'service_item'].service_item_type == ServiceItemType.Command:
|
|
||||||
for frame in item[u'service_item'].get_frames:
|
for frame in item[u'service_item'].get_frames:
|
||||||
path_from = unicode(os.path.join(
|
path_from = unicode(os.path.join(
|
||||||
item[u'service_item'].service_item_path, frame.get_frame_title()))
|
item[u'service_item'].service_item_path,
|
||||||
|
frame.get_frame_title()))
|
||||||
zip.write(path_from)
|
zip.write(path_from)
|
||||||
file = open(servicefile, u'wb')
|
file = open(servicefile, u'wb')
|
||||||
cPickle.dump(service, file)
|
cPickle.dump(service, file)
|
||||||
|
Loading…
Reference in New Issue
Block a user