From 3b7b70d606995e0a2df3f1358a2a3f164b207707 Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Sat, 29 Jan 2005 06:05:51 +0000 Subject: [PATCH] * src/ArgHandler.py: Support for the native importer. * NEWS: Update. svn: r3986 --- gramps2/ChangeLog | 3 +++ gramps2/NEWS | 3 ++- gramps2/src/ArgHandler.py | 13 +++++++++++-- gramps2/src/ReadGrdb.py | 4 ---- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index a80cd248d..abbdf63c8 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -4,6 +4,9 @@ * src/DbPrompter.py: Support for the native importer. * src/Errors.py: Add HandleError exception for duplicate handles. + * src/ArgHandler.py: Support for the native importer. + * NEWS: Update. + 2005-01-26 Don Allingham * src/DbPrompter.py: gnome.vfs vs. gnomevfs, tolerence * src/GrampsMime.py: gnome.vfs vs. gnomevfs tolerence diff --git a/gramps2/NEWS b/gramps2/NEWS index c79aaa1bc..abc192dcb 100644 --- a/gramps2/NEWS +++ b/gramps2/NEWS @@ -1,4 +1,5 @@ -Version 1.1.4 -- the "" release +Version 1.1.4 -- the "Successful encyclopedia salesman" release +* Import from native GRDB format. * GnomePrint backend supports shadows for the boxes. * Bug fixes. diff --git a/gramps2/src/ArgHandler.py b/gramps2/src/ArgHandler.py index 2b4df36eb..1d748b2c4 100644 --- a/gramps2/src/ArgHandler.py +++ b/gramps2/src/ArgHandler.py @@ -1,7 +1,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2000-2004 Donald N. Allingham +# Copyright (C) 2000-2005 Donald N. Allingham # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -318,6 +318,7 @@ class ArgHandler: print "Cleaning up." # remove import db after use + self.parent.db.close() os.remove(self.imp_db_path) print "Exiting." os._exit(0) @@ -341,7 +342,15 @@ class ArgHandler: Command-line import routine. Try to import filename using the format. Any errors will cause the os._exit(1) call. """ - if format == 'gedcom': + if format == 'grdb': + import ReadGrdb + filename = os.path.normpath(os.path.abspath(filename)) + try: + ReadGrdb.importData(self.parent.db,filename,None) + except: + print "Error importing %s" % filename + os._exit(1) + elif format == 'gedcom': import ReadGedcom filename = os.path.normpath(os.path.abspath(filename)) try: diff --git a/gramps2/src/ReadGrdb.py b/gramps2/src/ReadGrdb.py index 0ffdb5288..35071d429 100644 --- a/gramps2/src/ReadGrdb.py +++ b/gramps2/src/ReadGrdb.py @@ -48,12 +48,8 @@ import Errors def importData(database, filename, callback=None,cl=0,use_trans=True): filename = os.path.normpath(filename) - basefile = os.path.dirname(filename) - - change = os.path.getmtime(filename) other_database = GrampsBSDDB.GrampsBSDDB() - try: other_database.load(filename,callback) except: