From 6620c09d5269878fd29c00d5538137c677e9d8c9 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Fri, 3 Jan 2003 03:19:50 +0000 Subject: [PATCH] GEDCOM improvements for GENEWEB from Alexandre Duret-Lutz svn: r1238 --- example/gramps/data.gramps | Bin 3745 -> 3767 bytes src/GedcomInfo.py | 12 ++++++++++ src/data/gedcom.xml | 10 ++++++++ src/plugins/WebPage.py | 4 +++- src/plugins/WriteGedcom.py | 47 ++++++++++++++++++++++++++++++------- 5 files changed, 64 insertions(+), 9 deletions(-) diff --git a/example/gramps/data.gramps b/example/gramps/data.gramps index 773b7b992e45481b6a81bbbb768873e140c2c584..5bd977f4aa061c7f3d28212d53bf084eac4f6659 100644 GIT binary patch delta 3730 zcmV;D4sG$F9k(3^ABzYGGC>lN2TOl?w}eZxm$*sOY|{ks?k$SL;lNmQ%vKT#N>1v3 ze?v;L@Uw)(sdL%rjEPLOx2UhQwlXu5|`EWD-?d$D1 zigAJOaZb?W>*TldYt(z-I9=p}xQKh`-~WN8b&HdC2p!J}jtLi+@MFpeE=YeYXpr|k z*G3=C$H=iPr?+8f3ZjA4UvLuk(1Nf<0xdnihh{jX2_-pnDd?e`E%{XZ@Ss(K<)!2G zh7}`Da)SAEUUM#QWjG}#XY3wLQd-Q9hxM&S6CB6<#I`In8K7%SGc+j%vY~v?XgHSVIuG<%p)lEku+yxC}!7chU&lP}~6eP#T+Y*OB85@O4&;H#70C#NNi>UX2bg27wK ziS4+aFWXc%noZ^`BPXuw_I=;)Mj@G>dh_ddC!UiI1nM9DHlW4P;ty*2v>l8Jw}FOG-RRsBE+ z0TrtSNcxQOVvfGRjrDubU`BafoSbGEJ|33Wn`a4zpOb{GCR7S>GJD^%mC%AW}UD8V|PTo!y+F&#joNd}jMP2F@~Q z;4n|nIYb_ZFmHch6!mSl5B=}p3SQ%K{0RI_-wD;e&C)fXu8u%#a{{^ihLaTY!-zw; z<-Tjbu{grWlc9#+g--`*IOe2r3Wkqn2N8w~@tD)M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LNk9>!RlDW?k~$F8neL>8lSG^ zwN1oX6S-qqMvu@LH1!|qM@~J_?bnNFBeB3vLt289DNqw*P1-hh-Qk$c++)x zL;48)LGn4HWoN(qOVP|-H>olJG;Npyi2ws!z-4N;U$a7jt)E47TY@leFip6@)h6d-qr1m692(il)xf! zgub$5mxZ%~Z4;+$;p}FIr<@3POIPYNmws`xU9ZCUt5x?WA!8+=Au2a)>UeV|3#7GNSyC!Sv zkp;i1LZbYPU<+wnlg3)4PwTJ3$N>5!f>uq?(jwUS7DKa_$HT^~IKF4>yO@0S9I1cT ZVWM3(YE(QPZvM%H{{i>eH@$yh007l|E1duU diff --git a/src/GedcomInfo.py b/src/GedcomInfo.py index 9b9a3cb4c..d4ac9e68a 100644 --- a/src/GedcomInfo.py +++ b/src/GedcomInfo.py @@ -42,6 +42,8 @@ PREFIX_NO = 0 PREFIX_YES = 1 RESIDENCE_ADDR = 0 RESIDENCE_PLAC = 1 +SOURCE_REFS_NO = 0 +SOURCE_REFS_YES = 1 #------------------------------------------------------------------------- # @@ -60,6 +62,7 @@ class GedcomDescription: self.cal = CALENDAR_YES self.obje = OBJE_YES self.resi = RESIDENCE_ADDR + self.source_refs = SOURCE_REFS_YES self.gramps2tag_map = {} self.tag2gramps_map = {} self.prefix = PREFIX_YES @@ -112,6 +115,12 @@ class GedcomDescription: def get_resi(self): 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): self.gramps2tag_map[value] = tag self.tag2gramps_map[tag] = value @@ -227,3 +236,6 @@ class GedInfoParser: elif tag == "residence": if attrs['val'] == 'place': self.current.set_resi(RESIDENCE_PLAC) + elif tag == "source_refs": + if u2l(attrs['val']) == 'no': + self.current.set_source_refs(SOURCE_REFS_NO) diff --git a/src/data/gedcom.xml b/src/data/gedcom.xml index 1f55efb03..2fc1d15a9 100644 --- a/src/data/gedcom.xml +++ b/src/data/gedcom.xml @@ -11,6 +11,7 @@ + @@ -23,6 +24,7 @@ + @@ -38,6 +40,7 @@ + @@ -51,6 +54,7 @@ + @@ -63,6 +67,7 @@ + @@ -75,6 +80,7 @@ + @@ -87,6 +93,7 @@ + @@ -99,6 +106,7 @@ + @@ -111,6 +119,7 @@ + @@ -123,6 +132,7 @@ + diff --git a/src/plugins/WebPage.py b/src/plugins/WebPage.py index 853cba352..d85d2d9b3 100644 --- a/src/plugins/WebPage.py +++ b/src/plugins/WebPage.py @@ -259,8 +259,10 @@ class IndividualPage: if self.person.getGender() == Person.male: self.write_normal_row("%s:" % _("Gender"), _("Male"),None) - else: + elif self.person.getGender() == Person.female: self.write_normal_row("%s:" % _("Gender"), _("Female"),None) + else: + self.write_normal_row("%s:" % _("Gender"), _("Unknown"),None) family = self.person.getMainParents() if family: diff --git a/src/plugins/WriteGedcom.py b/src/plugins/WriteGedcom.py index 05403e775..91d06c803 100644 --- a/src/plugins/WriteGedcom.py +++ b/src/plugins/WriteGedcom.py @@ -412,6 +412,7 @@ class GedcomWriter: self.obje = self.target_ged.get_obje() self.resi = self.target_ged.get_resi() self.prefix = self.target_ged.get_prefix() + self.source_refs = self.target_ged.get_source_refs() if self.topDialog.get_widget("ansel").get_active(): self.cnvtxt = latin_to_ansel @@ -533,7 +534,10 @@ class GedcomWriter: self.pbar.set_fraction(1.0) 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.close() @@ -945,17 +949,44 @@ class GedcomWriter: def write_source_ref(self,level,ref): if ref.getBase() == None: return + self.g.write("%d SOUR @%s@\n" % (level,self.sid(ref.getBase().getId()))) if ref.getPage(): self.g.write("%d PAGE %s\n" % (level+1,ref.getPage())) - 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()) + if self.source_refs: + self.g.write("%d SOUR @%s@\n" % + (level,self.sid(ref.getBase().getId()))) + if ref.getPage() != "": + self.g.write("%d PAGE %s\n" % (level+1,ref.getPage())) + + 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(): self.write_long_text("NOTE",level+1,ref.getComments())