From 83f416a7e327b2193340f4deae95f9fb879cc240 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Tue, 31 Oct 2006 23:03:58 +0000 Subject: [PATCH] * src/DataViews/_RelationView.py: add right context menu svn: r7531 --- gramps2/ChangeLog | 1 + gramps2/src/DataViews/_RelationView.py | 30 ++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index b9e024ded..f66157d4a 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,4 +1,5 @@ 2006-10-31 Don Allingham + * src/DataViews/_RelationView.py: add right context menu * src/DataViews/_PersonView.py: fix typo * src/GrampsCfg.py: Fix check box message for adding a family * src/Reorder.py: Allow for reordering of relationships, enhance diff --git a/gramps2/src/DataViews/_RelationView.py b/gramps2/src/DataViews/_RelationView.py index 1a0a6c1cd..a5bb5eaed 100644 --- a/gramps2/src/DataViews/_RelationView.py +++ b/gramps2/src/DataViews/_RelationView.py @@ -726,6 +726,36 @@ class RelationshipView(PageView.PersonNavView): def button_press(self, obj, event, handle): if event.type == gtk.gdk.BUTTON_PRESS and event.button == 1: self.dbstate.change_active_handle(handle) + elif event.type == gtk.gdk.BUTTON_PRESS and event.button == 3: + myMenu = gtk.Menu() + myMenu.append(self.build_menu_item(handle)) + myMenu.popup(None,None,None,0,0) + + def build_menu_item(self, handle): + person = self.dbstate.db.get_person_from_handle(handle) + name = NameDisplay.displayer.display(person) + + item = gtk.ImageMenuItem(None) + image = gtk.image_new_from_stock(gtk.STOCK_EDIT, gtk.ICON_SIZE_MENU) + image.show() + label = gtk.Label(name) + label.show() + label.set_alignment(0,0) + + item.set_image(image) + item.add(label) + + item.connect('activate',self.edit_menu, handle) + item.show() + return item + + def edit_menu(self, obj, handle): + from Editors import EditPerson + person = self.dbstate.db.get_person_from_handle(handle) + try: + EditPerson(self.dbstate, self.uistate, [], person) + except Errors.WindowActiveError: + pass def write_relationship(self, box, family): msg = _('Relationship type: %s') % str(family.get_relationship())