add to famtree with name preset

svn: r16034
This commit is contained in:
Benny Malengier 2010-10-24 13:36:26 +00:00
parent cf943afcd5
commit 405572cbdc

View File

@ -158,17 +158,27 @@ class PersonTreeView(BasePersonView):
# attempt to get the current surname # attempt to get the current surname
(model, pathlist) = self.selection.get_selected_rows() (model, pathlist) = self.selection.get_selected_rows()
name = u"" name = gen.lib.Name()
basepers = None
if len(pathlist) == 1: if len(pathlist) == 1:
path = pathlist[0] path = pathlist[0]
if len(path) == 1: if len(path) == 1:
name = model.on_get_iter(path).name path = (path[0], 0)
else: node = model.get_iter(path)
node = model.on_get_iter(path) handle = model.get_value(node, self.handle_col)
name = model.on_iter_parent(node).name basepers = self.dbstate.db.get_person_from_handle(handle)
if basepers:
surnlist = []
primname = basepers.get_primary_name()
for surn in primname.get_surname_list():
surnlist.append(gen.lib.Surname(source=surn))
name.set_surname_list(surnlist)
name.set_family_nick_name(primname.get_family_nick_name())
name.set_group_as(primname.get_group_as())
name.set_sort_as(primname.get_sort_as())
try: try:
person.get_primary_name().set_surname(name) person.set_primary_name(name)
EditPerson(self.dbstate, self.uistate, [], person) EditPerson(self.dbstate, self.uistate, [], person)
except Errors.WindowActiveError: except Errors.WindowActiveError:
pass pass