GEDCOM improvements for GENEWEB from Alexandre Duret-Lutz

svn: r1238
This commit is contained in:
Don Allingham 2003-01-03 03:19:50 +00:00
parent 1c902e0eef
commit 6620c09d52
5 changed files with 64 additions and 9 deletions

Binary file not shown.

View File

@ -42,6 +42,8 @@ PREFIX_NO = 0
PREFIX_YES = 1 PREFIX_YES = 1
RESIDENCE_ADDR = 0 RESIDENCE_ADDR = 0
RESIDENCE_PLAC = 1 RESIDENCE_PLAC = 1
SOURCE_REFS_NO = 0
SOURCE_REFS_YES = 1
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -60,6 +62,7 @@ class GedcomDescription:
self.cal = CALENDAR_YES self.cal = CALENDAR_YES
self.obje = OBJE_YES self.obje = OBJE_YES
self.resi = RESIDENCE_ADDR self.resi = RESIDENCE_ADDR
self.source_refs = SOURCE_REFS_YES
self.gramps2tag_map = {} self.gramps2tag_map = {}
self.tag2gramps_map = {} self.tag2gramps_map = {}
self.prefix = PREFIX_YES self.prefix = PREFIX_YES
@ -112,6 +115,12 @@ class GedcomDescription:
def get_resi(self): def get_resi(self):
return self.resi return self.resi
def set_source_refs(self,val):
self.source_refs = val
def get_source_refs(self):
return self.source_refs
def add_tag_value(self,tag,value): def add_tag_value(self,tag,value):
self.gramps2tag_map[value] = tag self.gramps2tag_map[value] = tag
self.tag2gramps_map[tag] = value self.tag2gramps_map[tag] = value
@ -227,3 +236,6 @@ class GedInfoParser:
elif tag == "residence": elif tag == "residence":
if attrs['val'] == 'place': if attrs['val'] == 'place':
self.current.set_resi(RESIDENCE_PLAC) self.current.set_resi(RESIDENCE_PLAC)
elif tag == "source_refs":
if u2l(attrs['val']) == 'no':
self.current.set_source_refs(SOURCE_REFS_NO)

View File

@ -11,6 +11,7 @@
</extended_events> </extended_events>
<object_support val="no"/> <object_support val="no"/>
<residence val="address"/> <residence val="address"/>
<source_refs val="yes"/>
</target> </target>
<target name="Family Origins"> <target name="Family Origins">
<dest val="FamilyOrigins"/> <dest val="FamilyOrigins"/>
@ -23,6 +24,7 @@
</extended_events> </extended_events>
<object_support val="no"/> <object_support val="no"/>
<residence val="address"/> <residence val="address"/>
<source_refs val="yes"/>
</target> </target>
<target name="Family Tree Maker"> <target name="Family Tree Maker">
<dest val="FTW"/> <dest val="FTW"/>
@ -38,6 +40,7 @@
<event tag="_MILT" value="Military Service"/> <event tag="_MILT" value="Military Service"/>
</extended_events> </extended_events>
<object_support val="no"/> <object_support val="no"/>
<source_refs val="yes"/>
<residence val="place"/> <residence val="place"/>
</target> </target>
<target name="Ftree"> <target name="Ftree">
@ -51,6 +54,7 @@
</extended_events> </extended_events>
<object_support val="no"/> <object_support val="no"/>
<residence val="address"/> <residence val="address"/>
<source_refs val="yes"/>
</target> </target>
<target name="GeneWeb"> <target name="GeneWeb">
<dest val=""/> <dest val=""/>
@ -63,6 +67,7 @@
</extended_events> </extended_events>
<object_support val="no"/> <object_support val="no"/>
<residence val="address"/> <residence val="address"/>
<source_refs val="no"/>
</target> </target>
<target name="Legacy"> <target name="Legacy">
<dest val="Legacy"/> <dest val="Legacy"/>
@ -75,6 +80,7 @@
</extended_events> </extended_events>
<object_support val="no"/> <object_support val="no"/>
<residence val="address"/> <residence val="address"/>
<source_refs val="yes"/>
</target> </target>
<target name="Personal Ancestral File"> <target name="Personal Ancestral File">
<dest val="PAF"/> <dest val="PAF"/>
@ -87,6 +93,7 @@
</extended_events> </extended_events>
<object_support val="no"/> <object_support val="no"/>
<residence val="address"/> <residence val="address"/>
<source_refs val="yes"/>
</target> </target>
<target name="Reunion"> <target name="Reunion">
<dest val="REUNION"/> <dest val="REUNION"/>
@ -99,6 +106,7 @@
</extended_events> </extended_events>
<object_support val="no"/> <object_support val="no"/>
<residence val="address"/> <residence val="address"/>
<source_refs val="yes"/>
</target> </target>
<target name="Pro-Gen"> <target name="Pro-Gen">
<dest val="PRO-GEN"/> <dest val="PRO-GEN"/>
@ -111,6 +119,7 @@
</extended_events> </extended_events>
<object_support val="no"/> <object_support val="no"/>
<residence val="address"/> <residence val="address"/>
<source_refs val="yes"/>
</target> </target>
<target name="Visual Genealogie"> <target name="Visual Genealogie">
<dest val=""/> <dest val=""/>
@ -123,6 +132,7 @@
</extended_events> </extended_events>
<object_support val="no"/> <object_support val="no"/>
<residence val="address"/> <residence val="address"/>
<source_refs val="yes"/>
</target> </target>
</targets> </targets>

