From 1d449eb7c786aa62bb66e81d21db73253d152f0a Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Wed, 8 Jan 2003 04:58:00 +0000 Subject: [PATCH] Unselect selected person on goto_active_person, apply Alexandre Duret-Lutz's GEDCOM patches svn: r1243 --- src/GedcomInfo.py | 17 +++++++------- src/ListModel.py | 3 +++ src/data/gedcom.xml | 21 +++++++++-------- src/gramps_main.py | 1 + src/plugins/WriteGedcom.py | 46 ++++++++++++++++++++++---------------- 5 files changed, 49 insertions(+), 39 deletions(-) diff --git a/src/GedcomInfo.py b/src/GedcomInfo.py index d4ac9e68a..baa69d720 100644 --- a/src/GedcomInfo.py +++ b/src/GedcomInfo.py @@ -141,19 +141,16 @@ class GedcomInfoDB: self.standard = GedcomDescription("GEDCOM 5.5 standard") self.standard.set_dest("GEDCOM 5.5") - + try: file = "%s/gedcom.xml" % const.dataDir f = open(file,"r") except: return - - try: - parser = GedInfoParser(self) - parser.parse(f) - f.close() - except: - pass + + parser = GedInfoParser(self) + parser.parse(f) + f.close() def add_description(self,name,obj): self.map[name] = obj @@ -198,6 +195,7 @@ class GedInfoParser: elif tag == "dest": self.current.set_dest(attrs['val']) elif tag == "adopt": + val = attrs['val'] if val == 'none': self.current.set_adopt(ADOPT_NONE) elif val == 'event': @@ -212,6 +210,7 @@ class GedInfoParser: if attrs['val'] == 'broken': self.current.set_conc(CONC_BROKEN) elif tag == "alternate_names": + val = attrs['val'] if val == 'none': self.current.set_alt_name(ALT_NAME_NONE) elif val == 'event_aka': @@ -237,5 +236,5 @@ class GedInfoParser: if attrs['val'] == 'place': self.current.set_resi(RESIDENCE_PLAC) elif tag == "source_refs": - if u2l(attrs['val']) == 'no': + if attrs['val'] == 'no': self.current.set_source_refs(SOURCE_REFS_NO) diff --git a/src/ListModel.py b/src/ListModel.py index 118ee08c7..0830d1efb 100644 --- a/src/ListModel.py +++ b/src/ListModel.py @@ -68,6 +68,9 @@ class ListModel: self.double_click = event_func self.tree.connect('event',self.button_press) + def unselect(self): + self.selection.unselect_all() + def set_reorderable(self,order): self.tree.set_reorderable(order) diff --git a/src/data/gedcom.xml b/src/data/gedcom.xml index 2fc1d15a9..f3a3b757f 100644 --- a/src/data/gedcom.xml +++ b/src/data/gedcom.xml @@ -5,7 +5,7 @@ - + @@ -18,7 +18,7 @@ - + @@ -31,7 +31,7 @@ - + @@ -48,7 +48,7 @@ - + @@ -61,7 +61,7 @@ - + @@ -73,7 +73,7 @@ - + @@ -87,7 +87,7 @@ - + @@ -100,7 +100,7 @@ - + @@ -113,7 +113,7 @@ - + @@ -126,7 +126,7 @@ - + @@ -135,4 +135,3 @@ - diff --git a/src/gramps_main.py b/src/gramps_main.py index 417252f4c..611233f2c 100755 --- a/src/gramps_main.py +++ b/src/gramps_main.py @@ -891,6 +891,7 @@ class Gramps: if self.id2col.has_key(id): (model,iter) = self.id2col[id] self.ptabs.set_current_page(self.model2page[model]) + model.selection.unselect_all() model.selection.select_iter(iter); itpath = model.model.get_path(iter) col = model.tree.get_column(0) diff --git a/src/plugins/WriteGedcom.py b/src/plugins/WriteGedcom.py index 91d06c803..8d7eb1f43 100644 --- a/src/plugins/WriteGedcom.py +++ b/src/plugins/WriteGedcom.py @@ -49,6 +49,7 @@ import GenericFilter import const import Utils import Date +import Calendar from intl import gettext as _ from latin_utf8 import latin_to_utf8 from GedcomInfo import * @@ -77,15 +78,15 @@ _month = [ "JUL", "AUG", "SEP", "OCT", "NOV", "DEC" ] _calmap = { - Date.HEBREW : (_hmonth, '@#HEBREW@'), - Date.FRENCH : (_fmonth, '@#FRENCH R@'), - Date.JULIAN : (_month, '@#JULIAN@'), + Calendar.Hebrew : (_hmonth, '@#HEBREW@'), + Calendar.FrenchRepublic : (_fmonth, '@#FRENCH R@'), + Calendar.Julian : (_month, '@#JULIAN@'), } _caldef = { - Date.SingleDate.about : "ABT", - Date.SingleDate.about : "BEF", - Date.SingleDate.about : "AFT", + Calendar.ABOUT : "ABT", + Calendar.BEFORE : "BEF", + Calendar.AFTER : "AFT", } #------------------------------------------------------------------------- @@ -168,7 +169,7 @@ def addr_append(text,data): return "%s, %s" % (text,data) else: return text - + #------------------------------------------------------------------------- # # @@ -200,6 +201,12 @@ def make_date(subdate): mon_valid = subdate.getMonthValid() year_valid = subdate.getYearValid() + # Adjust `mon' so it can be used as index in our _Xmonth arrays. + if mon_valid: + mon += 1 + else: + mon = 0 + if _calmap.has_key(subdate.calendar): (mmap,prefix) = _calmap[subdate.calendar] else: @@ -370,11 +377,16 @@ class GedcomWriter: ans.set_name(_("Ancestors of %s") % person.getPrimaryName().getName()) ans.add_rule(GenericFilter.IsAncestorOf([person.getId()])) - self.filter_menu = GenericFilter.build_filter_menu([all,des,ans]) + com = GenericFilter.GenericFilter() + com.set_name(_("People with common ancestor with %s") % + person.getPrimaryName().getName()) + com.add_rule(GenericFilter.HasCommonAncestorWith([person.getId()])) + + self.filter_menu = GenericFilter.build_filter_menu([all,des,ans,com]) filter_obj.set_menu(self.filter_menu) gedmap = GedcomInfoDB() - + target_obj = self.topDialog.get_widget("target") myMenu = gtk.Menu() for name in gedmap.get_name_list(): @@ -425,9 +437,9 @@ class GedcomWriter: for p in self.db.getPersonKeys(): self.plist[p] = 1 else: - for p in cfilter.apply(self.db.getPersonMap().values()): + for p in cfilter.apply(self.db, self.db.getPersonMap().values()): self.plist[p.getId()] = 1 - + self.flist = {} self.slist = {} for key in self.plist.keys(): @@ -537,8 +549,8 @@ class GedcomWriter: if self.source_refs: self.write_sources() else: - self.sbar.set_value(100.0) - + self.sbar.set_fraction(1.0) + self.g.write("0 TRLR\n") self.g.close() @@ -950,10 +962,6 @@ class GedcomWriter: 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()))) @@ -969,9 +977,9 @@ class GedcomWriter: 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. + # Not using CONC and CONT because GeneWeb does not support these. # TEXT and NOTE will be ignored by GeneWeb, but we can't - # output paragaphs in SOUR if we don't use CONC. + # output paragaphs in SOUR without CONT. sbase = ref.getBase() if sbase and sbase.getTitle(): txt = sbase.getTitle() + ". "