* src/DisplayModels.py: fix Source column display

* src/GrampsDbBase.py: change default display columns
* src/ReadGedcom.py: Add default source for a GEDCOM import,
attach it to a person that has no attached sources.


svn: r3756
This commit is contained in:
Don Allingham 2004-11-26 23:31:50 +00:00
parent b9efaad3bd
commit cdaf281039
4 changed files with 36 additions and 7 deletions

View File

@ -1,3 +1,9 @@
2004-11-26 Don Allingham <dallingham@users.sourceforge.net>
* src/DisplayModels.py: fix Source column display
* src/GrampsDbBase.py: change default display columns
* src/ReadGedcom.py: Add default source for a GEDCOM import,
attach it to a person that has no attached sources.
2004-11-25 Alex Roitman <shura@alex.neuro.umn.edu>
* src/RecentFiles.py: Make robust to parse/save problems.
* src/DbPrompter.py: Support for recent-files on new db creation.

View File

@ -244,13 +244,13 @@ class SourceModel(BaseModel):
return unicode(data[3])
def column_abbrev(self,data):
return unicode(data[4])
return unicode(data[7])
def column_id(self,data):
return unicode(data[1])
def column_pubinfo(self,data):
return unicode(data[5])
return unicode(data[4])
def column_change(self,data):
return unicode(time.asctime(time.localtime(data[8])))

View File

@ -1103,7 +1103,7 @@ class GrampsDbBase:
Returns the Source display common information stored in the
database's metadata.
"""
default = [(1,1),(1,2),(1,3),(0,4),(0,5)]
default = [(1,1),(1,2),(0,3),(1,4),(0,5)]
if self.metadata == None:
return default
else:

View File

@ -244,6 +244,7 @@ class GedcomParser:
self.added = {}
self.gedmap = GedcomInfoDB()
self.gedsource = None
self.def_src = RelLib.Source()
self.dir_path = os.path.dirname(file)
self.localref = 0
self.placemap = {}
@ -449,6 +450,7 @@ class GedcomParser:
try:
self.parse_header()
self.parse_submitter()
self.db.add_source(self.def_src,self.trans)
self.parse_record()
self.parse_trailer()
except Errors.GedcomError, err:
@ -479,7 +481,6 @@ class GedcomParser:
def parse_trailer(self):
matches = self.get_next()
if matches[1] != "TRLR":
self.barf(0)
self.f.close()
@ -490,12 +491,22 @@ class GedcomParser:
def parse_submitter(self):
matches = self.get_next()
if matches[2] != "SUBM":
self.backup()
return
else:
self.ignore_sub_junk(1)
self.parse_submitter_data(1)
def parse_submitter_data(self,level):
while(1):
matches = self.get_next()
if int(matches[0]) < level:
self.backup()
return
elif matches[1] == "NAME":
self.def_src.set_author(unicode(matches[2]))
elif matches[1] == ["ADDR"]:
self.ignore_sub_junk(level+1)
def parse_source(self,name,level):
self.source = self.find_or_create_source(name[1:-1])
@ -580,6 +591,10 @@ class GedcomParser:
self.person = self.find_or_create_person(self.map_gid(gid))
self.added[self.person.get_handle()] = 1
self.parse_individual()
if len(self.person.get_source_references()) == 0:
sref = RelLib.SourceRef()
sref.set_base_handle(self.def_src.get_handle())
self.person.add_source_reference(sref)
self.db.commit_person(self.person, self.trans)
del self.person
elif matches[2] in ["SUBM","SUBN","REPO"]:
@ -1621,9 +1636,16 @@ class GedcomParser:
elif matches[1] == "NAME" and self.window:
self.update(self.created_obj,matches[2])
elif matches[1] == "VERS" and self.window:
self.def_src.set_data_item('Generated by',"%s %s" %
(genby,matches[2]))
self.update(self.version_obj,matches[2])
pass
elif matches[1] in ["CORP","DATA","SUBM","SUBN","COPR","FILE","LANG"]:
elif matches[1] == "FILE":
filename = os.path.basename(matches[2]).split('\\')[-1]
self.def_src.set_title(unicode(filename))
elif matches[1] == "COPR":
self.def_src.set_publication_info(unicode(matches[2]))
elif matches[1] in ["CORP","DATA","SUBM","SUBN","LANG"]:
self.ignore_sub_junk(2)
elif matches[1] == "DEST":
if genby == "GRAMPS":
@ -1650,6 +1672,7 @@ class GedcomParser:
elif matches[1] == "DATE":
date = self.parse_date(2)
date.date = matches[2]
self.def_src.set_data_item('Creation date',unicode(matches[2]))
elif matches[1] == "NOTE":
note = matches[2] + self.parse_continue_data(2)
elif matches[1][0] == "_":