geography: bug8450: Attempting to add a bookmark causes an error.
This commit is contained in:
parent
cf264e8d89
commit
36c03a0a53
@ -192,6 +192,19 @@ class GeoGraphyView(OsmGps, NavigationView):
|
||||
_("A bookmark could not be set because "
|
||||
"no one was selected."))
|
||||
|
||||
|
||||
def add_bookmark_from_popup(self, menu, handle):
|
||||
if handle:
|
||||
self.uistate.set_active(handle, self.navigation_type())
|
||||
self.bookmarks.add(handle)
|
||||
self.bookmarks.redraw()
|
||||
else:
|
||||
from gramps.gui.dialog import WarningDialog
|
||||
WarningDialog(
|
||||
_("Could Not Set a Bookmark"),
|
||||
_("A bookmark could not be set because "
|
||||
"no one was selected."))
|
||||
|
||||
def change_page(self):
|
||||
"""
|
||||
Called when the page changes.
|
||||
|
@ -232,7 +232,7 @@ class GeoClose(GeoGraphyView):
|
||||
self._createmap(self.refperson, color, self.place_list_ref, True)
|
||||
if self.refperson_bookmark is None:
|
||||
self.refperson_bookmark = self.refperson.get_handle()
|
||||
self.add_bookmark(None, self.refperson_bookmark)
|
||||
self.add_bookmark_from_popup(None, self.refperson_bookmark)
|
||||
else:
|
||||
self.message_layer.add_message(_("You must choose one reference person."))
|
||||
self.message_layer.add_message(_("Go to the person view and select "
|
||||
|
@ -335,7 +335,7 @@ class GeoEvents(GeoGraphyView):
|
||||
hdle = evt.get_handle()
|
||||
bookm = Gtk.MenuItem(label=_("Bookmark this event"))
|
||||
bookm.show()
|
||||
bookm.connect("activate", self.add_bookmark, hdle)
|
||||
bookm.connect("activate", self.add_bookmark_from_popup, hdle)
|
||||
itemoption.append(bookm)
|
||||
if mark[0] != oldplace:
|
||||
message = "%s :" % mark[0]
|
||||
@ -367,7 +367,7 @@ class GeoEvents(GeoGraphyView):
|
||||
hdle = evt.get_handle()
|
||||
bookm = Gtk.MenuItem(label=_("Bookmark this event"))
|
||||
bookm.show()
|
||||
bookm.connect("activate", self.add_bookmark, hdle)
|
||||
bookm.connect("activate", self.add_bookmark_from_popup, hdle)
|
||||
itemoption.append(bookm)
|
||||
menu.popup(None, None,
|
||||
lambda menu, data: (event.get_root_coords()[0],
|
||||
|
@ -255,7 +255,7 @@ class GeoFamClose(GeoGraphyView):
|
||||
self.message_layer.add_message(_("The other family : %s" % _("Unknown")))
|
||||
if self.reffamily_bookmark is None:
|
||||
self.reffamily_bookmark = self.reffamily.get_handle()
|
||||
self.add_bookmark(None, self.reffamily_bookmark)
|
||||
self.add_bookmark_from_popup(None, self.reffamily_bookmark)
|
||||
else:
|
||||
self.message_layer.add_message(_("You must choose one reference family."))
|
||||
self.message_layer.add_message(_("Go to the family view and select "
|
||||
|
@ -607,7 +607,7 @@ class GeoMoves(GeoGraphyView):
|
||||
hdle = person.get_handle()
|
||||
bookm = Gtk.MenuItem(label=_("Bookmark this person"))
|
||||
bookm.show()
|
||||
bookm.connect("activate", self.add_bookmark, hdle)
|
||||
bookm.connect("activate", self.add_bookmark_from_popup, hdle)
|
||||
itemoption.append(bookm)
|
||||
menu.show()
|
||||
menu.popup(None, None,
|
||||
|
@ -333,7 +333,7 @@ class GeoPlaces(GeoGraphyView):
|
||||
hdle = place.get_handle()
|
||||
bookm = Gtk.MenuItem(label=_("Bookmark this place"))
|
||||
bookm.show()
|
||||
bookm.connect("activate", self.add_bookmark, hdle)
|
||||
bookm.connect("activate", self.add_bookmark_from_popup, hdle)
|
||||
itemoption.append(bookm)
|
||||
message = "%s" % mark[0]
|
||||
prevmark = mark
|
||||
@ -357,7 +357,7 @@ class GeoPlaces(GeoGraphyView):
|
||||
hdle = place.get_handle()
|
||||
bookm = Gtk.MenuItem(label=_("Bookmark this place"))
|
||||
bookm.show()
|
||||
bookm.connect("activate", self.add_bookmark, hdle)
|
||||
bookm.connect("activate", self.add_bookmark_from_popup, hdle)
|
||||
itemoption.append(bookm)
|
||||
menu.popup(None, None,
|
||||
lambda menu, data: (event.get_root_coords()[0],
|
||||
|
Loading…
Reference in New Issue
Block a user