* src/SourceView.py: Correct behavior for right-click popup menu.

* src/EditPerson.py: Likewise.
* src/FamilyView.py: Likewise.
* src/ImageSelect.py: Likewise.
* src/PedView.py: Likewise.
* src/PlaceView.py: Likewise.
* src/plugins/BookReport.py: Likewise.
* src/PeopleView.py: Likewise.


svn: r2270
This commit is contained in:
Alex Roitman 2003-10-20 02:47:03 +00:00
parent f04c26b90d
commit 73fcaec440
9 changed files with 69 additions and 49 deletions

View File

@ -1,3 +1,13 @@
2003-10-19 Alex Roitman <shura@alex.neuro.umn.edu>
* src/SourceView.py: Correct behavior for right-click popup menu.
* src/EditPerson.py: Likewise.
* src/FamilyView.py: Likewise.
* src/ImageSelect.py: Likewise.
* src/PedView.py: Likewise.
* src/PlaceView.py: Likewise.
* src/plugins/BookReport.py: Likewise.
* src/PeopleView.py: Likewise.
2003-10-18 Alex Roitman <shura@alex.neuro.umn.edu> 2003-10-18 Alex Roitman <shura@alex.neuro.umn.edu>
* src/SourceView.py: Enable popup menu on right-click. * src/SourceView.py: Enable popup menu on right-click.
* src/PlaceView.py: Likewise. * src/PlaceView.py: Likewise.

View File

@ -18,6 +18,8 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# #
# $Id$
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# Standard python modules # Standard python modules
@ -1225,7 +1227,7 @@ class EditPerson:
menu.append(item) menu.append(item)
msg = _("Make the selected name the preferred name") msg = _("Make the selected name the preferred name")
Utils.add_menuitem(menu,msg,None,self.change_name) Utils.add_menuitem(menu,msg,None,self.change_name)
menu.popup(None,None,None,0,0) menu.popup(None,None,None,event.button,event.time)
def on_aka_update_clicked(self,obj): def on_aka_update_clicked(self,obj):
import NameEdit import NameEdit

View File

