From a4343f0de817ea45d9c590151fd83471d5473b0e Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Mon, 6 Nov 2006 00:41:13 +0000 Subject: [PATCH] * 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 svn: r7557 --- ChangeLog | 3 +++ src/DataViews/_PersonView.py | 17 +++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/ChangeLog b/ChangeLog index 8e7bf35cd..82277de10 100644 --- a/ChangeLog +++ b/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/src/DataViews/_PersonView.py b/src/DataViews/_PersonView.py index 2745d5348..d4ccbfe83 100644 --- a/src/DataViews/_PersonView.py +++ b/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