Fixed ISO date format

svn: r1265
This commit is contained in:
Don Allingham 2003-01-20 13:31:49 +00:00
parent 8fb0e3dcb4
commit c273028fac
5 changed files with 73 additions and 13 deletions

View File

@ -42,6 +42,8 @@ OBJE_NO = 0
OBJE_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 = {}
@ -105,6 +108,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
@ -220,3 +229,6 @@ class GedInfoParser:
elif tag == "residence":
if u2l(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)

View File

@ -194,6 +194,9 @@ class XmlWriter:
for key in self.db.getPersonKeys():
person = self.db.getPerson(key)
if not person:
GnomeErrorDialog("Person ID %s was NULL" % key)
continue
if self.callback and count % delta == 0:
self.callback(float(count)/float(total))
count = count + 1

View File

@ -10,6 +10,7 @@
</extended_events>
<object_support val="no"/>
<residence val="address"/>
<source_refs val="yes"/>
</target>
<target name="Family Origins">
<dest val="FamilyOrigins"/>
@ -21,6 +22,7 @@
</extended_events>
<object_support val="no"/>
<residence val="address"/>
<source_refs val="yes"/>
</target>
<target name="Family Tree Maker">
<dest val="FTW"/>
@ -36,6 +38,7 @@
</extended_events>
<object_support val="no"/>
<residence val="place"/>
<source_refs val="yes"/>
</target>
<target name="Ftree">
<dest val=""/>
@ -47,6 +50,7 @@
</extended_events>
<object_support val="no"/>
<residence val="address"/>
<source_refs val="yes"/>
</target>
<target name="GeneWeb">
<dest val=""/>
@ -58,6 +62,7 @@
</extended_events>
<object_support val="no"/>
<residence val="address"/>
<source_refs val="no"/>
</target>
<target name="Legacy">
<dest val="Legacy"/>
@ -69,6 +74,7 @@
</extended_events>
<object_support val="no"/>
<residence val="address"/>
<source_refs val="yes"/>
</target>
<target name="Personal Ancestral File">
<dest val="PAF"/>
@ -80,6 +86,7 @@
</extended_events>
<object_support val="no"/>
<residence val="address"/>
<source_refs val="yes"/>
</target>
<target name="Reunion">
<dest val="REUNION"/>
@ -91,6 +98,7 @@
</extended_events>
<object_support val="no"/>
<residence val="address"/>
<source_refs val="yes"/>
</target>
<target name="Pro-Gen">
<dest val="PRO-GEN"/>
@ -102,6 +110,7 @@
</extended_events>
<object_support val="no"/>
<residence val="address"/>
<source_refs val="yes"/>
</target>
<target name="Visual Genealogie">
<dest val=""/>
@ -113,5 +122,6 @@
</extended_events>
<object_support val="no"/>
<residence val="address"/>
<source_refs val="yes"/>
</target>
</targets>

View File

@ -137,6 +137,11 @@ def importData(database, filename, cb=None):
try:
close = g.parse_gedcom_file()
except IOError,msg:
Utils.destroy_passed_object(statusWindow)
errmsg = _("%s could not be opened\n") % filename
gnome.ui.GnomeErrorDialog(errmsg + str(msg))
return
except GedcomParser.BadFile, msg:
Utils.destroy_passed_object(statusWindow)
gnome.ui.GnomeErrorDialog(_("Failure reading %s: %s\n"
@ -144,6 +149,11 @@ def importData(database, filename, cb=None):
"but was '%s'") %
(filename,GedcomParser.BadFile,msg))
return
except:
import DisplayTrace
Utils.destroy_passed_object(statusWindow)
DisplayTrace.DisplayTrace()
return
g.resolve_refns()

View File

@ -388,6 +388,7 @@ class GedcomWriter:
self.cal = self.target_ged.get_alt_calendar()
self.obje = self.target_ged.get_obje()
self.resi = self.target_ged.get_resi()
self.source_refs = self.target_ged.get_source_refs()
if self.topDialog.get_widget("ansel").get_active():
self.cnvtxt = latin_to_ansel
@ -509,8 +510,11 @@ class GedcomWriter:
self.pbar.set_value(100.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()
@ -914,20 +918,41 @@ 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()))
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())
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())
def fid(self,id):
return id