From 01e6dedae985ecaf5f41a052ea398846f63c1a53 Mon Sep 17 00:00:00 2001 From: Martin Hawlisch Date: Sat, 28 May 2005 19:29:29 +0000 Subject: [PATCH] * src/gramps_main.py (read_file): Optimize exception handling of load_database errors. * src/ArgHandler.py (auto_save_load): Return actual status of read_file instead of always 1. This will now open the select database dialog on autoload errors. svn: r4730 --- gramps2/ChangeLog | 7 +++++++ gramps2/src/ArgHandler.py | 9 +++------ gramps2/src/gramps_main.py | 12 ++++++------ 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index de63cd645..956a6dcd9 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,10 @@ +2005-05-28 Martin Hawlisch + * src/gramps_main.py (read_file): Optimize exception handling of + load_database errors. + * src/ArgHandler.py (auto_save_load): Return actual status of + read_file instead of always 1. This will now open the select database + dialog on autoload errors. + 2005-05-28 Alex Roitman * configure.in: Bump up the version number after 2.0.1. diff --git a/gramps2/src/ArgHandler.py b/gramps2/src/ArgHandler.py index aa7bec781..08e4dba86 100644 --- a/gramps2/src/ArgHandler.py +++ b/gramps2/src/ArgHandler.py @@ -228,20 +228,17 @@ class ArgHandler: import GrampsBSDDB self.parent.db.close() self.parent.db = GrampsBSDDB.GrampsBSDDB() - self.parent.read_file(filename) - return 1 + return self.parent.read_file(filename) elif filetype == const.app_gramps_xml: import GrampsXMLDB self.parent.db.close() self.parent.db = GrampsXMLDB.GrampsXMLDB() - self.parent.read_file(filename) - return 1 + return self.parent.read_file(filename) elif filetype == const.app_gedcom: import GrampsGEDDB self.parent.db.close() self.parent.db = GrampsGEDDB.GrampsGEDDB() - self.parent.read_file(filename) - return 1 + return self.parent.read_file(filename) else: return 0 diff --git a/gramps2/src/gramps_main.py b/gramps2/src/gramps_main.py index ba65bf690..cc1972cfe 100755 --- a/gramps2/src/gramps_main.py +++ b/gramps2/src/gramps_main.py @@ -1294,14 +1294,14 @@ class Gramps(GrampsDBCallback.GrampsDBCallback): except ( IOError, OSError ), msg: ErrorDialog(_('Cannot open database'),str(msg)) return 0 - except db.DBAccessError, msg: + except (db.DBAccessError,db.DBError), msg: ErrorDialog(_('Cannot open database'), _('%s could not be opened.' % filename) + '\n' + msg[1]) - except (db.DBError), msg: - ErrorDialog(_('Cannot open database'), - _('%s could not be opened.' % filename) + '\n' + msg[1]) - gtk.main_quit() - + return 0 + except Exception: + DisplayTrace.DisplayTrace() + return 0 + # Undo/Redo always start with standard labels and insensitive state self.undo_callback(None) self.redo_callback(None)