From 01a1cd061f045ff51f9da2706e929e33580b9887 Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Mon, 19 May 2003 19:58:52 +0000 Subject: [PATCH] Command-line import from gedcom: cleanup svn: r1544 --- gramps2/src/gramps_main.py | 6 +++++- gramps2/src/plugins/ReadGedcom.py | 24 ++++++++++++++++-------- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/gramps2/src/gramps_main.py b/gramps2/src/gramps_main.py index afee41369..8cdba7db7 100755 --- a/gramps2/src/gramps_main.py +++ b/gramps2/src/gramps_main.py @@ -938,9 +938,13 @@ class Gramps: import ReadGedcom filename = os.path.normpath(os.path.abspath(filename)) try: - ReadGedcom.importData(self.db,filename) + g = ReadGedcom.GedcomParser(self.db,filename,None) + g.parse_gedcom_file() + g.resolve_refns() + del g except: print "Error importing %s" % filename + os._exit(1) elif format == 'gramps': try: dbname = os.path.join(filename,const.xmlFile) diff --git a/gramps2/src/plugins/ReadGedcom.py b/gramps2/src/plugins/ReadGedcom.py index f6fca1edc..edc56f497 100644 --- a/gramps2/src/plugins/ReadGedcom.py +++ b/gramps2/src/plugins/ReadGedcom.py @@ -284,16 +284,22 @@ class GedcomParser: pass def errmsg(self,msg): - try: - self.error_text_obj.get_buffer().insert_at_cursor(msg) - except TypeError: - self.error_text_obj.get_buffer().insert_at_cursor(msg,len(msg)) + if self.window: + try: + self.error_text_obj.get_buffer().insert_at_cursor(msg) + except TypeError: + self.error_text_obj.get_buffer().insert_at_cursor(msg,len(msg)) + else: + print msg def infomsg(self,msg): - try: - self.info_text_obj.get_buffer().insert_at_cursor(msg) - except TypeError: - self.info_text_obj.get_buffer().insert_at_cursor(msg,len(msg)) + if self.window: + try: + self.info_text_obj.get_buffer().insert_at_cursor(msg) + except TypeError: + self.info_text_obj.get_buffer().insert_at_cursor(msg,len(msg)) + else: + print msg def find_file(self,fullname,altpath): tries = [] @@ -402,6 +408,8 @@ class GedcomParser: self.infomsg("\n%s" % msg) else: print msg + print "Families: %d" % self.fam_count + print "Individuals: %d" % self.indi_count return None def break_note_links(self):