* 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
This commit is contained in:
Alex Roitman 2003-08-25 14:00:26 +00:00
parent fb10339133
commit 358f95a2be
4 changed files with 39 additions and 4 deletions

View File

@ -1,3 +1,11 @@
2003-08-25 Alex Roitman <shura@alex.neuro.umn.edu>
* 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 <dallingham@users.sourceforge.net>
* src/plugins/FanChart.py: remove print statement
* src/docgen/RTFDoc.py: change from TextDoc to BaseDoc

View File

@ -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)

View File

@ -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

View File

@ -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
)