forked from openlp/openlp
Fix up saving and loading service items
This commit is contained in:
parent
1fd98217ab
commit
3610b232bd
@ -159,7 +159,7 @@ def main():
|
|||||||
help="Set the Qt4 style (passed directly to Qt4).")
|
help="Set the Qt4 style (passed directly to Qt4).")
|
||||||
# Set up logging
|
# Set up logging
|
||||||
filename = u'openlp.log'
|
filename = u'openlp.log'
|
||||||
logfile = FileHandler(filename)
|
logfile = FileHandler(filename, u'w')
|
||||||
logfile.setFormatter(logging.Formatter(
|
logfile.setFormatter(logging.Formatter(
|
||||||
u'%(asctime)s %(name)-15s %(levelname)-8s %(message)s'))
|
u'%(asctime)s %(name)-15s %(levelname)-8s %(message)s'))
|
||||||
log.addHandler(logfile)
|
log.addHandler(logfile)
|
||||||
|
@ -438,10 +438,10 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
for item in self.serviceItems:
|
for item in self.serviceItems:
|
||||||
service.append({u'serviceitem':item[u'service_item'].get_service_repr()})
|
service.append({u'serviceitem':item[u'service_item'].get_service_repr()})
|
||||||
if item[u'service_item'].uses_file():
|
if item[u'service_item'].uses_file():
|
||||||
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,
|
item[u'service_item'].service_item_path,
|
||||||
frame.get_frame_title()))
|
frame[u'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)
|
||||||
@ -504,6 +504,7 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
serviceitem = ServiceItem()
|
serviceitem = ServiceItem()
|
||||||
serviceitem.RenderManager = self.parent.RenderManager
|
serviceitem.RenderManager = self.parent.RenderManager
|
||||||
serviceitem.set_from_service(item, self.servicePath)
|
serviceitem.set_from_service(item, self.servicePath)
|
||||||
|
if self.validateItem(serviceitem):
|
||||||
self.addServiceItem(serviceitem)
|
self.addServiceItem(serviceitem)
|
||||||
try:
|
try:
|
||||||
if os.path.isfile(p_file):
|
if os.path.isfile(p_file):
|
||||||
@ -521,6 +522,14 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
self.serviceName = name[len(name) - 1]
|
self.serviceName = name[len(name) - 1]
|
||||||
self.parent.serviceChanged(True, self.serviceName)
|
self.parent.serviceChanged(True, self.serviceName)
|
||||||
|
|
||||||
|
def validateItem(self, serviceItem):
|
||||||
|
print "---"
|
||||||
|
print serviceItem.name
|
||||||
|
print serviceItem.title
|
||||||
|
print serviceItem.service_item_path
|
||||||
|
print serviceItem.service_item_type
|
||||||
|
return True
|
||||||
|
|
||||||
def cleanUp(self):
|
def cleanUp(self):
|
||||||
"""
|
"""
|
||||||
Empties the servicePath of temporary files
|
Empties the servicePath of temporary files
|
||||||
|
Loading…
Reference in New Issue
Block a user