Geography : Add ID property to some new sources.

Add a new layer which permit to display messages over the map
            Modify plugins to use this new functionality
            Remove the person's name in geoclose and geofamclose.


svn: r19851
This commit is contained in:
Serge Noiraud
2012-06-16 17:50:24 +00:00
parent 4ae2c9610c
commit df06be53df
16 changed files with 294 additions and 49 deletions

View File

@@ -20,7 +20,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id: geoperson.py 18338 2011-10-16 20:21:22Z paul-franklin $
# $Id$
"""
Geography for two persons
@@ -204,15 +204,23 @@ class GeoClose(GeoGraphyView):
self.remove_all_gps()
self.remove_all_markers()
self.lifeway_layer.clear_ways()
if self.refperson:
color = self._config.get('geography.color1')
self._createmap(self.refperson, color, self.place_list_ref, True)
self.message_layer.clear_messages()
active = self.get_active()
if active:
p1 = self.dbstate.db.get_person_from_handle(active)
self.change_active(active)
color = self._config.get('geography.color2')
self._createmap(p1, color, self.place_list_active, False)
if self.refperson:
color = self._config.get('geography.color1')
self.message_layer.add_message(_("Reference : %s" % _nd.display(self.refperson)))
self.message_layer.add_message(_("The other : %s" % _nd.display(p1)))
self._createmap(self.refperson, color, self.place_list_ref, True)
else:
self.message_layer.add_message(_("You must choose one reference person."))
self.message_layer.add_message(_("Go to the person view and select "
"the people you want to compare. "
"Return to this view and use the history."))
self.possible_meeting(self.place_list_ref, self.place_list_active)
self.uistate.modify_statusbar(self.dbstate)
@@ -273,8 +281,6 @@ class GeoClose(GeoGraphyView):
if reference:
self.lifeway_layer.add_way_ref(points, color,
float(self._config.get("geography.maximum_meeting_zone")) / 10)
if mark:
self.lifeway_layer.add_text(points, mark[1])
return False
def possible_meeting(self, place_list_ref, place_list_active):

View File

@@ -20,7 +20,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id:$
# $Id$
"""
Geography for two families
@@ -191,6 +191,36 @@ class GeoFamClose(GeoGraphyView):
"""
return self.dbstate.db.get_bookmarks()
def family_label(self,family):
if family is None:
return "Unknown"
f = self.dbstate.db.get_person_from_handle(
family.get_father_handle())
m = self.dbstate.db.get_person_from_handle(
family.get_mother_handle())
if f and m:
label = _("%(gramps_id)s : %(father)s and %(mother)s") % {
'father' : _nd.display(f),
'mother' : _nd.display(m),
'gramps_id' : family.gramps_id,
}
elif f:
label = "%(gramps_id)s : %(father)s" % {
'father' : _nd.display(f),
'gramps_id' : family.gramps_id,
}
elif m:
label = "%(gramps_id)s : %(mother)s" % {
'mother' : _nd.display(m),
'gramps_id' : family.gramps_id,
}
else:
# No translation for bare gramps_id
label = "%(gramps_id)s :" % {
'gramps_id' : family.gramps_id,
}
return label
def goto_handle(self, handle=None):
"""
Rebuild the tree with the given family handle as reference.
@@ -204,9 +234,7 @@ class GeoFamClose(GeoGraphyView):
self.remove_all_gps()
self.remove_all_markers()
self.lifeway_layer.clear_ways()
if self.reffamily:
color = self._config.get('geography.color1')
self._createmap(self.reffamily, color, self.place_list_ref, True)
self.message_layer.clear_messages()
active = self.get_active()
f1 = None
if active:
@@ -214,6 +242,16 @@ class GeoFamClose(GeoGraphyView):
self.change_active(active)
color = self._config.get('geography.color2')
self._createmap(f1, color, self.place_list_active, False)
if self.reffamily:
color = self._config.get('geography.color1')
self._createmap(self.reffamily, color, self.place_list_ref, True)
self.message_layer.add_message(_("Family reference : %s" % self.family_label(self.reffamily)))
self.message_layer.add_message(_("The other family : %s" % self.family_label(f1)))
else:
self.message_layer.add_message(_("You must choose one reference family."))
self.message_layer.add_message(_("Go to the family view and select "
"the families you want to compare. "
"Return to this view and use the history."))
if f1 is not None:
self._possible_family_meeting(self.reffamily, f1)
self.uistate.modify_statusbar(self.dbstate)
@@ -251,7 +289,6 @@ class GeoFamClose(GeoGraphyView):
"""
active = self.get_active()
family = self.dbstate.db.get_family_from_handle(active)
self.lifeway_layer.clear_ways()
self.goto_handle(handle=family)
def draw(self, menu, marks, color, reference):
@@ -273,8 +310,6 @@ class GeoFamClose(GeoGraphyView):
if reference:
self.lifeway_layer.add_way_ref(points, color,
float(self._config.get("geography.maximum_meeting_zone")) / 10)
if mark:
self.lifeway_layer.add_text(points, mark[1])
return False
def _place_list_for_person(self, person):

View File

@@ -272,11 +272,42 @@ class GeoFamily(GeoGraphyView):
else:
self._append_to_places_without_coord( place.gramps_id, descr)
def family_label(self,family):
if family is None:
return "Unknown"
f = self.dbstate.db.get_person_from_handle(
family.get_father_handle())
m = self.dbstate.db.get_person_from_handle(
family.get_mother_handle())
if f and m:
label = _("%(gramps_id)s : %(father)s and %(mother)s") % {
'father' : _nd.display(f),
'mother' : _nd.display(m),
'gramps_id' : family.gramps_id,
}
elif f:
label = "%(gramps_id)s : %(father)s" % {
'father' : _nd.display(f),
'gramps_id' : family.gramps_id,
}
elif m:
label = "%(gramps_id)s : %(mother)s" % {
'mother' : _nd.display(m),
'gramps_id' : family.gramps_id,
}
else:
# No translation for bare gramps_id
label = "%(gramps_id)s :" % {
'gramps_id' : family.gramps_id,
}
return label
def _createmap_for_one_family(self, family):
"""
Create all markers for one family : all event's places with a lat/lon.
"""
dbstate = self.dbstate
self.message_layer.add_message(_("Family places for %s" % self.family_label(family)))
try:
person = dbstate.db.get_person_from_handle(family.get_father_handle())
except:
@@ -337,6 +368,7 @@ class GeoFamily(GeoGraphyView):
self.minlat = self.maxlat = self.minlon = self.maxlon = 0.0
self.minyear = 9999
self.maxyear = 0
self.message_layer.clear_messages()
family = self.dbstate.db.get_family_from_handle(family_x)
if family is None:
person = self.dbstate.db.get_person_from_handle(self.uistate.get_active('Person'))

View File

@@ -20,7 +20,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id:$
# $Id$
"""
Geography for one person and all his descendant
@@ -235,6 +235,7 @@ class GeoMoves(GeoGraphyView):
self.remove_all_markers()
self.lifeway_layer.clear_ways()
self.date_layer.clear_dates()
self.message_layer.clear_messages()
def draw(self, menu, marks, color):
"""
@@ -459,12 +460,14 @@ class GeoMoves(GeoGraphyView):
self.minlat = self.maxlat = self.minlon = self.maxlon = 0.0
latitude = ""
longitude = ""
self.message_layer.clear_messages()
self.place_without_coordinates = []
self.minlat = self.maxlat = self.minlon = self.maxlon = 0.0
if person is None:
person = self.dbstate.db.get_person_from_handle(self.uistate.get_active('Person'))
if not person:
return
self.message_layer.add_message(_("All descendance for %s" % _nd.display(person)))
color = gtk.gdk.color_parse(self._config.get('geography.color_base'))
gobject.timeout_add(int(self._config.get("geography.generation_interval")),
self.animate_moves, 0, person, color)

View File

@@ -302,10 +302,12 @@ class GeoPerson(GeoGraphyView):
self.maxyear = 0
latitude = ""
longitude = ""
self.message_layer.clear_messages()
person_handle = self.uistate.get_active('Person')
person = dbstate.db.get_person_from_handle(person_handle)
if person is not None:
# For each event, if we have a place, set a marker.
self.message_layer.add_message(_("Person places for %s" % _nd.display(person)))
for event_ref in person.get_event_ref_list():
if not event_ref:
continue

View File

@@ -239,6 +239,8 @@ class GeoPlaces(GeoGraphyView):
self.without = 0
latitude = ""
longitude = ""
self.nbmarkers = 0
self.message_layer.clear_messages()
self.no_show_places_in_status_bar = False
# base "villes de france" : 38101 places :
# createmap : 8'50"; create_markers : 1'23"
@@ -279,6 +281,7 @@ class GeoPlaces(GeoGraphyView):
_LOG.debug("%s" % time.strftime(" end sort : "
"%a %d %b %Y %H:%M:%S", time.gmtime()))
if self.nbmarkers > 500 : # performance issue. Is it the good value ?
self.message_layer.add_message(_("The place name in the status bar is disabled."))
self.no_show_places_in_status_bar = True
self._create_markers()