forked from openlp/openlp
do not show error message when file does not exist, fixed return
This commit is contained in:
parent
9376d7e965
commit
a9cd8db787
@ -483,6 +483,7 @@ class ServiceManager(QtGui.QWidget):
|
||||
allow_zip_64 = (total_size > 2147483648 + len(service_content))
|
||||
log.debug(u'ServiceManager.saveFile - allowZip64 is %s' % allow_zip_64)
|
||||
zip = None
|
||||
success = True
|
||||
try:
|
||||
zip = zipfile.ZipFile(path_file_name, 'w', zipfile.ZIP_STORED,
|
||||
allow_zip_64)
|
||||
@ -494,13 +495,16 @@ class ServiceManager(QtGui.QWidget):
|
||||
zip.write(path_from, path_from.encode(u'utf-8'))
|
||||
except IOError:
|
||||
log.exception(u'Failed to save service to disk')
|
||||
return False
|
||||
success = False
|
||||
finally:
|
||||
if zip:
|
||||
zip.close()
|
||||
self.mainwindow.addRecentFile(path_file_name)
|
||||
self.setModified(False)
|
||||
return True
|
||||
if success:
|
||||
self.mainwindow.addRecentFile(path_file_name)
|
||||
self.setModified(False)
|
||||
else:
|
||||
delete_file(path_file_name)
|
||||
return success
|
||||
|
||||
def saveFileAs(self):
|
||||
"""
|
||||
@ -525,8 +529,9 @@ class ServiceManager(QtGui.QWidget):
|
||||
def loadFile(self, fileName):
|
||||
if not fileName:
|
||||
return False
|
||||
else:
|
||||
fileName = unicode(fileName)
|
||||
fileName = unicode(fileName)
|
||||
if not os.path.exists(fileName):
|
||||
return False
|
||||
zip = None
|
||||
fileTo = None
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user