Add specific error messages if OoO open fails. Use a lambda to avoid repetition

This commit is contained in:
Gerald Britton 2011-05-26 09:35:01 -04:00
parent c70c1a7c1a
commit e70ba41373

View File

@ -71,6 +71,10 @@ class OooImport(SongImport):
log.error(exc)
return
self.import_wizard.progressBar.setMaximum(len(self.import_source))
error_msg = lambda: self.log_error(
self.filepath,
translate('SongsPlugin.SongImport',
u'Unable to open file'))
for filename in self.import_source:
if self.stop_import_flag:
break
@ -81,9 +85,9 @@ class OooImport(SongImport):
self.process_ooo_document()
self.close_ooo_file()
else:
self.log_error(self.filepath)
error_msg()
else:
self.log_error(self.filepath)
error_msg()
self.close_ooo()
def process_ooo_document(self):