diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 2ab28f52c..8f3a8c709 100644 --- a/gramps2/ChangeLog +++ b/gramps2/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/gramps2/src/PedView.py b/gramps2/src/PedView.py index 07ebf7e44..0afcf2e9b 100644 --- a/gramps2/src/PedView.py +++ b/gramps2/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/gramps2/src/PlaceView.py b/gramps2/src/PlaceView.py index e642dff3f..a6d55ee4a 100644 --- a/gramps2/src/PlaceView.py +++ b/gramps2/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/gramps2/src/gramps_main.py b/gramps2/src/gramps_main.py index 11e3b37d0..926b4186f 100755 --- a/gramps2/src/gramps_main.py +++ b/gramps2/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 )