Fix duplicate file save bug

Fix Dnd bug

bzr-revno: 1074
Fixes: https://launchpad.net/bugs/656177
This commit is contained in:
Tim Bentley 2010-10-08 07:17:59 +01:00
commit e37682cb03
4 changed files with 9 additions and 5 deletions

View File

@ -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

View File

@ -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
pass

View File

@ -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):
"""

View File

@ -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()