geography: bug8450: Attempting to add a bookmark causes an error.

This commit is contained in:
SNoiraud 2015-03-19 19:32:34 +01:00
parent cf264e8d89
commit 36c03a0a53
6 changed files with 20 additions and 7 deletions

View File

@ -191,6 +191,19 @@ class GeoGraphyView(OsmGps, NavigationView):
_("Could Not Set a Bookmark"), _("Could Not Set a Bookmark"),
_("A bookmark could not be set because " _("A bookmark could not be set because "
"no one was selected.")) "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): def change_page(self):
""" """

View File

@ -232,7 +232,7 @@ class GeoClose(GeoGraphyView):
self._createmap(self.refperson, color, self.place_list_ref, True) self._createmap(self.refperson, color, self.place_list_ref, True)
if self.refperson_bookmark is None: if self.refperson_bookmark is None:
self.refperson_bookmark = self.refperson.get_handle() self.refperson_bookmark = self.refperson.get_handle()
self.add_bookmark(None, self.refperson_bookmark) self.add_bookmark_from_popup(None, self.refperson_bookmark)
else: else:
self.message_layer.add_message(_("You must choose one reference person.")) self.message_layer.add_message(_("You must choose one reference person."))
self.message_layer.add_message(_("Go to the person view and select " self.message_layer.add_message(_("Go to the person view and select "

View File

@ -335,7 +335,7 @@ class GeoEvents(GeoGraphyView):
hdle = evt.get_handle() hdle = evt.get_handle()
bookm = Gtk.MenuItem(label=_("Bookmark this event")) bookm = Gtk.MenuItem(label=_("Bookmark this event"))
bookm.show() bookm.show()
bookm.connect("activate", self.add_bookmark, hdle) bookm.connect("activate", self.add_bookmark_from_popup, hdle)
itemoption.append(bookm) itemoption.append(bookm)
if mark[0] != oldplace: if mark[0] != oldplace:
message = "%s :" % mark[0] message = "%s :" % mark[0]
@ -367,7 +367,7 @@ class GeoEvents(GeoGraphyView):
hdle = evt.get_handle() hdle = evt.get_handle()
bookm = Gtk.MenuItem(label=_("Bookmark this event")) bookm = Gtk.MenuItem(label=_("Bookmark this event"))
bookm.show() bookm.show()
bookm.connect("activate", self.add_bookmark, hdle) bookm.connect("activate", self.add_bookmark_from_popup, hdle)
itemoption.append(bookm) itemoption.append(bookm)
menu.popup(None, None, menu.popup(None, None,
lambda menu, data: (event.get_root_coords()[0], lambda menu, data: (event.get_root_coords()[0],

View File

@ -255,7 +255,7 @@ class GeoFamClose(GeoGraphyView):
self.message_layer.add_message(_("The other family : %s" % _("Unknown"))) self.message_layer.add_message(_("The other family : %s" % _("Unknown")))
if self.reffamily_bookmark is None: if self.reffamily_bookmark is None:
self.reffamily_bookmark = self.reffamily.get_handle() self.reffamily_bookmark = self.reffamily.get_handle()
self.add_bookmark(None, self.reffamily_bookmark) self.add_bookmark_from_popup(None, self.reffamily_bookmark)
else: else:
self.message_layer.add_message(_("You must choose one reference family.")) self.message_layer.add_message(_("You must choose one reference family."))
self.message_layer.add_message(_("Go to the family view and select " self.message_layer.add_message(_("Go to the family view and select "

View File

@ -607,7 +607,7 @@ class GeoMoves(GeoGraphyView):
hdle = person.get_handle() hdle = person.get_handle()
bookm = Gtk.MenuItem(label=_("Bookmark this person")) bookm = Gtk.MenuItem(label=_("Bookmark this person"))
bookm.show() bookm.show()
bookm.connect("activate", self.add_bookmark, hdle) bookm.connect("activate", self.add_bookmark_from_popup, hdle)
itemoption.append(bookm) itemoption.append(bookm)
menu.show() menu.show()
menu.popup(None, None, menu.popup(None, None,

View File

@ -333,7 +333,7 @@ class GeoPlaces(GeoGraphyView):
hdle = place.get_handle() hdle = place.get_handle()
bookm = Gtk.MenuItem(label=_("Bookmark this place")) bookm = Gtk.MenuItem(label=_("Bookmark this place"))
bookm.show() bookm.show()
bookm.connect("activate", self.add_bookmark, hdle) bookm.connect("activate", self.add_bookmark_from_popup, hdle)
itemoption.append(bookm) itemoption.append(bookm)
message = "%s" % mark[0] message = "%s" % mark[0]
prevmark = mark prevmark = mark
@ -357,7 +357,7 @@ class GeoPlaces(GeoGraphyView):
hdle = place.get_handle() hdle = place.get_handle()
bookm = Gtk.MenuItem(label=_("Bookmark this place")) bookm = Gtk.MenuItem(label=_("Bookmark this place"))
bookm.show() bookm.show()
bookm.connect("activate", self.add_bookmark, hdle) bookm.connect("activate", self.add_bookmark_from_popup, hdle)
itemoption.append(bookm) itemoption.append(bookm)
menu.popup(None, None, menu.popup(None, None,
lambda menu, data: (event.get_root_coords()[0], lambda menu, data: (event.get_root_coords()[0],