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) log.error(exc)
return return
self.import_wizard.progressBar.setMaximum(len(self.import_source)) 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: for filename in self.import_source:
if self.stop_import_flag: if self.stop_import_flag:
break break
@ -81,9 +85,9 @@ class OooImport(SongImport):
self.process_ooo_document() self.process_ooo_document()
self.close_ooo_file() self.close_ooo_file()
else: else:
self.log_error(self.filepath) error_msg()
else: else:
self.log_error(self.filepath) error_msg()
self.close_ooo() self.close_ooo()
def process_ooo_document(self): def process_ooo_document(self):