@ -199,9 +199,9 @@ class FamilyView:
if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1: if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1:
self.parent.load_person(self.person) self.parent.load_person(self.person)
elif event.type == gtk.gdk.BUTTON_PRESS and event.button == 3 and self.person: elif event.type == gtk.gdk.BUTTON_PRESS and event.button == 3 and self.person:
self.build_ap_menu() self.build_ap_menu(event)
def build_ap_menu(self): def build_ap_menu(self,event):
"""Builds the menu with navigation for the active person box""" """Builds the menu with navigation for the active person box"""
back_sensitivity = self.parent.hindex > 0 back_sensitivity = self.parent.hindex > 0
@ -221,9 +221,9 @@ class FamilyView:
item.set_sensitive(sensitivity) item.set_sensitive(sensitivity)
item.show() item.show()
menu.append(item) menu.append(item)
menu.popup(None,None,None,0,0) menu.popup(None,None,None,event.button,event.time)
def build_nav_menu(self): def build_nav_menu(self,event):
"""Builds the menu with navigation (no bookmark)""" """Builds the menu with navigation (no bookmark)"""
back_sensitivity = self.parent.hindex > 0 back_sensitivity = self.parent.hindex > 0
@ -242,9 +242,9 @@ class FamilyView:
item.set_sensitive(sensitivity) item.set_sensitive(sensitivity)
item.show() item.show()
menu.append(item) menu.append(item)
menu.popup(None,None,None,0,0) menu.popup(None,None,None,event.button,event.time)
def build_parents_nosel_menu(self): def build_parents_nosel_menu(self,event):
"""Builds the menu with navigation and Add parents""" """Builds the menu with navigation and Add parents"""
back_sensitivity = self.parent.hindex > 0 back_sensitivity = self.parent.hindex > 0
@ -265,9 +265,9 @@ class FamilyView:
item.set_sensitive(sensitivity) item.set_sensitive(sensitivity)
item.show() item.show()
menu.append(item) menu.append(item)
menu.popup(None,None,None,0,0) menu.popup(None,None,None,event.button,event.time)
def build_sp_parents_nosel_menu(self): def build_sp_parents_nosel_menu(self,event):
"""Builds the menu with navigation and Add parents""" """Builds the menu with navigation and Add parents"""
back_sensitivity = self.parent.hindex > 0 back_sensitivity = self.parent.hindex > 0
@ -288,21 +288,21 @@ class FamilyView:
item.set_sensitive(sensitivity) item.set_sensitive(sensitivity)
item.show() item.show()
menu.append(item) menu.append(item)
menu.popup(None,None,None,0,0) menu.popup(None,None,None,event.button,event.time)
def on_child_list_button_press(self,obj,event): def on_child_list_button_press(self,obj,event):
model, iter = self.child_selection.get_selected() model, iter = self.child_selection.get_selected()
if not iter: if not iter:
if event.type == gtk.gdk.BUTTON_PRESS and event.button == 3: if event.type == gtk.gdk.BUTTON_PRESS and event.button == 3:
self.build_nav_menu() self.build_nav_menu(event)
return return
id = self.child_model.get_value(iter,2) id = self.child_model.get_value(iter,2)
if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1: if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1:
self.parent.load_person(self.parent.db.getPerson(id)) self.parent.load_person(self.parent.db.getPerson(id))
elif event.type == gtk.gdk.BUTTON_PRESS and event.button == 3: elif event.type == gtk.gdk.BUTTON_PRESS and event.button == 3:
self.build_child_menu(id) self.build_child_menu(id,event)
def build_child_menu(self,id): def build_child_menu(self,id,event):
"""Builds the menu that allows editing operations on the child list""" """Builds the menu that allows editing operations on the child list"""
menu = gtk.Menu() menu = gtk.Menu()
@ -332,7 +332,7 @@ class FamilyView:
] ]
for msg,callback in entries: for msg,callback in entries:
Utils.add_menuitem(menu,msg,id,callback) Utils.add_menuitem(menu,msg,id,callback)
menu.popup(None,None,None,0,0) menu.popup(None,None,None,event.button,event.time)
def edit_child_callback(self,obj): def edit_child_callback(self,obj):
model, iter = self.child_selection.get_selected() model, iter = self.child_selection.get_selected()
@ -356,7 +356,7 @@ class FamilyView:
row = model.get_path(iter) row = model.get_path(iter)
self.display_marriage(self.person.getFamilyList()[row[0]]) self.display_marriage(self.person.getFamilyList()[row[0]])
def build_spouse_menu(self): def build_spouse_menu(self,event):
menu = gtk.Menu() menu = gtk.Menu()
menu.set_title(_('Spouse Menu')) menu.set_title(_('Spouse Menu'))
@ -385,8 +385,8 @@ class FamilyView:
(_("Set the selected spouse as the preferred spouse"), self.set_preferred_spouse), (_("Set the selected spouse as the preferred spouse"), self.set_preferred_spouse),
] ]
for msg,callback in entries: for msg,callback in entries:
Utils.add_menuitem(menu,msg,id,callback) Utils.add_menuitem(menu,msg,None,callback)
menu.popup(None,None,None,0,0) menu.popup(None,None,None,event.button,event.time)
def set_preferred_spouse(self,obj): def set_preferred_spouse(self,obj):
if self.selected_spouse: if self.selected_spouse:
@ -413,9 +413,9 @@ class FamilyView:
elif event.type == gtk.gdk.BUTTON_PRESS and event.button == 3: elif event.type == gtk.gdk.BUTTON_PRESS and event.button == 3:
if self.selected_spouse: if self.selected_spouse:
self.build_spouse_menu() self.build_spouse_menu(event)
else: else:
self.build_nav_menu() self.build_nav_menu(event)
elif event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1: elif event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1:
if self.person: if self.person:
try: try:
@ -819,7 +819,7 @@ class FamilyView:
5,status, 5,status,
6,val[6]) 6,val[6])
def build_parents_menu(self,family): def build_parents_menu(self,family,event):
"""Builds the menu that allows editing operations on the child list""" """Builds the menu that allows editing operations on the child list"""
menu = gtk.Menu() menu = gtk.Menu()
menu.set_title(_('Parents Menu')) menu.set_title(_('Parents Menu'))
@ -848,9 +848,9 @@ class FamilyView:
] ]
for msg,callback in entries: for msg,callback in entries:
Utils.add_menuitem(menu,msg,family,callback) Utils.add_menuitem(menu,msg,family,callback)
menu.popup(None,None,None,0,0) menu.popup(None,None,None,event.button,event.time)
def build_sp_parents_menu(self,family): def build_sp_parents_menu(self,family,event):
"""Builds the menu that allows editing operations on the child list""" """Builds the menu that allows editing operations on the child list"""
menu = gtk.Menu() menu = gtk.Menu()
menu.set_title(_('Spouse Parents Menu')) menu.set_title(_('Spouse Parents Menu'))
@ -879,7 +879,7 @@ class FamilyView:
] ]
for msg,callback in entries: for msg,callback in entries:
Utils.add_menuitem(menu,msg,family,callback) Utils.add_menuitem(menu,msg,family,callback)
menu.popup(None,None,None,0,0) menu.popup(None,None,None,event.button,event.time)
def edit_ap_relationships(self,obj): def edit_ap_relationships(self,obj):
self.parent_editor(self.person,self.ap_selection) self.parent_editor(self.person,self.ap_selection)
@ -896,7 +896,7 @@ class FamilyView:
plist = self.person.getParentList() plist = self.person.getParentList()
if len(plist) == 0: if len(plist) == 0:
self.build_parents_nosel_menu() self.build_parents_nosel_menu(event)
return return
elif len(plist) == 1: elif len(plist) == 1:
family,m,r = plist[0] family,m,r = plist[0]
@ -904,19 +904,19 @@ class FamilyView:
model, iter = self.ap_selection.get_selected() model, iter = self.ap_selection.get_selected()
path = model.get_path(iter) path = model.get_path(iter)
family,m,r = plist[path[0]] family,m,r = plist[path[0]]
self.build_parents_menu(family) self.build_parents_menu(family,event)
def edit_sp_parents(self,obj,event): def edit_sp_parents(self,obj,event):
if self.selected_spouse == None: if self.selected_spouse == None:
if event.type == gtk.gdk.BUTTON_PRESS and event.button == 3: if event.type == gtk.gdk.BUTTON_PRESS and event.button == 3:
self.build_nav_menu() self.build_nav_menu(event)
return return
if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1: if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1:
self.parent_editor(self.selected_spouse,self.sp_selection) self.parent_editor(self.selected_spouse,self.sp_selection)
elif event.type == gtk.gdk.BUTTON_PRESS and event.button == 3: elif event.type == gtk.gdk.BUTTON_PRESS and event.button == 3:
plist = self.selected_spouse.getParentList() plist = self.selected_spouse.getParentList()
if len(plist) == 0: if len(plist) == 0:
self.build_sp_parents_nosel_menu() self.build_sp_parents_nosel_menu(event)
return return
elif len(plist) == 1: elif len(plist) == 1:
family,m,r = plist[0] family,m,r = plist[0]
@ -924,7 +924,7 @@ class FamilyView:
model, iter = self.sp_selection.get_selected() model, iter = self.sp_selection.get_selected()
path = model.get_path(iter) path = model.get_path(iter)
family,m,r = plist[path[0]] family,m,r = plist[path[0]]
self.build_sp_parents_menu(family) self.build_sp_parents_menu(family,event)
def add_parents_clicked(self,obj): def add_parents_clicked(self,obj):
self.parent_add(self.person) self.parent_add(self.person)

