* 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
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

View File

@ -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
@ -245,7 +245,7 @@ class PeopleStore:
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]:

View File

@ -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)

View File

@ -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()

View File

@ -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: