From c951994948b0afe451afedaf2abf7b933731e7d0 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Sun, 19 Aug 2007 03:25:07 +0000 Subject: [PATCH] 2007-08-18 Don Allingham * src/GrampsDbUtils/_GedcomParse.py: fix event names, url type * src/GrampsDbUtils/_WriteGedcom.py: remove non-standard format types * src/GrampsDbUtils/gedcomexport.glade: remove non-standard format types svn: r8836 --- ChangeLog | 5 ++ src/GrampsDbUtils/_GedcomParse.py | 18 ++++--- src/GrampsDbUtils/_WriteGedcom.py | 38 +++++--------- src/GrampsDbUtils/gedcomexport.glade | 77 ++++------------------------ 4 files changed, 38 insertions(+), 100 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5f66277dc..826d33f36 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-08-18 Don Allingham + * src/GrampsDbUtils/_GedcomParse.py: fix event names, url type + * src/GrampsDbUtils/_WriteGedcom.py: remove non-standard format types + * src/GrampsDbUtils/gedcomexport.glade: remove non-standard format types + 2007-08-18 Brian Matherly * src/plugins/KinshipReport.py: fix typo nefew -> nephew * src/Relationship.py: fix typo nefew -> nephew diff --git a/src/GrampsDbUtils/_GedcomParse.py b/src/GrampsDbUtils/_GedcomParse.py index f4fc63634..29d02c0d3 100644 --- a/src/GrampsDbUtils/_GedcomParse.py +++ b/src/GrampsDbUtils/_GedcomParse.py @@ -343,13 +343,12 @@ class GedcomParser(UpdateCallback): UpdateCallback.__init__(self, callback) self.set_total(stage_one.get_line_count()) - self.repo2id = {} self.maxpeople = stage_one.get_person_count() self.dbase = dbase self.emapper = GedcomUtils.IdFinder(dbase.get_gramps_ids(EVENT_KEY), dbase.eprefix) - + self.empty_cref = RelLib.ChildRef() self.famc_map = stage_one.get_famc_map() self.fams_map = stage_one.get_fams_map() @@ -2276,13 +2275,17 @@ class GedcomParser(UpdateCallback): ref.set_mother_relation(sub_state.ftype) ref.set_father_relation(sub_state.ftype) break - else: - ref = RelLib.ChildRef() - ref.ref = state.person.handle + else: + # We are cheating here. Profing has indicated that the ChildRef + #constructor can consume a lot of time. So, we created a generic + # ChildRef in the class and we just modify it and assign it. + # We use the fact that only the ref field is used, and a copy of + # this is made elsewhere. + self.empty_cref.ref = state.person.handle if sub_state.ftype: ref.set_mother_relation(sub_state.ftype) ref.set_father_relation(sub_state.ftype) - family.add_child_ref(ref) + family.add_child_ref(self.empty_cref) self.dbase.commit_family(family, self.trans) def __person_famc_pedi(self, line, state): @@ -4380,6 +4383,7 @@ class GedcomParser(UpdateCallback): url = RelLib.Url() url.set_path(filename) url.set_description(title) + url.set_type(RelLib.UrlType.WEB_HOME) obj.add_url(url) else: (valid, path) = self.__find_file(filename, self.dir_path) @@ -4514,7 +4518,7 @@ def person_event_name(event, person): event.set_description(text) def family_event_name(event, family, dbase): - if not event.get_description(): + if not event.get_description() or event.get_description() == "Y": text = EVENT_FAMILY_STR % { 'event_name' : str(event.get_type()), 'family' : Utils.family_name(family, dbase), diff --git a/src/GrampsDbUtils/_WriteGedcom.py b/src/GrampsDbUtils/_WriteGedcom.py index 2d9b6d1d9..d5dc3085c 100644 --- a/src/GrampsDbUtils/_WriteGedcom.py +++ b/src/GrampsDbUtils/_WriteGedcom.py @@ -258,7 +258,6 @@ class GedcomWriterOptionBox: def get_option_box(self): self.restrict = True - self.adopt = GedcomInfo.ADOPT_EVENT glade_file = "%s/gedcomexport.glade" % os.path.dirname(__file__) if not os.path.isfile(glade_file): @@ -305,7 +304,6 @@ class GedcomWriterOptionBox: gedmap = GedcomInfo.GedcomInfoDB() - target_obj = self.topDialog.get_widget("target") myMenu = gtk.Menu() for name in gedmap.get_name_list(): menuitem = gtk.MenuItem(name) @@ -314,9 +312,6 @@ class GedcomWriterOptionBox: menuitem.set_data("data", data) menuitem.show() - target_obj.set_menu(myMenu) - self.target_menu = myMenu - the_box = self.topDialog.get_widget('vbox1') the_parent = self.topDialog.get_widget('dialog-vbox1') the_parent.remove(the_box) @@ -333,7 +328,7 @@ class GedcomWriterOptionBox: def parse_options(self): self.restrict = self.topDialog.get_widget("restrict").get_active() - self.living = (self.restrict and + self.living = (self.restrict and self.topDialog.get_widget("living").get_active()) self.exclnotes = (self.restrict and self.topDialog.get_widget("notes").get_active()) @@ -341,9 +336,7 @@ class GedcomWriterOptionBox: self.topDialog.get_widget("sources").get_active()) self.cfilter = self.filter_menu.get_active().get_data("filter") - act_tgt = self.target_menu.get_active() - self.target_ged = act_tgt.get_data("data") self.images = self.topDialog.get_widget ("images").get_active () if self.images: images_path = self.topDialog.get_widget ("images_path") @@ -351,8 +344,6 @@ class GedcomWriterOptionBox: else: self.images_path = "" - self.adopt = self.target_ged.get_adopt() - #------------------------------------------------------------------------- # # GedcomWriter class @@ -378,6 +369,9 @@ class GedcomWriter(UpdateCallback): if not setup_func(): return + gedmap = GedcomInfo.GedcomInfoDB() + self.target_ged = gedmap.standard + self.flist = set() self.slist = set() self.rlist = set() @@ -416,8 +410,6 @@ class GedcomWriter(UpdateCallback): self.exclsrcs = self.option_box.exclsrcs self.images = self.option_box.images self.images_path = self.option_box.images_path - self.target_ged = self.option_box.target_ged - self.adopt = self.option_box.adopt if self.option_box.cfilter == None: self.plist = set(self.db.get_person_handles(sort_handles=False)) @@ -441,8 +433,6 @@ class GedcomWriter(UpdateCallback): gedmap = GedcomInfo.GedcomInfoDB() self.target_ged = gedmap.standard - self.adopt = self.target_ged.get_adopt() - return True def export_data(self, filename): @@ -580,8 +570,7 @@ class GedcomWriter(UpdateCallback): sorted.sort() for data in sorted: - person = self.db.get_person_from_handle(data[1]) - self.__write_person(person) + self.__write_person(self.db.get_person_from_handle(data[1])) self.update() def __write_person(self, person): @@ -742,7 +731,14 @@ class GedcomWriter(UpdateCallback): self.__writeln(3, 'ADOP', 'HUSB') def __write_attributes(self, person): - for attr in person.get_attribute_list(): + + # filter out the Nicknames, since they have already been + # processed. + + attr_list = [ attr for attr in person.get_attribute_list() + if attr.get_type() != RelLib.AttributeType.NICKNAME ] + + for attr in attr_list: t = int(attr.get_type()) name = GedcomInfo.personalConstantAttributes.get(t) @@ -805,14 +801,6 @@ class GedcomWriter(UpdateCallback): family = self.db.get_family_from_handle(family_handle) family_id = family.get_gramps_id() self.__writeln(1, 'FAMC', '@%s@' % family_id) - if self.adopt == GedcomInfo.ADOPT_PEDI: - # Go over all children of the family to find the ref - for child_ref in family.get_child_ref_list(): - if child_ref.ref == person.handle: - if (child_ref.frel == RelLib.ChildRefType.ADOPTED) \ - or (child_ref.mrel == RelLib.ChildRefType.ADOPTED): - self.__writeln(2, 'PEDI', 'Adopted') - break def __write_parent_families(self, person): for family_handle in person.get_family_handle_list(): diff --git a/src/GrampsDbUtils/gedcomexport.glade b/src/GrampsDbUtils/gedcomexport.glade index a47fd4389..3a326dfdd 100644 --- a/src/GrampsDbUtils/gedcomexport.glade +++ b/src/GrampsDbUtils/gedcomexport.glade @@ -92,7 +92,7 @@ 12 True - 7 + 6 3 False 6 @@ -177,65 +177,6 @@ - - - True - _Target: - True - False - GTK_JUSTIFY_CENTER - False - False - 0 - 0.5 - 0 - 0 - target - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 1 - 2 - 2 - 3 - fill - - - - - - - True - True - 0 - - - - True - - - - True - Standard GEDCOM 5.5 - True - - - - - - - 2 - 3 - 2 - 3 - fill - - - - 3 @@ -252,8 +193,8 @@ 1 3 - 3 - 4 + 2 + 3 fill @@ -276,8 +217,8 @@ 1 3 - 4 - 5 + 3 + 4 fill @@ -375,8 +316,8 @@ 1 3 - 5 - 6 + 4 + 5 fill @@ -428,8 +369,8 @@ 1 3 - 6 - 7 + 5 + 6 fill