View File

@ -18,6 +18,8 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# #
# $Id$
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# Standard python modules # Standard python modules
@ -316,7 +318,7 @@ class Gallery(ImageSelect):
item = widget.get_item_at(event.x,event.y) item = widget.get_item_at(event.x,event.y)
if item: if item:
(i,t,b,self.photo,oid) = self.p_map[item] (i,t,b,self.photo,oid) = self.p_map[item]
self.show_popup(self.photo) self.show_popup(self.photo,event)
self.in_event = 0 self.in_event = 0
return gtk.TRUE return gtk.TRUE
elif event.type == gtk.gdk.BUTTON_RELEASE: elif event.type == gtk.gdk.BUTTON_RELEASE:
@ -562,7 +564,7 @@ class Gallery(ImageSelect):
(i,t,b,photo,oid) = self.p_map[self.sel] (i,t,b,photo,oid) = self.p_map[self.sel]
LocalMediaProperties(photo,self.path,self) LocalMediaProperties(photo,self.path,self)
def show_popup(self, photo): def show_popup(self, photo, event):
"""Look for right-clicks on a picture and create a popup """Look for right-clicks on a picture and create a popup
menu of the available actions.""" menu of the available actions."""
@ -582,7 +584,7 @@ class Gallery(ImageSelect):
if object.getLocal() == 0: if object.getLocal() == 0:
Utils.add_menuitem(menu,_("Convert to local copy"),photo, Utils.add_menuitem(menu,_("Convert to local copy"),photo,
self.popup_convert_to_private) self.popup_convert_to_private)
menu.popup(None,None,None,0,0) menu.popup(None,None,None,event.button,event.time)
def popup_view_photo(self, obj): def popup_view_photo(self, obj):
"""Open this picture in a picture viewer""" """Open this picture in a picture viewer"""

