* 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
This commit is contained in:
Don Allingham 2003-10-06 04:29:50 +00:00
parent 3a46b36b15
commit b7483de413
5 changed files with 35 additions and 31 deletions

View File

@ -477,7 +477,6 @@ class FamilyView:
return return
person = RelLib.Person() person = RelLib.Person()
autoname = GrampsCfg.lastnamegen autoname = GrampsCfg.lastnamegen
if autoname == 0: if autoname == 0:
@ -488,7 +487,8 @@ class FamilyView:
name = self.icelandic(0) name = self.icelandic(0)
else: else:
name = "" name = ""
person.getPrimaryName().setSurname(name) person.getPrimaryName().setSurname(name[1])
person.getPrimaryName().setSurnamePrefix(name[0])
try: try:
EditPerson.EditPerson(person, self.parent.db, self.child_after_edit) EditPerson.EditPerson(person, self.parent.db, self.child_after_edit)
@ -1057,15 +1057,17 @@ class FamilyView:
def north_american(self,val): def north_american(self,val):
if self.person.getGender() == RelLib.Person.male: if self.person.getGender() == RelLib.Person.male:
return self.person.getPrimaryName().getSurname() pname = self.person.getPrimaryName()
return (pname.getSurnamePrefix(),pname.getSurname())
elif self.family: elif self.family:
f = self.family.getFather() f = self.family.getFather()
if f: if f:
return f.getPrimaryName().getSurname() pname = f.getPrimaryName()
return (pname.getSurnamePrefix(),pname.getSurname())
return "" return ""
def no_name(self,val): def no_name(self,val):
return "" return ("","")
def latin_american(self,val): def latin_american(self,val):
if self.family: if self.family:
@ -1076,13 +1078,13 @@ class FamilyView:
fsn = father.getPrimaryName().getSurname() fsn = father.getPrimaryName().getSurname()
msn = mother.getPrimaryName().getSurname() msn = mother.getPrimaryName().getSurname()
if not father or not mother: if not father or not mother:
return "" return ("","")
try: try:
return "%s %s" % (fsn.split()[0],msn.split()[0]) return ("","%s %s" % (fsn.split()[0],msn.split()[0]))
except: except:
return "" return ("","")
else: else:
return "" return ("","")
def icelandic(self,val): def icelandic(self,val):
fname = "" fname = ""
@ -1095,11 +1097,11 @@ class FamilyView:
if fname: if fname:
fname = fname.split()[0] fname = fname.split()[0]
if val == 0: if val == 0:
return "%ssson" % fname return ("","%ssson" % fname)
elif val == 1: elif val == 1:
return "%sdóttir" % fname return ("","%sdóttir" % fname)
else: else:
return "" return ("","")
def drag_begin(self, obj, context): def drag_begin(self, obj, context):
return return

View File

@ -228,7 +228,7 @@ class PeopleStore:
self.model.set_value(new_iter,col,o) self.model.set_value(new_iter,col,o)
col += 1 col += 1
self.model.set_value(new_iter,_BCOL,pango.WEIGHT_NORMAL) 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): def add(self,data,select=0):
self.count = self.count + 1 self.count = self.count + 1
@ -244,8 +244,8 @@ class PeopleStore:
self.model.set_value(top,0,name) self.model.set_value(top,0,name)
self.model.set_value(top,_BCOL,pango.WEIGHT_BOLD) self.model.set_value(top,_BCOL,pango.WEIGHT_BOLD)
self.tree_roots[name] = top self.tree_roots[name] = top
if self.tree_open[name]: if self.tree_open[name] or select:
iter = self.model.append(top) iter = self.model.append(top)
col = 0 col = 0
for object in data[:-1]: for object in data[:-1]:

View File

@ -185,7 +185,7 @@ class PeopleView:
model = self.default_list model = self.default_list
iter = model.add([val[0],val[1],val[2],val[3],val[4],val[5], 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) self.id2col[key] = (model,iter)
@ -229,7 +229,7 @@ class PeopleView:
self.apply_filter(model) self.apply_filter(model)
try: try:
(model,iter) = self.id2col[id] (model,iter) = self.id2col[id]
except: except KeyError:
return return
if not iter: if not iter:
@ -240,6 +240,7 @@ class PeopleView:
model.selection.unselect_all() 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)
model.tree.scroll_to_cell(itpath,col,1,0.5,0) model.tree.scroll_to_cell(itpath,col,1,0.5,0)

View File

@ -42,7 +42,7 @@ from gettext import gettext as _
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class QuickAdd: class QuickAdd:
def __init__(self,db,sex,callback,default_name = ""): def __init__(self,db,sex,callback,default_name = ("","")):
self.db = db self.db = db
self.callback = callback self.callback = callback
@ -62,8 +62,8 @@ class QuickAdd:
Utils.set_titles(self.window,title, _('Add Person')) Utils.set_titles(self.window,title, _('Add Person'))
self.c = AutoComp.AutoCombo(combo,self.db.getSurnames()) self.c = AutoComp.AutoCombo(combo,self.db.getSurnames())
if default_name: if default_name[1]:
self.surname.set_text(default_name) self.surname.set_text(default_name[1])
def close(self,obj): def close(self,obj):
surname = self.surname.get_text() surname = self.surname.get_text()

View File

@ -270,28 +270,29 @@ class SelectChild:
elif self.family: elif self.family:
f = self.family.getFather() f = self.family.getFather()
if f: if f:
return f.getPrimaryName().getSurname() pname = f.getPrimaryName()
return "" return (pname.getSurnamePrefix(),pname.getSurname())
return ("","")
def no_name(self,val): def no_name(self,val):
return "" return ("","")
def latin_american(self,val): def latin_american(self,val):
if self.family: if self.family:
father = self.family.getFather() father = self.family.getFather()
mother = self.family.getMother() mother = self.family.getMother()
if not father or not mother: if not father or not mother:
return "" return ("","")
fsn = father.getPrimaryName().getSurname() fsn = father.getPrimaryName().getSurname()
msn = mother.getPrimaryName().getSurname() msn = mother.getPrimaryName().getSurname()
if not father or not mother: if not father or not mother:
return "" return ("","")
try: try:
return "%s %s" % (fsn.split()[0],msn.split()[0]) return ("","%s %s" % (fsn.split()[0],msn.split()[0]))
except: except:
return "" return ("","")
else: else:
return "" return ("","")
def icelandic(self,val): def icelandic(self,val):
fname = "" fname = ""
@ -304,11 +305,11 @@ class SelectChild:
if fname: if fname:
fname = string.split(fname)[0] fname = string.split(fname)[0]
if val == 0: if val == 0:
return "%ssson" % fname return ("","%ssson" % fname)
elif val == 1: elif val == 1:
return "%sdóttir" % fname return ("","%sdóttir" % fname)
else: else:
return "" return ("","")
class EditRel: class EditRel: