From 2972b0d9c0071e046ae09f39dc0f68775189f621 Mon Sep 17 00:00:00 2001 From: noirauds Date: Wed, 27 Nov 2013 21:21:58 +0100 Subject: [PATCH] Geography : bug7240 : create a bookmark via GeoEvents leads to an empty link --- gramps/plugins/view/geoclose.py | 11 +++++++++++ gramps/plugins/view/geoevents.py | 18 ++++++++++++++++-- gramps/plugins/view/geofamclose.py | 11 +++++++++++ gramps/plugins/view/geofamily.py | 12 ++++++++++++ gramps/plugins/view/geomoves.py | 11 +++++++++++ gramps/plugins/view/geoperson.py | 11 +++++++++++ gramps/plugins/view/geoplaces.py | 11 +++++++++++ 7 files changed, 83 insertions(+), 2 deletions(-) diff --git a/gramps/plugins/view/geoclose.py b/gramps/plugins/view/geoclose.py index 32b8c0c9a..99ab6b9ff 100644 --- a/gramps/plugins/view/geoclose.py +++ b/gramps/plugins/view/geoclose.py @@ -196,6 +196,17 @@ class GeoClose(GeoGraphyView): """ return 'Person' + def add_bookmark(self, obj): + mlist = self.selected_handles() + if mlist: + self.bookmarks.add(mlist[0]) + 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 goto_handle(self, handle=None): """ Rebuild the tree with the given person handle as the root. diff --git a/gramps/plugins/view/geoevents.py b/gramps/plugins/view/geoevents.py index 30a608eee..f607f46f6 100644 --- a/gramps/plugins/view/geoevents.py +++ b/gramps/plugins/view/geoevents.py @@ -168,6 +168,17 @@ class GeoEvents(GeoGraphyView): """ return 'Event' + def add_bookmark(self, obj): + mlist = self.selected_handles() + if mlist: + self.bookmarks.add(mlist[0]) + 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 goto_handle(self, handle=None): """ Rebuild the tree with the given events handle as the root. @@ -202,8 +213,11 @@ class GeoEvents(GeoGraphyView): if self.nbplaces >= self._config.get("geography.max_places"): return descr = descr2 = "" - place_handle = event.get_place_handle() - eventyear = event.get_date_object().to_calendar(self.cal).get_year() + if event: + place_handle = event.get_place_handle() + eventyear = event.get_date_object().to_calendar(self.cal).get_year() + else: + place_handle = None if place_handle: place = dbstate.db.get_place_from_handle(place_handle) if place: diff --git a/gramps/plugins/view/geofamclose.py b/gramps/plugins/view/geofamclose.py index e36db37b5..e0d2971f3 100644 --- a/gramps/plugins/view/geofamclose.py +++ b/gramps/plugins/view/geofamclose.py @@ -194,6 +194,17 @@ class GeoFamClose(GeoGraphyView): """ return 'Family' + def add_bookmark(self, obj): + mlist = self.selected_handles() + if mlist: + self.bookmarks.add(mlist[0]) + 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 family_label(self,family): if family is None: return "Unknown" diff --git a/gramps/plugins/view/geofamily.py b/gramps/plugins/view/geofamily.py index 22dc7a2dc..6619dddfd 100644 --- a/gramps/plugins/view/geofamily.py +++ b/gramps/plugins/view/geofamily.py @@ -167,6 +167,18 @@ class GeoFamily(GeoGraphyView): """ return 'Family' + def add_bookmark(self, obj): + mlist = self.selected_handles() + print mlist + if mlist: + self.bookmarks.add(mlist[0]) + 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 goto_handle(self, handle=None): """ Rebuild the tree with the given person handle as the root. diff --git a/gramps/plugins/view/geomoves.py b/gramps/plugins/view/geomoves.py index 696409a22..7f7dbf762 100644 --- a/gramps/plugins/view/geomoves.py +++ b/gramps/plugins/view/geomoves.py @@ -198,6 +198,17 @@ class GeoMoves(GeoGraphyView): """ return 'Person' + def add_bookmark(self, obj): + mlist = self.selected_handles() + if mlist: + self.bookmarks.add(mlist[0]) + 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 goto_handle(self, handle=None): """ Rebuild the tree with the given family handle as reference. diff --git a/gramps/plugins/view/geoperson.py b/gramps/plugins/view/geoperson.py index e8a3c030e..ef995e33d 100644 --- a/gramps/plugins/view/geoperson.py +++ b/gramps/plugins/view/geoperson.py @@ -197,6 +197,17 @@ class GeoPerson(GeoGraphyView): """ return 'Person' + def add_bookmark(self, obj): + mlist = self.selected_handles() + if mlist: + self.bookmarks.add(mlist[0]) + 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 goto_handle(self, handle=None): """ Rebuild the tree with the given person handle as the root. diff --git a/gramps/plugins/view/geoplaces.py b/gramps/plugins/view/geoplaces.py index cf5af4f85..1df4eeb50 100644 --- a/gramps/plugins/view/geoplaces.py +++ b/gramps/plugins/view/geoplaces.py @@ -168,6 +168,17 @@ class GeoPlaces(GeoGraphyView): """ return 'Place' + def add_bookmark(self, obj): + mlist = self.selected_handles() + if mlist: + self.bookmarks.add(mlist[0]) + 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 goto_handle(self, handle=None): """ Rebuild the tree with the given places handle as the root.