View File

@ -18,6 +18,8 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# #
# $Id$
_PAD = 3 _PAD = 3
_CANVASPAD = 3 _CANVASPAD = 3
_PERSON = "p" _PERSON = "p"
@ -427,9 +429,9 @@ class PedigreeView:
def on_canvas_press(self,obj,event): def on_canvas_press(self,obj,event):
if event.type == gtk.gdk.BUTTON_PRESS and event.button == 3: if event.type == gtk.gdk.BUTTON_PRESS and event.button == 3:
self.build_nav_menu() self.build_nav_menu(event)
def build_nav_menu(self): def build_nav_menu(self,event):
"""Builds the menu with navigation.""" """Builds the menu with navigation."""
back_sensitivity = self.parent.hindex > 0 back_sensitivity = self.parent.hindex > 0
@ -448,4 +450,4 @@ class PedigreeView:
item.set_sensitive(sensitivity) item.set_sensitive(sensitivity)
item.show() item.show()
menu.append(item) menu.append(item)
menu.popup(None,None,None,0,0) menu.popup(None,None,None,event.button,event.time)

View File

@ -19,6 +19,8 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# #
# $Id$
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# internationalization # internationalization
@ -353,9 +355,9 @@ class PeopleView:
def on_plist_button_press(self,obj,event): def on_plist_button_press(self,obj,event):
if event.type == gtk.gdk.BUTTON_PRESS and event.button == 3: if event.type == gtk.gdk.BUTTON_PRESS and event.button == 3:
self.build_people_context_menu() self.build_people_context_menu(event)
def build_people_context_menu(self): def build_people_context_menu(self,event):
"""Builds the menu with navigation and """Builds the menu with navigation and
editing operations on the people's list""" editing operations on the people's list"""
@ -386,7 +388,7 @@ class PeopleView:
item.set_sensitive(sensitivity) item.set_sensitive(sensitivity)
item.show() item.show()
menu.append(item) menu.append(item)
menu.popup(None,None,None,0,0) menu.popup(None,None,None,event.button,event.time)
def redisplay_person_list(self,person): def redisplay_person_list(self,person):
self.add_to_person_list(person,1) self.add_to_person_list(person,1)

View File

@ -156,11 +156,11 @@ class PlaceView:
EditPlace.EditPlace(self,mlist[0],self.update_display) EditPlace.EditPlace(self,mlist[0],self.update_display)
return 1 return 1
elif event.type == gtk.gdk.BUTTON_PRESS and event.button == 3: elif event.type == gtk.gdk.BUTTON_PRESS and event.button == 3:
self.build_context_menu() self.build_context_menu(event)
return 1 return 1
return 0 return 0
def build_context_menu(self): def build_context_menu(self,event):
"""Builds the menu with editing operations on the place's list""" """Builds the menu with editing operations on the place's list"""
mlist = [] mlist = []
@ -184,7 +184,7 @@ class PlaceView:
item.set_sensitive(sensitivity) item.set_sensitive(sensitivity)
item.show() item.show()
menu.append(item) menu.append(item)
menu.popup(None,None,None,0,0) menu.popup(None,None,None,event.button,event.time)
def new_place_after_edit(self,place): def new_place_after_edit(self,place):
#self.db.addPlace(place) #self.db.addPlace(place)

View File

@ -123,11 +123,11 @@ class SourceView:
EditSource.EditSource(source,self.db,self.topWindow,self.update_display) EditSource.EditSource(source,self.db,self.topWindow,self.update_display)
return 1 return 1
elif event.type == gtk.gdk.BUTTON_PRESS and event.button == 3: elif event.type == gtk.gdk.BUTTON_PRESS and event.button == 3:
self.build_context_menu() self.build_context_menu(event)
return 1 return 1
return 0 return 0
def build_context_menu(self): def build_context_menu(self,event):
"""Builds the menu with editing operations on the source's list""" """Builds the menu with editing operations on the source's list"""
store,iter = self.selection.get_selected() store,iter = self.selection.get_selected()
@ -150,7 +150,7 @@ class SourceView:
item.set_sensitive(sensitivity) item.set_sensitive(sensitivity)
item.show() item.show()
menu.append(item) menu.append(item)
menu.popup(None,None,None,0,0) menu.popup(None,None,None,event.button,event.time)
def on_add_clicked(self,obj): def on_add_clicked(self,obj):
EditSource.EditSource(RelLib.Source(),self.db,self.topWindow,self.new_after_edit) EditSource.EditSource(RelLib.Source(),self.db,self.topWindow,self.new_after_edit)

View File

@ -19,6 +19,8 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# #
# $Id$
# #
# Written by Alex Roitman, # Written by Alex Roitman,
# largely based on the BaseDoc classes by Don Allingham # largely based on the BaseDoc classes by Don Allingham
@ -782,7 +784,7 @@ class BookReportSelector:
if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1: if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1:
self.on_setup_clicked(obj) self.on_setup_clicked(obj)
elif event.type == gtk.gdk.BUTTON_PRESS and event.button == 3: elif event.type == gtk.gdk.BUTTON_PRESS and event.button == 3:
self.build_bk_context_menu() self.build_bk_context_menu(event)
def av_button_press(self,obj,event): def av_button_press(self,obj,event):
""" """
@ -792,9 +794,9 @@ class BookReportSelector:
if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1: if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1:
self.on_add_clicked(obj) self.on_add_clicked(obj)
elif event.type == gtk.gdk.BUTTON_PRESS and event.button == 3: elif event.type == gtk.gdk.BUTTON_PRESS and event.button == 3:
self.build_av_context_menu() self.build_av_context_menu(event)
def build_bk_context_menu(self): def build_bk_context_menu(self,event):
"""Builds the menu with item-centered and book-centered options.""" """Builds the menu with item-centered and book-centered options."""
store,iter = self.bk_model.get_selected() store,iter = self.bk_model.get_selected()
@ -823,9 +825,9 @@ class BookReportSelector:
item.set_sensitive(sensitivity) item.set_sensitive(sensitivity)
item.show() item.show()
menu.append(item) menu.append(item)
menu.popup(None,None,None,0,0) menu.popup(None,None,None,event.button,event.time)
def build_av_context_menu(self): def build_av_context_menu(self,event):
"""Builds the menu with the single Add option.""" """Builds the menu with the single Add option."""
store,iter = self.av_model.get_selected() store,iter = self.av_model.get_selected()
@ -846,7 +848,7 @@ class BookReportSelector:
item.set_sensitive(sensitivity) item.set_sensitive(sensitivity)
item.show() item.show()
menu.append(item) menu.append(item)
menu.popup(None,None,None,0,0) menu.popup(None,None,None,event.button,event.time)
def on_book_ok_clicked(self,obj): def on_book_ok_clicked(self,obj):
""" """