* 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:
parent
662b0a3ab0
commit
38a473eee7
@ -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>
|
2004-11-25 Alex Roitman <shura@alex.neuro.umn.edu>
|
||||||
* src/RecentFiles.py: Make robust to parse/save problems.
|
* src/RecentFiles.py: Make robust to parse/save problems.
|
||||||
* src/DbPrompter.py: Support for recent-files on new db creation.
|
* src/DbPrompter.py: Support for recent-files on new db creation.
|
||||||
|
@ -244,13 +244,13 @@ class SourceModel(BaseModel):
|
|||||||
return unicode(data[3])
|
return unicode(data[3])
|
||||||
|
|
||||||
def column_abbrev(self,data):
|
def column_abbrev(self,data):
|
||||||
return unicode(data[4])
|
return unicode(data[7])
|
||||||
|
|
||||||
def column_id(self,data):
|
def column_id(self,data):
|
||||||
return unicode(data[1])
|
return unicode(data[1])
|
||||||
|
|
||||||
def column_pubinfo(self,data):
|
def column_pubinfo(self,data):
|
||||||
return unicode(data[5])
|
return unicode(data[4])
|
||||||
|
|
||||||
def column_change(self,data):
|
def column_change(self,data):
|
||||||
return unicode(time.asctime(time.localtime(data[8])))
|
return unicode(time.asctime(time.localtime(data[8])))
|
||||||
|
@ -1103,7 +1103,7 @@ class GrampsDbBase:
|
|||||||
Returns the Source display common information stored in the
|
Returns the Source display common information stored in the
|
||||||
database's metadata.
|
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:
|
if self.metadata == None:
|
||||||
return default
|
return default
|
||||||
else:
|
else:
|
||||||
|
@ -244,6 +244,7 @@ class GedcomParser:
|
|||||||
self.added = {}
|
self.added = {}
|
||||||
self.gedmap = GedcomInfoDB()
|
self.gedmap = GedcomInfoDB()
|
||||||
self.gedsource = None
|
self.gedsource = None
|
||||||
|
self.def_src = RelLib.Source()
|
||||||
self.dir_path = os.path.dirname(file)
|
self.dir_path = os.path.dirname(file)
|
||||||
self.localref = 0
|
self.localref = 0
|
||||||
self.placemap = {}
|
self.placemap = {}
|
||||||
@ -449,6 +450,7 @@ class GedcomParser:
|
|||||||
try:
|
try:
|
||||||
self.parse_header()
|
self.parse_header()
|
||||||
self.parse_submitter()
|
self.parse_submitter()
|
||||||
|
self.db.add_source(self.def_src,self.trans)
|
||||||
self.parse_record()
|
self.parse_record()
|
||||||
self.parse_trailer()
|
self.parse_trailer()
|
||||||
except Errors.GedcomError, err:
|
except Errors.GedcomError, err:
|
||||||
@ -479,7 +481,6 @@ class GedcomParser:
|
|||||||
|
|
||||||
def parse_trailer(self):
|
def parse_trailer(self):
|
||||||
matches = self.get_next()
|
matches = self.get_next()
|
||||||
|
|
||||||
if matches[1] != "TRLR":
|
if matches[1] != "TRLR":
|
||||||
self.barf(0)
|
self.barf(0)
|
||||||
self.f.close()
|
self.f.close()
|
||||||
@ -490,12 +491,22 @@ class GedcomParser:
|
|||||||
|
|
||||||
def parse_submitter(self):
|
def parse_submitter(self):
|
||||||
matches = self.get_next()
|
matches = self.get_next()
|
||||||
|
|
||||||
if matches[2] != "SUBM":
|
if matches[2] != "SUBM":
|
||||||
self.backup()
|
self.backup()
|
||||||
return
|
return
|
||||||
else:
|
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):
|
def parse_source(self,name,level):
|
||||||
self.source = self.find_or_create_source(name[1:-1])
|
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.person = self.find_or_create_person(self.map_gid(gid))
|
||||||
self.added[self.person.get_handle()] = 1
|
self.added[self.person.get_handle()] = 1
|
||||||
self.parse_individual()
|
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)
|
self.db.commit_person(self.person, self.trans)
|
||||||
del self.person
|
del self.person
|
||||||
elif matches[2] in ["SUBM","SUBN","REPO"]:
|
elif matches[2] in ["SUBM","SUBN","REPO"]:
|
||||||
@ -1621,9 +1636,16 @@ class GedcomParser:
|
|||||||
elif matches[1] == "NAME" and self.window:
|
elif matches[1] == "NAME" and self.window:
|
||||||
self.update(self.created_obj,matches[2])
|
self.update(self.created_obj,matches[2])
|
||||||
elif matches[1] == "VERS" and self.window:
|
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])
|
self.update(self.version_obj,matches[2])
|
||||||
pass
|
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)
|
self.ignore_sub_junk(2)
|
||||||
elif matches[1] == "DEST":
|
elif matches[1] == "DEST":
|
||||||
if genby == "GRAMPS":
|
if genby == "GRAMPS":
|
||||||
@ -1650,6 +1672,7 @@ class GedcomParser:
|
|||||||
elif matches[1] == "DATE":
|
elif matches[1] == "DATE":
|
||||||
date = self.parse_date(2)
|
date = self.parse_date(2)
|
||||||
date.date = matches[2]
|
date.date = matches[2]
|
||||||
|
self.def_src.set_data_item('Creation date',unicode(matches[2]))
|
||||||
elif matches[1] == "NOTE":
|
elif matches[1] == "NOTE":
|
||||||
note = matches[2] + self.parse_continue_data(2)
|
note = matches[2] + self.parse_continue_data(2)
|
||||||
elif matches[1][0] == "_":
|
elif matches[1][0] == "_":
|
||||||
|
Loading…
Reference in New Issue
Block a user