From 3610b232bda1e1269ce862c19c872f3fd85c6019 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Fri, 29 Jan 2010 16:38:28 +0000 Subject: [PATCH] Fix up saving and loading service items --- openlp.pyw | 2 +- openlp/core/ui/servicemanager.py | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/openlp.pyw b/openlp.pyw index 58925fdb9..4741059d2 100755 --- a/openlp.pyw +++ b/openlp.pyw @@ -159,7 +159,7 @@ def main(): help="Set the Qt4 style (passed directly to Qt4).") # Set up logging filename = u'openlp.log' - logfile = FileHandler(filename) + logfile = FileHandler(filename, u'w') logfile.setFormatter(logging.Formatter( u'%(asctime)s %(name)-15s %(levelname)-8s %(message)s')) log.addHandler(logfile) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 6bb09a92e..5f384a955 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -438,10 +438,10 @@ class ServiceManager(QtGui.QWidget): for item in self.serviceItems: service.append({u'serviceitem':item[u'service_item'].get_service_repr()}) 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( item[u'service_item'].service_item_path, - frame.get_frame_title())) + frame[u'title'])) zip.write(path_from) file = open(servicefile, u'wb') cPickle.dump(service, file) @@ -504,7 +504,8 @@ class ServiceManager(QtGui.QWidget): serviceitem = ServiceItem() serviceitem.RenderManager = self.parent.RenderManager serviceitem.set_from_service(item, self.servicePath) - self.addServiceItem(serviceitem) + if self.validateItem(serviceitem): + self.addServiceItem(serviceitem) try: if os.path.isfile(p_file): os.remove(p_file) @@ -521,6 +522,14 @@ class ServiceManager(QtGui.QWidget): self.serviceName = name[len(name) - 1] 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): """ Empties the servicePath of temporary files