diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index ec0e82744..e4fb3f45e 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,4 +1,5 @@ 2006-03-30 Don Allingham + * src/Editors/_EditFamily.py: add surname guessing back in * src/Mime/_GnomeMime.py: filter out bad KDE mime type commands * src/Utils.py: clean up launch routine * src/Editors/_EditPerson.py: setup autocomp list diff --git a/gramps2/src/Editors/_EditFamily.py b/gramps2/src/Editors/_EditFamily.py index 36383c75e..a74ebb52d 100644 --- a/gramps2/src/Editors/_EditFamily.py +++ b/gramps2/src/Editors/_EditFamily.py @@ -191,6 +191,16 @@ class ChildEmbedList(EmbeddedList): from Editors import EditPerson person = RelLib.Person() + autoname = Config.get_lastnamegen() + if autoname == 0: + name = self.north_american() + elif autoname == 2: + name = self.latin_american() + else: + name = self.no_name() + person.get_primary_name().set_surname(name[1]) + person.get_primary_name().set_surname_prefix(name[0]) + EditPerson(self.dbstate,self.uistate,[],person, self.new_child_added) def new_child_added(self, person): @@ -270,6 +280,36 @@ class ChildEmbedList(EmbeddedList): except Errors.WindowActiveError: pass + def north_american(self): + father_handle = self.family.get_father_handle() + if father_handle: + father = self.dbstate.db.get_person_from_handle(father_handle) + pname = father.get_primary_name() + return (pname.get_surname_prefix(),pname.get_surname()) + return ("","") + + def no_name(self): + return ("","") + + def latin_american(self): + if self.family: + father_handle = self.family.get_father_handle() + mother_handle = self.family.get_mother_handle() + if not father_handle or not mother_handle: + return ("","") + father = self.db.db.get_person_from_handle(father_handle) + mother = self.db.db.get_person_from_handle(mother_handle) + fsn = father.get_primary_name().get_surname() + msn = mother.get_primary_name().get_surname() + if not father or not mother: + return ("","") + try: + return ("","%s %s" % (fsn.split()[0],msn.split()[0])) + except: + return ("","") + else: + return ("","") + class FastMaleFilter: def __init__(self,db): @@ -782,3 +822,4 @@ class EditFamily(EditPrimary): self.db.commit_family(self.obj,trans) self.db.transaction_commit(trans,_("Edit Family")) self.close_window() + diff --git a/gramps2/src/Editors/_EditPerson.py b/gramps2/src/Editors/_EditPerson.py index e434ff15b..1889917b5 100644 --- a/gramps2/src/Editors/_EditPerson.py +++ b/gramps2/src/Editors/_EditPerson.py @@ -476,8 +476,8 @@ class EditPerson(EditPrimary): self.pname, self.update_name) def update_name(self,name): - for obj in (self.suffix, self.prefix, self.given, self.title, self.ntype_field, - self.surname_field): + for obj in (self.suffix, self.prefix, self.given, self.title, + self.ntype_field, self.surname_field): obj.update() def load_person_image(self):