* 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
This commit is contained in:
Martin Hawlisch 2005-05-28 19:29:29 +00:00
parent 0cb7d90257
commit 01e6dedae9
3 changed files with 16 additions and 12 deletions

View File

@ -1,3 +1,10 @@
2005-05-28 Martin Hawlisch <Martin.Hawlisch@gmx.de>
* 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 <shura@gramps-project.org> 2005-05-28 Alex Roitman <shura@gramps-project.org>
* configure.in: Bump up the version number after 2.0.1. * configure.in: Bump up the version number after 2.0.1.

View File

@ -228,20 +228,17 @@ class ArgHandler:
import GrampsBSDDB import GrampsBSDDB
self.parent.db.close() self.parent.db.close()
self.parent.db = GrampsBSDDB.GrampsBSDDB() self.parent.db = GrampsBSDDB.GrampsBSDDB()
self.parent.read_file(filename) return self.parent.read_file(filename)
return 1
elif filetype == const.app_gramps_xml: elif filetype == const.app_gramps_xml:
import GrampsXMLDB import GrampsXMLDB
self.parent.db.close() self.parent.db.close()
self.parent.db = GrampsXMLDB.GrampsXMLDB() self.parent.db = GrampsXMLDB.GrampsXMLDB()
self.parent.read_file(filename) return self.parent.read_file(filename)
return 1
elif filetype == const.app_gedcom: elif filetype == const.app_gedcom:
import GrampsGEDDB import GrampsGEDDB
self.parent.db.close() self.parent.db.close()
self.parent.db = GrampsGEDDB.GrampsGEDDB() self.parent.db = GrampsGEDDB.GrampsGEDDB()
self.parent.read_file(filename) return self.parent.read_file(filename)
return 1
else: else:
return 0 return 0

View File

@ -1294,13 +1294,13 @@ class Gramps(GrampsDBCallback.GrampsDBCallback):
except ( IOError, OSError ), msg: except ( IOError, OSError ), msg:
ErrorDialog(_('Cannot open database'),str(msg)) ErrorDialog(_('Cannot open database'),str(msg))
return 0 return 0
except db.DBAccessError, msg: except (db.DBAccessError,db.DBError), msg:
ErrorDialog(_('Cannot open database'), ErrorDialog(_('Cannot open database'),
_('%s could not be opened.' % filename) + '\n' + msg[1]) _('%s could not be opened.' % filename) + '\n' + msg[1])
except (db.DBError), msg: return 0
ErrorDialog(_('Cannot open database'), except Exception:
_('%s could not be opened.' % filename) + '\n' + msg[1]) DisplayTrace.DisplayTrace()
gtk.main_quit() return 0
# Undo/Redo always start with standard labels and insensitive state # Undo/Redo always start with standard labels and insensitive state
self.undo_callback(None) self.undo_callback(None)