View File

@ -259,8 +259,10 @@ class IndividualPage:
if self.person.getGender() == Person.male: if self.person.getGender() == Person.male:
self.write_normal_row("%s:" % _("Gender"), _("Male"),None) self.write_normal_row("%s:" % _("Gender"), _("Male"),None)
else: elif self.person.getGender() == Person.female:
self.write_normal_row("%s:" % _("Gender"), _("Female"),None) self.write_normal_row("%s:" % _("Gender"), _("Female"),None)
else:
self.write_normal_row("%s:" % _("Gender"), _("Unknown"),None)
family = self.person.getMainParents() family = self.person.getMainParents()
if family: if family:

View File

@ -412,6 +412,7 @@ class GedcomWriter:
self.obje = self.target_ged.get_obje() self.obje = self.target_ged.get_obje()
self.resi = self.target_ged.get_resi() self.resi = self.target_ged.get_resi()
self.prefix = self.target_ged.get_prefix() self.prefix = self.target_ged.get_prefix()
self.source_refs = self.target_ged.get_source_refs()
if self.topDialog.get_widget("ansel").get_active(): if self.topDialog.get_widget("ansel").get_active():
self.cnvtxt = latin_to_ansel self.cnvtxt = latin_to_ansel
@ -533,7 +534,10 @@ class GedcomWriter:
self.pbar.set_fraction(1.0) self.pbar.set_fraction(1.0)
self.write_families() self.write_families()
self.write_sources() if self.source_refs:
self.write_sources()
else:
self.sbar.set_value(100.0)
self.g.write("0 TRLR\n") self.g.write("0 TRLR\n")
self.g.close() self.g.close()
@ -945,17 +949,44 @@ class GedcomWriter:
def write_source_ref(self,level,ref): def write_source_ref(self,level,ref):
if ref.getBase() == None: if ref.getBase() == None:
return return
self.g.write("%d SOUR @%s@\n" % (level,self.sid(ref.getBase().getId()))) self.g.write("%d SOUR @%s@\n" % (level,self.sid(ref.getBase().getId())))
if ref.getPage(): if ref.getPage():
self.g.write("%d PAGE %s\n" % (level+1,ref.getPage())) self.g.write("%d PAGE %s\n" % (level+1,ref.getPage()))
ref_text = ref.getText() if self.source_refs:
if ref_text or not ref.getDate().isEmpty(): self.g.write("%d SOUR @%s@\n" %
self.g.write('%d DATA\n' % (level+1)) (level,self.sid(ref.getBase().getId())))
if ref_text: if ref.getPage() != "":
self.write_long_text("TEXT",level+2,ref_text) self.g.write("%d PAGE %s\n" % (level+1,ref.getPage()))
pfx = "%d DATE" % (level+2)
self.print_date(pfx,ref.getDate()) ref_text = ref.getText()
if ref_text != "" or not ref.getDate().isEmpty():
self.g.write('%d DATA\n' % (level+1))
if ref_text != "":
self.write_long_text("TEXT",level+2,ref_text)
pfx = "%d DATE" % (level+2)
self.print_date(pfx,ref.getDate())
else:
# We put title, page, and date on the SOUR line.
# Not using CONC because GeneWeb does not support this.
# TEXT and NOTE will be ignored by GeneWeb, but we can't
# output paragaphs in SOUR if we don't use CONC.
sbase = ref.getBase()
if sbase and sbase.getTitle():
txt = sbase.getTitle() + ". "
else:
txt = ""
if ref.getPage():
txt = txt + ref.getPage() + ". "
self.g.write("%d SOUR %s" % (level,self.cnvtxt(txt)))
if not ref.getDate().isEmpty():
self.print_date("", ref.getDate())
else:
self.g.write("\n")
if ref.getText():
self.write_long_text("TEXT",level+1,ref_text)
if ref.getComments(): if ref.getComments():
self.write_long_text("NOTE",level+1,ref.getComments()) self.write_long_text("NOTE",level+1,ref.getComments())