diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 8e7bf35cd..82277de10 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,4 +1,7 @@ 2006-11-05 Don Allingham + * src/DataViews/_PersonView.py: provide a default surname for and Add + Person button press based of selected item in the Person View tree. + * help/C/various: remove unused files from manual * src/DataViews/_PlaceView.py: drag-n-drop support * src/GrampsWidgets.py: drag-n-drop support for place selector widget * src/ScratchPad.py: drag-n-drop support for places diff --git a/gramps2/src/DataViews/_PersonView.py b/gramps2/src/DataViews/_PersonView.py index 2745d5348..d4ccbfe83 100644 --- a/gramps2/src/DataViews/_PersonView.py +++ b/gramps2/src/DataViews/_PersonView.py @@ -493,7 +493,24 @@ class PersonView(PageView.PersonNavView): def add(self,obj): person = RelLib.Person() + + # attempt to get the current surname + + (mode,paths) = self.selection.get_selected_rows() + + name = u"" + + if len(paths) == 1: + path = paths[0] + if len(path) == 1: + name = self.model.on_get_iter(path) + else: + node = self.model.on_get_iter(path) + handle = self.model.on_get_value(node, PeopleModel.COLUMN_INT_ID) + p = self.dbstate.db.get_person_from_handle(handle) + name = p.get_primary_name().get_surname() try: + person.get_primary_name().set_surname(name) EditPerson(self.dbstate, self.uistate, [], person) except Errors.WindowActiveError: pass