From 73fcaec4400761f5441f1077954ce6bf7b488d20 Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Mon, 20 Oct 2003 02:47:03 +0000 Subject: [PATCH] * 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 --- gramps2/ChangeLog | 10 ++++++ gramps2/src/EditPerson.py | 4 ++- gramps2/src/FamilyView.py | 54 +++++++++++++++---------------- gramps2/src/ImageSelect.py | 8 +++-- gramps2/src/PedView.py | 8 +++-- gramps2/src/PeopleView.py | 8 +++-- gramps2/src/PlaceView.py | 6 ++-- gramps2/src/SourceView.py | 6 ++-- gramps2/src/plugins/BookReport.py | 14 ++++---- 9 files changed, 69 insertions(+), 49 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 8e7608001..d8d3c68c8 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,13 @@ +2003-10-19 Alex Roitman + * 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 * src/SourceView.py: Enable popup menu on right-click. * src/PlaceView.py: Likewise. diff --git a/gramps2/src/EditPerson.py b/gramps2/src/EditPerson.py index c55081b83..c4bc40efd 100644 --- a/gramps2/src/EditPerson.py +++ b/gramps2/src/EditPerson.py @@ -18,6 +18,8 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# $Id$ + #------------------------------------------------------------------------- # # Standard python modules @@ -1225,7 +1227,7 @@ class EditPerson: menu.append(item) msg = _("Make the selected name the preferred 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): import NameEdit diff --git a/gramps2/src/FamilyView.py b/gramps2/src/FamilyView.py index 12674468c..601ad0f7f 100644 --- a/gramps2/src/FamilyView.py +++ b/gramps2/src/FamilyView.py @@ -199,9 +199,9 @@ class FamilyView: if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1: self.parent.load_person(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""" back_sensitivity = self.parent.hindex > 0 @@ -221,9 +221,9 @@ class FamilyView: item.set_sensitive(sensitivity) item.show() 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)""" back_sensitivity = self.parent.hindex > 0 @@ -242,9 +242,9 @@ class FamilyView: item.set_sensitive(sensitivity) item.show() 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""" back_sensitivity = self.parent.hindex > 0 @@ -265,9 +265,9 @@ class FamilyView: item.set_sensitive(sensitivity) item.show() 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""" back_sensitivity = self.parent.hindex > 0 @@ -288,21 +288,21 @@ class FamilyView: item.set_sensitive(sensitivity) item.show() 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): model, iter = self.child_selection.get_selected() if not iter: if event.type == gtk.gdk.BUTTON_PRESS and event.button == 3: - self.build_nav_menu() + self.build_nav_menu(event) return id = self.child_model.get_value(iter,2) if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1: self.parent.load_person(self.parent.db.getPerson(id)) 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""" menu = gtk.Menu() @@ -332,7 +332,7 @@ class FamilyView: ] for msg,callback in entries: 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): model, iter = self.child_selection.get_selected() @@ -356,7 +356,7 @@ class FamilyView: row = model.get_path(iter) self.display_marriage(self.person.getFamilyList()[row[0]]) - def build_spouse_menu(self): + def build_spouse_menu(self,event): menu = gtk.Menu() menu.set_title(_('Spouse Menu')) @@ -385,8 +385,8 @@ class FamilyView: (_("Set the selected spouse as the preferred spouse"), self.set_preferred_spouse), ] for msg,callback in entries: - Utils.add_menuitem(menu,msg,id,callback) - menu.popup(None,None,None,0,0) + Utils.add_menuitem(menu,msg,None,callback) + menu.popup(None,None,None,event.button,event.time) def set_preferred_spouse(self,obj): if self.selected_spouse: @@ -413,9 +413,9 @@ class FamilyView: elif event.type == gtk.gdk.BUTTON_PRESS and event.button == 3: if self.selected_spouse: - self.build_spouse_menu() + self.build_spouse_menu(event) else: - self.build_nav_menu() + self.build_nav_menu(event) elif event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1: if self.person: try: @@ -819,7 +819,7 @@ class FamilyView: 5,status, 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""" menu = gtk.Menu() menu.set_title(_('Parents Menu')) @@ -848,9 +848,9 @@ class FamilyView: ] for msg,callback in entries: 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""" menu = gtk.Menu() menu.set_title(_('Spouse Parents Menu')) @@ -879,7 +879,7 @@ class FamilyView: ] for msg,callback in entries: 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): self.parent_editor(self.person,self.ap_selection) @@ -896,7 +896,7 @@ class FamilyView: plist = self.person.getParentList() if len(plist) == 0: - self.build_parents_nosel_menu() + self.build_parents_nosel_menu(event) return elif len(plist) == 1: family,m,r = plist[0] @@ -904,19 +904,19 @@ class FamilyView: model, iter = self.ap_selection.get_selected() path = model.get_path(iter) family,m,r = plist[path[0]] - self.build_parents_menu(family) + self.build_parents_menu(family,event) def edit_sp_parents(self,obj,event): if self.selected_spouse == None: if event.type == gtk.gdk.BUTTON_PRESS and event.button == 3: - self.build_nav_menu() + self.build_nav_menu(event) return if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1: self.parent_editor(self.selected_spouse,self.sp_selection) elif event.type == gtk.gdk.BUTTON_PRESS and event.button == 3: plist = self.selected_spouse.getParentList() if len(plist) == 0: - self.build_sp_parents_nosel_menu() + self.build_sp_parents_nosel_menu(event) return elif len(plist) == 1: family,m,r = plist[0] @@ -924,7 +924,7 @@ class FamilyView: model, iter = self.sp_selection.get_selected() path = model.get_path(iter) 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): self.parent_add(self.person) diff --git a/gramps2/src/ImageSelect.py b/gramps2/src/ImageSelect.py index 653a29089..586b44d81 100644 --- a/gramps2/src/ImageSelect.py +++ b/gramps2/src/ImageSelect.py @@ -18,6 +18,8 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# $Id$ + #------------------------------------------------------------------------- # # Standard python modules @@ -316,7 +318,7 @@ class Gallery(ImageSelect): item = widget.get_item_at(event.x,event.y) if 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 return gtk.TRUE elif event.type == gtk.gdk.BUTTON_RELEASE: @@ -562,7 +564,7 @@ class Gallery(ImageSelect): (i,t,b,photo,oid) = self.p_map[self.sel] 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 menu of the available actions.""" @@ -582,7 +584,7 @@ class Gallery(ImageSelect): if object.getLocal() == 0: Utils.add_menuitem(menu,_("Convert to local copy"),photo, 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): """Open this picture in a picture viewer""" diff --git a/gramps2/src/PedView.py b/gramps2/src/PedView.py index 0afcf2e9b..44e0ec578 100644 --- a/gramps2/src/PedView.py +++ b/gramps2/src/PedView.py @@ -18,6 +18,8 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# $Id$ + _PAD = 3 _CANVASPAD = 3 _PERSON = "p" @@ -427,9 +429,9 @@ class PedigreeView: def on_canvas_press(self,obj,event): 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.""" back_sensitivity = self.parent.hindex > 0 @@ -448,4 +450,4 @@ class PedigreeView: item.set_sensitive(sensitivity) item.show() menu.append(item) - menu.popup(None,None,None,0,0) + menu.popup(None,None,None,event.button,event.time) diff --git a/gramps2/src/PeopleView.py b/gramps2/src/PeopleView.py index 29156618d..ef5ecc7cf 100644 --- a/gramps2/src/PeopleView.py +++ b/gramps2/src/PeopleView.py @@ -19,6 +19,8 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# $Id$ + #------------------------------------------------------------------------- # # internationalization @@ -353,9 +355,9 @@ class PeopleView: def on_plist_button_press(self,obj,event): 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 editing operations on the people's list""" @@ -386,7 +388,7 @@ class PeopleView: item.set_sensitive(sensitivity) item.show() 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): self.add_to_person_list(person,1) diff --git a/gramps2/src/PlaceView.py b/gramps2/src/PlaceView.py index 95ffaa6eb..8e7abcadd 100644 --- a/gramps2/src/PlaceView.py +++ b/gramps2/src/PlaceView.py @@ -156,11 +156,11 @@ class PlaceView: EditPlace.EditPlace(self,mlist[0],self.update_display) return 1 elif event.type == gtk.gdk.BUTTON_PRESS and event.button == 3: - self.build_context_menu() + self.build_context_menu(event) return 1 return 0 - def build_context_menu(self): + def build_context_menu(self,event): """Builds the menu with editing operations on the place's list""" mlist = [] @@ -184,7 +184,7 @@ class PlaceView: item.set_sensitive(sensitivity) item.show() 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): #self.db.addPlace(place) diff --git a/gramps2/src/SourceView.py b/gramps2/src/SourceView.py index 956884783..a9ef0ea82 100644 --- a/gramps2/src/SourceView.py +++ b/gramps2/src/SourceView.py @@ -123,11 +123,11 @@ class SourceView: EditSource.EditSource(source,self.db,self.topWindow,self.update_display) return 1 elif event.type == gtk.gdk.BUTTON_PRESS and event.button == 3: - self.build_context_menu() + self.build_context_menu(event) return 1 return 0 - def build_context_menu(self): + def build_context_menu(self,event): """Builds the menu with editing operations on the source's list""" store,iter = self.selection.get_selected() @@ -150,7 +150,7 @@ class SourceView: item.set_sensitive(sensitivity) item.show() 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): EditSource.EditSource(RelLib.Source(),self.db,self.topWindow,self.new_after_edit) diff --git a/gramps2/src/plugins/BookReport.py b/gramps2/src/plugins/BookReport.py index 794e2cb23..192359cbd 100644 --- a/gramps2/src/plugins/BookReport.py +++ b/gramps2/src/plugins/BookReport.py @@ -19,6 +19,8 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# $Id$ + # # Written by Alex Roitman, # 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: self.on_setup_clicked(obj) 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): """ @@ -792,9 +794,9 @@ class BookReportSelector: if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1: self.on_add_clicked(obj) 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.""" store,iter = self.bk_model.get_selected() @@ -823,9 +825,9 @@ class BookReportSelector: item.set_sensitive(sensitivity) item.show() 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.""" store,iter = self.av_model.get_selected() @@ -846,7 +848,7 @@ class BookReportSelector: item.set_sensitive(sensitivity) item.show() 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): """