Unselect selected person on goto_active_person, apply Alexandre Duret-Lutz's

GEDCOM patches


svn: r1243
This commit is contained in:
Don Allingham 2003-01-08 04:58:00 +00:00
parent 7343ca181d
commit 1de1bb9790
5 changed files with 49 additions and 39 deletions

View File

@ -141,19 +141,16 @@ class GedcomInfoDB:
self.standard = GedcomDescription("GEDCOM 5.5 standard") self.standard = GedcomDescription("GEDCOM 5.5 standard")
self.standard.set_dest("GEDCOM 5.5") self.standard.set_dest("GEDCOM 5.5")
try: try:
file = "%s/gedcom.xml" % const.dataDir file = "%s/gedcom.xml" % const.dataDir
f = open(file,"r") f = open(file,"r")
except: except:
return return
try: parser = GedInfoParser(self)
parser = GedInfoParser(self) parser.parse(f)
parser.parse(f) f.close()
f.close()
except:
pass
def add_description(self,name,obj): def add_description(self,name,obj):
self.map[name] = obj self.map[name] = obj
@ -198,6 +195,7 @@ class GedInfoParser:
elif tag == "dest": elif tag == "dest":
self.current.set_dest(attrs['val']) self.current.set_dest(attrs['val'])
elif tag == "adopt": elif tag == "adopt":
val = attrs['val']
if val == 'none': if val == 'none':
self.current.set_adopt(ADOPT_NONE) self.current.set_adopt(ADOPT_NONE)
elif val == 'event': elif val == 'event':
@ -212,6 +210,7 @@ class GedInfoParser:
if attrs['val'] == 'broken': if attrs['val'] == 'broken':
self.current.set_conc(CONC_BROKEN) self.current.set_conc(CONC_BROKEN)
elif tag == "alternate_names": elif tag == "alternate_names":
val = attrs['val']
if val == 'none': if val == 'none':
self.current.set_alt_name(ALT_NAME_NONE) self.current.set_alt_name(ALT_NAME_NONE)
elif val == 'event_aka': elif val == 'event_aka':
@ -237,5 +236,5 @@ class GedInfoParser:
if attrs['val'] == 'place': if attrs['val'] == 'place':
self.current.set_resi(RESIDENCE_PLAC) self.current.set_resi(RESIDENCE_PLAC)
elif tag == "source_refs": elif tag == "source_refs":
if u2l(attrs['val']) == 'no': if attrs['val'] == 'no':
self.current.set_source_refs(SOURCE_REFS_NO) self.current.set_source_refs(SOURCE_REFS_NO)

View File

@ -68,6 +68,9 @@ class ListModel:
self.double_click = event_func self.double_click = event_func
self.tree.connect('event',self.button_press) self.tree.connect('event',self.button_press)
def unselect(self):
self.selection.unselect_all()
def set_reorderable(self,order): def set_reorderable(self,order):
self.tree.set_reorderable(order) self.tree.set_reorderable(order)

View File

