From b949026b19d6c6df6f5dfb5362bd9332e2b3705d Mon Sep 17 00:00:00 2001 From: Sam Manzi Date: Fri, 18 Oct 2019 13:58:41 +1100 Subject: [PATCH] Relationships view new toolbar icon to [Add a new Person] redone to work with the new uimanager in gramps51 --- gramps/plugins/view/relview.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/gramps/plugins/view/relview.py b/gramps/plugins/view/relview.py index d52e701e7..a87655f5a 100644 --- a/gramps/plugins/view/relview.py +++ b/gramps/plugins/view/relview.py @@ -392,6 +392,10 @@ class RelationshipView(NavigationView): ''', ''' + + win.AddNewPerson + Add new Person... + win.Edit Edit... @@ -478,6 +482,18 @@ class RelationshipView(NavigationView): ''', ''' + + + gramps-person + win.AddNewPerson + ''' + '''Add a new Person + Add new Person... + + + False + + gtk-edit @@ -551,6 +567,7 @@ class RelationshipView(NavigationView): self.family_action = ActionGroup(name=self.title + '/Family') self.family_action.add_actions([ + ('AddNewPerson', self.add_new_person), ('Edit', self.edit_active, "Return"), ('AddSpouse', self.add_spouse), ('AddParents', self.add_parents), @@ -1667,6 +1684,20 @@ class RelationshipView(NavigationView): except WindowActiveError: pass + def add_new_person(self, obj, event): + """ + Add a new person to the database. + """ + person = Person() + #the editor requires a surname + person.primary_name.add_surname(Surname()) + person.primary_name.set_primary_surname(0) + + try: + EditPerson(self.dbstate, self.uistate, [], person) + except WindowActiveError: + pass + def add_family(self, obj, event, handle): if button_activated(event, _LEFT_BUTTON): family = Family()