Fix up Service Save

This commit is contained in:
Tim Bentley 2011-04-29 07:21:31 +01:00
parent c7e07bdbd5
commit 188431ce37

View File

@ -460,7 +460,11 @@ class ServiceManager(QtGui.QWidget):
service = [] service = []
write_list = [] write_list = []
total_size = 0 total_size = 0
Receiver.send_message(u'cursor_busy')
# Number if items + 1 to zip it
self.mainwindow.displayProgressBar(len(self.serviceItems) + 1)
for item in self.serviceItems: for item in self.serviceItems:
self.mainwindow.incrementProgressBar()
service.append({u'serviceitem': service.append({u'serviceitem':
item[u'service_item'].get_service_repr()}) item[u'service_item'].get_service_repr()})
if not item[u'service_item'].uses_file(): if not item[u'service_item'].uses_file():
@ -501,6 +505,7 @@ class ServiceManager(QtGui.QWidget):
log.debug(u'ServiceManager.saveFile - allowZip64 is %s' % allow_zip_64) log.debug(u'ServiceManager.saveFile - allowZip64 is %s' % allow_zip_64)
zip = None zip = None
success = True success = True
self.mainwindow.incrementProgressBar()
try: try:
zip = zipfile.ZipFile(path_file_name, 'w', zipfile.ZIP_STORED, zip = zipfile.ZipFile(path_file_name, 'w', zipfile.ZIP_STORED,
allow_zip_64) allow_zip_64)
@ -516,6 +521,8 @@ class ServiceManager(QtGui.QWidget):
finally: finally:
if zip: if zip:
zip.close() zip.close()
self.mainwindow.finishedProgressBar()
Receiver.send_message(u'cursor_normal')
if success: if success:
self.mainwindow.addRecentFile(path_file_name) self.mainwindow.addRecentFile(path_file_name)
self.setModified(False) self.setModified(False)