@ -5,7 +5,7 @@
<adopt val="none"/> <adopt val="none"/>
<conc val="standard"/> <conc val="standard"/>
<alternate_names val="none"/> <alternate_names val="none"/>
<prefix val="no"> <prefix val="no"/>
<calendar val="no"/> <calendar val="no"/>
<extended_events> <extended_events>
</extended_events> </extended_events>
@ -18,7 +18,7 @@
<adopt val="event"/> <adopt val="event"/>
<conc val="broken"/> <conc val="broken"/>
<alternate_names val="event_aka"/> <alternate_names val="event_aka"/>
<prefix val="no"> <prefix val="no"/>
<calendar val="no"/> <calendar val="no"/>
<extended_events> <extended_events>
</extended_events> </extended_events>
@ -31,7 +31,7 @@
<adopt val="ftw"/> <adopt val="ftw"/>
<conc val="broken"/> <conc val="broken"/>
<alternate_names val="alias"/> <alternate_names val="alias"/>
<prefix val="no"> <prefix val="no"/>
<calendar val="no"/> <calendar val="no"/>
<extended_events> <extended_events>
<event tag="_DEG" value="Degree"/> <event tag="_DEG" value="Degree"/>
@ -48,7 +48,7 @@
<adopt val="none"/> <adopt val="none"/>
<conc val="broken"/> <conc val="broken"/>
<alternate_names val="none"/> <alternate_names val="none"/>
<prefix val="no"> <prefix val="no"/>
<calendar val="no"/> <calendar val="no"/>
<extended_events> <extended_events>
</extended_events> </extended_events>
@ -61,7 +61,7 @@
<adopt val="event_extended"/> <adopt val="event_extended"/>
<conc val="standard"/> <conc val="standard"/>
<alternate_names val="none"/> <alternate_names val="none"/>
<prefix val="no"> <prefix val="no"/>
<calendar val="yes"/> <calendar val="yes"/>
<extended_events> <extended_events>
</extended_events> </extended_events>
@ -73,7 +73,7 @@
<dest val="Legacy"/> <dest val="Legacy"/>
<adopt val="legacy"/> <adopt val="legacy"/>
<conc val="broken"/> <conc val="broken"/>
<prefix val="no"> <prefix val="no"/>
<alternate_names val="standard"/> <alternate_names val="standard"/>
<calendar val="no"/> <calendar val="no"/>
<extended_events> <extended_events>
@ -87,7 +87,7 @@
<adopt val="pedigree"/> <adopt val="pedigree"/>
<conc val="standard"/> <conc val="standard"/>
<alternate_names val="aka"/> <alternate_names val="aka"/>
<prefix val="no"> <prefix val="no"/>
<calendar val="no"/> <calendar val="no"/>
<extended_events> <extended_events>
</extended_events> </extended_events>
@ -100,7 +100,7 @@
<adopt val="none"/> <adopt val="none"/>
<conc val="broken"/> <conc val="broken"/>
<alternate_names val="none"/> <alternate_names val="none"/>
<prefix val="no"> <prefix val="no"/>
<calendar val="no"/> <calendar val="no"/>
<extended_events> <extended_events>
</extended_events> </extended_events>
@ -113,7 +113,7 @@
<adopt val="none"/> <adopt val="none"/>
<conc val="broken"/> <conc val="broken"/>
<alternate_names val="_alias"/> <alternate_names val="_alias"/>
<prefix val="no"> <prefix val="no"/>
<calendar val="no"/> <calendar val="no"/>
<extended_events> <extended_events>
</extended_events> </extended_events>
@ -126,7 +126,7 @@
<adopt val="none"/> <adopt val="none"/>
<conc val="broken"/> <conc val="broken"/>
<alternate_names val="none"/> <alternate_names val="none"/>
<prefix val="no"> <prefix val="no"/>
<calendar val="no"/> <calendar val="no"/>
<extended_events> <extended_events>
</extended_events> </extended_events>
@ -135,4 +135,3 @@
<source_refs val="yes"/> <source_refs val="yes"/>
</target> </target>
</targets> </targets>

View File

@ -891,6 +891,7 @@ class Gramps:
if self.id2col.has_key(id): if self.id2col.has_key(id):
(model,iter) = self.id2col[id] (model,iter) = self.id2col[id]
self.ptabs.set_current_page(self.model2page[model]) self.ptabs.set_current_page(self.model2page[model])
model.selection.unselect_all()
model.selection.select_iter(iter); model.selection.select_iter(iter);
itpath = model.model.get_path(iter) itpath = model.model.get_path(iter)
col = model.tree.get_column(0) col = model.tree.get_column(0)

View File

