Command-line import from gedcom: cleanup

svn: r1544
This commit is contained in:
Alex Roitman 2003-05-19 19:58:52 +00:00
parent 5c7c278e48
commit 01a1cd061f
2 changed files with 21 additions and 9 deletions

View File

@ -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)

View File

@ -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):