From 644ba0f74cd4f596d234f0ded17c23236d00dc53 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Mon, 6 Oct 2003 04:29:50 +0000 Subject: [PATCH] * src/SelectChild.py: handle surname prefixes * src/FamilyView.py: handle surname prefixes * src/QuickAdd.py: handle surname prefixes * src/PeopleView.py: force a selection with a new person * src/PeopleStore.py: select correct model svn: r2198 --- src/FamilyView.py | 26 ++++++++++++++------------ src/PeopleStore.py | 6 +++--- src/PeopleView.py | 5 +++-- src/QuickAdd.py | 6 +++--- src/SelectChild.py | 23 ++++++++++++----------- 5 files changed, 35 insertions(+), 31 deletions(-) diff --git a/src/FamilyView.py b/src/FamilyView.py index 150edc12d..a7fddc1fb 100644 --- a/src/FamilyView.py +++ b/src/FamilyView.py @@ -477,7 +477,6 @@ class FamilyView: return person = RelLib.Person() - autoname = GrampsCfg.lastnamegen if autoname == 0: @@ -488,7 +487,8 @@ class FamilyView: name = self.icelandic(0) else: name = "" - person.getPrimaryName().setSurname(name) + person.getPrimaryName().setSurname(name[1]) + person.getPrimaryName().setSurnamePrefix(name[0]) try: EditPerson.EditPerson(person, self.parent.db, self.child_after_edit) @@ -1057,15 +1057,17 @@ class FamilyView: def north_american(self,val): if self.person.getGender() == RelLib.Person.male: - return self.person.getPrimaryName().getSurname() + pname = self.person.getPrimaryName() + return (pname.getSurnamePrefix(),pname.getSurname()) elif self.family: f = self.family.getFather() if f: - return f.getPrimaryName().getSurname() + pname = f.getPrimaryName() + return (pname.getSurnamePrefix(),pname.getSurname()) return "" def no_name(self,val): - return "" + return ("","") def latin_american(self,val): if self.family: @@ -1076,13 +1078,13 @@ class FamilyView: fsn = father.getPrimaryName().getSurname() msn = mother.getPrimaryName().getSurname() if not father or not mother: - return "" + return ("","") try: - return "%s %s" % (fsn.split()[0],msn.split()[0]) + return ("","%s %s" % (fsn.split()[0],msn.split()[0])) except: - return "" + return ("","") else: - return "" + return ("","") def icelandic(self,val): fname = "" @@ -1095,11 +1097,11 @@ class FamilyView: if fname: fname = fname.split()[0] if val == 0: - return "%ssson" % fname + return ("","%ssson" % fname) elif val == 1: - return "%sdóttir" % fname + return ("","%sdóttir" % fname) else: - return "" + return ("","") def drag_begin(self, obj, context): return diff --git a/src/PeopleStore.py b/src/PeopleStore.py index 5e18d8d6e..dc118d7c0 100644 --- a/src/PeopleStore.py +++ b/src/PeopleStore.py @@ -228,7 +228,7 @@ class PeopleStore: self.model.set_value(new_iter,col,o) col += 1 self.model.set_value(new_iter,_BCOL,pango.WEIGHT_NORMAL) - self.parent.id2col[d[1]] = (self.model,new_iter) + self.parent.id2col[d[1]] = (self,new_iter) def add(self,data,select=0): self.count = self.count + 1 @@ -244,8 +244,8 @@ class PeopleStore: self.model.set_value(top,0,name) self.model.set_value(top,_BCOL,pango.WEIGHT_BOLD) self.tree_roots[name] = top - - if self.tree_open[name]: + + if self.tree_open[name] or select: iter = self.model.append(top) col = 0 for object in data[:-1]: diff --git a/src/PeopleView.py b/src/PeopleView.py index 8321e40f7..44f0f916e 100644 --- a/src/PeopleView.py +++ b/src/PeopleView.py @@ -185,7 +185,7 @@ class PeopleView: model = self.default_list iter = model.add([val[0],val[1],val[2],val[3],val[4],val[5], - val[6],val[7],val[8]]) + val[6],val[7],val[8]],1) self.id2col[key] = (model,iter) @@ -229,7 +229,7 @@ class PeopleView: self.apply_filter(model) try: (model,iter) = self.id2col[id] - except: + except KeyError: return if not iter: @@ -240,6 +240,7 @@ class PeopleView: model.selection.unselect_all() model.selection.select_iter(iter) + itpath = model.model.get_path(iter) col = model.tree.get_column(0) model.tree.scroll_to_cell(itpath,col,1,0.5,0) diff --git a/src/QuickAdd.py b/src/QuickAdd.py index aece32a02..8ef359a6e 100644 --- a/src/QuickAdd.py +++ b/src/QuickAdd.py @@ -42,7 +42,7 @@ from gettext import gettext as _ # #------------------------------------------------------------------------- class QuickAdd: - def __init__(self,db,sex,callback,default_name = ""): + def __init__(self,db,sex,callback,default_name = ("","")): self.db = db self.callback = callback @@ -62,8 +62,8 @@ class QuickAdd: Utils.set_titles(self.window,title, _('Add Person')) self.c = AutoComp.AutoCombo(combo,self.db.getSurnames()) - if default_name: - self.surname.set_text(default_name) + if default_name[1]: + self.surname.set_text(default_name[1]) def close(self,obj): surname = self.surname.get_text() diff --git a/src/SelectChild.py b/src/SelectChild.py index d1a33cb1e..2a47e08a1 100644 --- a/src/SelectChild.py +++ b/src/SelectChild.py @@ -270,28 +270,29 @@ class SelectChild: elif self.family: f = self.family.getFather() if f: - return f.getPrimaryName().getSurname() - return "" + pname = f.getPrimaryName() + return (pname.getSurnamePrefix(),pname.getSurname()) + return ("","") def no_name(self,val): - return "" + return ("","") def latin_american(self,val): if self.family: father = self.family.getFather() mother = self.family.getMother() if not father or not mother: - return "" + return ("","") fsn = father.getPrimaryName().getSurname() msn = mother.getPrimaryName().getSurname() if not father or not mother: - return "" + return ("","") try: - return "%s %s" % (fsn.split()[0],msn.split()[0]) + return ("","%s %s" % (fsn.split()[0],msn.split()[0])) except: - return "" + return ("","") else: - return "" + return ("","") def icelandic(self,val): fname = "" @@ -304,11 +305,11 @@ class SelectChild: if fname: fname = string.split(fname)[0] if val == 0: - return "%ssson" % fname + return ("","%ssson" % fname) elif val == 1: - return "%sdóttir" % fname + return ("","%sdóttir" % fname) else: - return "" + return ("","") class EditRel: