Geography : bug7240 : create a bookmark via GeoEvents leads to an empty link

This commit is contained in:
noirauds 2013-11-27 21:21:58 +01:00
parent 33c9e7e043
commit 2972b0d9c0
7 changed files with 83 additions and 2 deletions

View File

@ -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.

View File

@ -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:

View File

@ -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"

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.