From 75d35cf182a9919bdbfd8897293fa8f3b5ecf61f Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Thu, 7 Oct 2010 18:52:40 +0100 Subject: [PATCH] Fix duplicate file saving bug Fix drag and drop service item bug Fixes: https://launchpad.net/bugs/656177 --- openlp/core/lib/mediamanageritem.py | 2 +- openlp/core/lib/plugin.py | 4 ++-- openlp/core/lib/serviceitem.py | 2 +- openlp/core/ui/servicemanager.py | 6 +++++- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/openlp/core/lib/mediamanageritem.py b/openlp/core/lib/mediamanageritem.py index 457249b35..3752ffc4d 100644 --- a/openlp/core/lib/mediamanageritem.py +++ b/openlp/core/lib/mediamanageritem.py @@ -96,7 +96,7 @@ class MediaManagerItem(QtGui.QWidget): #TODO: plugin should not be the parent in future self.plugin = parent # plugin visible_title = self.plugin.getString(StringContent.VisibleName) - self.title = visible_title[u'title'] + self.title = unicode(visible_title[u'title']) self.settingsSection = self.plugin.name.lower() if isinstance(icon, QtGui.QIcon): self.icon = icon diff --git a/openlp/core/lib/plugin.py b/openlp/core/lib/plugin.py index 3fda09676..37ac3d74a 100644 --- a/openlp/core/lib/plugin.py +++ b/openlp/core/lib/plugin.py @@ -303,7 +303,7 @@ class Plugin(QtCore.QObject): The new name the plugin should now use. """ pass - + def getString(self, name): """ encapsulate access of plugins translated text strings @@ -314,4 +314,4 @@ class Plugin(QtCore.QObject): """ Called to define all translatable texts of the plugin """ - pass \ No newline at end of file + pass diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py index b4dc263e9..663328d95 100644 --- a/openlp/core/lib/serviceitem.py +++ b/openlp/core/lib/serviceitem.py @@ -101,9 +101,9 @@ class ServiceItem(object): self.main = None self.footer = None self.bg_image_bytes = None - self._new_item() self.search_string = u'' self.data_string = u'' + self._new_item() def _new_item(self): """ diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index d751b76be..1fb276a25 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -602,6 +602,7 @@ class ServiceManager(QtGui.QWidget): zip = None file = None try: + write_list = [] zip = zipfile.ZipFile(unicode(filename), 'w') for item in self.serviceItems: service.append({u'serviceitem':item[u'service_item'] @@ -611,7 +612,10 @@ class ServiceManager(QtGui.QWidget): path_from = unicode(os.path.join( frame[u'path'], frame[u'title'])) - zip.write(path_from.encode(u'utf-8')) + # On write a file once + if not path_from in write_list: + write_list.append(path_from) + zip.write(path_from.encode(u'utf-8')) file = open(servicefile, u'wb') cPickle.dump(service, file) file.close()