From 313faca8dab7e12463d2563d636dcdabff8bce01 Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Mon, 25 Aug 2003 14:00:26 +0000 Subject: [PATCH] * src/PedView.py (PedigreeView.__init__): Add parent argument to the constructor. Connect to the handling function on button press over the canvas to enable context menu; (on_canvas_press, build_nav_menu): Add functions to enable context menu. * src/gramps_main.py (init_interface): Call PedView with self as parent. * src/PlaceView.py (merge): Change error message from people to places. svn: r2042 --- ChangeLog | 8 ++++++++ src/PedView.py | 29 ++++++++++++++++++++++++++++- src/PlaceView.py | 4 ++-- src/gramps_main.py | 2 +- 4 files changed, 39 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2ab28f52c..8f3a8c709 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2003-08-25 Alex Roitman + * src/PedView.py (PedigreeView.__init__): Add parent argument to the + constructor. Connect to the handling function on button press over the + canvas to enable context menu; + (on_canvas_press, build_nav_menu): Add functions to enable context menu. + * src/gramps_main.py (init_interface): Call PedView with self as parent. + * src/PlaceView.py (merge): Change error message from people to places. + 2003-08-24 Don Allingham * src/plugins/FanChart.py: remove print statement * src/docgen/RTFDoc.py: change from TextDoc to BaseDoc diff --git a/src/PedView.py b/src/PedView.py index 07ebf7e44..0afcf2e9b 100644 --- a/src/PedView.py +++ b/src/PedView.py @@ -139,7 +139,8 @@ class DispBox: # #------------------------------------------------------------------------- class PedigreeView: - def __init__(self,canvas,update,status_bar,change_active,lp): + def __init__(self,parent,canvas,update,status_bar,change_active,lp): + self.parent = parent self.canvas = canvas self.canvas_items = [] self.boxes = [] @@ -154,6 +155,7 @@ class PedigreeView: self.change_active_person = change_active self.load_person = lp self.presel_descendants = [] + self.canvas.connect('button-press-event',self.on_canvas_press) def clear(self): for i in self.canvas_items: @@ -422,3 +424,28 @@ class PedigreeView: self.y1 = y1; self.y2 = y2 self.load_canvas(self.active_person) return 0 + + def on_canvas_press(self,obj,event): + if event.type == gtk.gdk.BUTTON_PRESS and event.button == 3: + self.build_nav_menu() + + def build_nav_menu(self): + """Builds the menu with navigation.""" + + back_sensitivity = self.parent.hindex > 0 + fwd_sensitivity = self.parent.hindex + 1 < len(self.parent.history) + entries = [ + ('gtk-go-back',self.parent.back_clicked,back_sensitivity), + ('gtk-go-forward',self.parent.fwd_clicked,fwd_sensitivity), + ('gtk-home',self.parent.on_home_clicked,1), + ] + menu = gtk.Menu() + menu.set_title(_('People Menu')) + for stock_id,callback,sensitivity in entries: + item = gtk.ImageMenuItem(stock_id) + if callback: + item.connect("activate",callback) + item.set_sensitive(sensitivity) + item.show() + menu.append(item) + menu.popup(None,None,None,0,0) diff --git a/src/PlaceView.py b/src/PlaceView.py index e642dff3f..a6d55ee4a 100644 --- a/src/PlaceView.py +++ b/src/PlaceView.py @@ -146,8 +146,8 @@ class PlaceView: self.selection.selected_foreach(self.blist,mlist) if len(mlist) != 2: - msg = _("Cannot merge people.") - msg2 = _("Exactly two people must be selected to perform a merge.") + msg = _("Cannot merge places.") + msg2 = _("Exactly two places must be selected to perform a merge.") ErrorDialog(msg,msg2) else: import MergeData diff --git a/src/gramps_main.py b/src/gramps_main.py index 11e3b37d0..926b4186f 100755 --- a/src/gramps_main.py +++ b/src/gramps_main.py @@ -363,7 +363,7 @@ class Gramps: self.family_view = FamilyView.FamilyView(self) - self.pedigree_view = PedView.PedigreeView( + self.pedigree_view = PedView.PedigreeView(self, self.canvas, self.modify_statusbar, self.statusbar, self.change_active_person, self.load_person )