@ -49,6 +49,7 @@ import GenericFilter
import const import const
import Utils import Utils
import Date import Date
import Calendar
from intl import gettext as _ from intl import gettext as _
from latin_utf8 import latin_to_utf8 from latin_utf8 import latin_to_utf8
from GedcomInfo import * from GedcomInfo import *
@ -77,15 +78,15 @@ _month = [
"JUL", "AUG", "SEP", "OCT", "NOV", "DEC" ] "JUL", "AUG", "SEP", "OCT", "NOV", "DEC" ]
_calmap = { _calmap = {
Date.HEBREW : (_hmonth, '@#HEBREW@'), Calendar.Hebrew : (_hmonth, '@#HEBREW@'),
Date.FRENCH : (_fmonth, '@#FRENCH R@'), Calendar.FrenchRepublic : (_fmonth, '@#FRENCH R@'),
Date.JULIAN : (_month, '@#JULIAN@'), Calendar.Julian : (_month, '@#JULIAN@'),
} }
_caldef = { _caldef = {
Date.SingleDate.about : "ABT", Calendar.ABOUT : "ABT",
Date.SingleDate.about : "BEF", Calendar.BEFORE : "BEF",
Date.SingleDate.about : "AFT", Calendar.AFTER : "AFT",
} }
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -168,7 +169,7 @@ def addr_append(text,data):
return "%s, %s" % (text,data) return "%s, %s" % (text,data)
else: else:
return text return text
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# #
@ -200,6 +201,12 @@ def make_date(subdate):
mon_valid = subdate.getMonthValid() mon_valid = subdate.getMonthValid()
year_valid = subdate.getYearValid() 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): if _calmap.has_key(subdate.calendar):
(mmap,prefix) = _calmap[subdate.calendar] (mmap,prefix) = _calmap[subdate.calendar]
else: else:
@ -370,11 +377,16 @@ class GedcomWriter:
ans.set_name(_("Ancestors of %s") % person.getPrimaryName().getName()) ans.set_name(_("Ancestors of %s") % person.getPrimaryName().getName())
ans.add_rule(GenericFilter.IsAncestorOf([person.getId()])) 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) filter_obj.set_menu(self.filter_menu)
gedmap = GedcomInfoDB() gedmap = GedcomInfoDB()
target_obj = self.topDialog.get_widget("target") target_obj = self.topDialog.get_widget("target")
myMenu = gtk.Menu() myMenu = gtk.Menu()
for name in gedmap.get_name_list(): for name in gedmap.get_name_list():
@ -425,9 +437,9 @@ class GedcomWriter:
for p in self.db.getPersonKeys(): for p in self.db.getPersonKeys():
self.plist[p] = 1 self.plist[p] = 1
else: 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.plist[p.getId()] = 1
self.flist = {} self.flist = {}
self.slist = {} self.slist = {}
for key in self.plist.keys(): for key in self.plist.keys():
@ -537,8 +549,8 @@ class GedcomWriter:
if self.source_refs: if self.source_refs:
self.write_sources() self.write_sources()
else: else:
self.sbar.set_value(100.0) self.sbar.set_fraction(1.0)
self.g.write("0 TRLR\n") self.g.write("0 TRLR\n")
self.g.close() self.g.close()
@ -950,10 +962,6 @@ class GedcomWriter:
if ref.getBase() == None: if ref.getBase() == None:
return 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: if self.source_refs:
self.g.write("%d SOUR @%s@\n" % self.g.write("%d SOUR @%s@\n" %
(level,self.sid(ref.getBase().getId()))) (level,self.sid(ref.getBase().getId())))
@ -969,9 +977,9 @@ class GedcomWriter:
self.print_date(pfx,ref.getDate()) self.print_date(pfx,ref.getDate())
else: else:
# We put title, page, and date on the SOUR line. # 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 # 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() sbase = ref.getBase()
if sbase and sbase.getTitle(): if sbase and sbase.getTitle():
txt = sbase.getTitle() + ". " txt = sbase.getTitle() + ". "