Geography : trying to solve possible gramps.gen.errors.HandleError: Handle is None
This commit is contained in:
@@ -781,9 +781,12 @@ class GeoGraphyView(OsmGps, NavigationView):
|
|||||||
fnam = mnam = _("Unknown")
|
fnam = mnam = _("Unknown")
|
||||||
if family_list:
|
if family_list:
|
||||||
for family in family_list:
|
for family in family_list:
|
||||||
|
father = mother = None
|
||||||
handle = family.get_father_handle()
|
handle = family.get_father_handle()
|
||||||
|
if handle:
|
||||||
father = dbstate.db.get_person_from_handle(handle)
|
father = dbstate.db.get_person_from_handle(handle)
|
||||||
handle = family.get_mother_handle()
|
handle = family.get_mother_handle()
|
||||||
|
if handle:
|
||||||
mother = dbstate.db.get_person_from_handle(handle)
|
mother = dbstate.db.get_person_from_handle(handle)
|
||||||
fnam = _nd.display(father) if father else _("Unknown")
|
fnam = _nd.display(father) if father else _("Unknown")
|
||||||
mnam = _nd.display(mother) if mother else _("Unknown")
|
mnam = _nd.display(mother) if mother else _("Unknown")
|
||||||
|
@@ -198,10 +198,13 @@ class GeoFamClose(GeoGraphyView):
|
|||||||
def family_label(self,family):
|
def family_label(self,family):
|
||||||
if family is None:
|
if family is None:
|
||||||
return "Unknown"
|
return "Unknown"
|
||||||
f = self.dbstate.db.get_person_from_handle(
|
f = m = None
|
||||||
family.get_father_handle())
|
hdl = family.get_father_handle()
|
||||||
m = self.dbstate.db.get_person_from_handle(
|
if hdl:
|
||||||
family.get_mother_handle())
|
f = self.dbstate.db.get_person_from_handle(hdl)
|
||||||
|
hdl = family.get_mother_handle()
|
||||||
|
if hdl:
|
||||||
|
m = self.dbstate.db.get_person_from_handle(hdl)
|
||||||
if f and m:
|
if f and m:
|
||||||
label = _("%(gramps_id)s : %(father)s and %(mother)s") % {
|
label = _("%(gramps_id)s : %(father)s and %(mother)s") % {
|
||||||
'father' : _nd.display(f),
|
'father' : _nd.display(f),
|
||||||
@@ -377,11 +380,14 @@ class GeoFamClose(GeoGraphyView):
|
|||||||
if len(family_list) > 0:
|
if len(family_list) > 0:
|
||||||
fhandle = family_list[0] # first is primary
|
fhandle = family_list[0] # first is primary
|
||||||
fam = dbstate.db.get_family_from_handle(fhandle)
|
fam = dbstate.db.get_family_from_handle(fhandle)
|
||||||
|
father = mother = None
|
||||||
handle = fam.get_father_handle()
|
handle = fam.get_father_handle()
|
||||||
|
if handle:
|
||||||
father = dbstate.db.get_person_from_handle(handle)
|
father = dbstate.db.get_person_from_handle(handle)
|
||||||
if father:
|
if father:
|
||||||
self.possible_meeting(father, ref_person)
|
self.possible_meeting(father, ref_person)
|
||||||
handle = fam.get_mother_handle()
|
handle = fam.get_mother_handle()
|
||||||
|
if handle:
|
||||||
mother = dbstate.db.get_person_from_handle(handle)
|
mother = dbstate.db.get_person_from_handle(handle)
|
||||||
if mother:
|
if mother:
|
||||||
self.possible_meeting(mother, ref_person)
|
self.possible_meeting(mother, ref_person)
|
||||||
@@ -400,24 +406,32 @@ class GeoFamClose(GeoGraphyView):
|
|||||||
try to expose each person of the reference family to the second family
|
try to expose each person of the reference family to the second family
|
||||||
"""
|
"""
|
||||||
dbstate = self.dbstate
|
dbstate = self.dbstate
|
||||||
|
person = None
|
||||||
try:
|
try:
|
||||||
person = dbstate.db.get_person_from_handle(reference.get_father_handle())
|
person = dbstate.db.get_person_from_handle(reference.get_father_handle())
|
||||||
except:
|
except:
|
||||||
return
|
return
|
||||||
if person is None: # family without father ?
|
if person is None: # family without father ?
|
||||||
person = dbstate.db.get_person_from_handle(reference.get_mother_handle())
|
handle = reference.get_mother_handle()
|
||||||
|
if handle:
|
||||||
|
person = dbstate.db.get_person_from_handle(handle)
|
||||||
if person is None:
|
if person is None:
|
||||||
person = dbstate.db.get_person_from_handle(self.uistate.get_active('Person'))
|
handle = self.uistate.get_active('Person')
|
||||||
|
if handle:
|
||||||
|
person = dbstate.db.get_person_from_handle(handle)
|
||||||
if person is not None:
|
if person is not None:
|
||||||
family_list = person.get_family_handle_list()
|
family_list = person.get_family_handle_list()
|
||||||
if len(family_list) > 0:
|
if len(family_list) > 0:
|
||||||
fhandle = family_list[0] # first is primary
|
fhandle = family_list[0] # first is primary
|
||||||
fam = dbstate.db.get_family_from_handle(fhandle)
|
fam = dbstate.db.get_family_from_handle(fhandle)
|
||||||
|
father = mother = None
|
||||||
handle = fam.get_father_handle()
|
handle = fam.get_father_handle()
|
||||||
|
if handle:
|
||||||
father = dbstate.db.get_person_from_handle(handle)
|
father = dbstate.db.get_person_from_handle(handle)
|
||||||
if father:
|
if father:
|
||||||
self._expose_persone_to_family(father, family)
|
self._expose_persone_to_family(father, family)
|
||||||
handle = fam.get_mother_handle()
|
handle = fam.get_mother_handle()
|
||||||
|
if handle:
|
||||||
mother = dbstate.db.get_person_from_handle(handle)
|
mother = dbstate.db.get_person_from_handle(handle)
|
||||||
if mother:
|
if mother:
|
||||||
self._expose_persone_to_family(mother, family)
|
self._expose_persone_to_family(mother, family)
|
||||||
@@ -488,12 +502,15 @@ class GeoFamClose(GeoGraphyView):
|
|||||||
family = self.dbstate.db.get_family_from_handle(family_hdl)
|
family = self.dbstate.db.get_family_from_handle(family_hdl)
|
||||||
if family is not None:
|
if family is not None:
|
||||||
fhandle = family_list[0] # first is primary
|
fhandle = family_list[0] # first is primary
|
||||||
|
father = mother = None
|
||||||
fam = dbstate.db.get_family_from_handle(fhandle)
|
fam = dbstate.db.get_family_from_handle(fhandle)
|
||||||
handle = fam.get_father_handle()
|
handle = fam.get_father_handle()
|
||||||
|
if handle:
|
||||||
father = dbstate.db.get_person_from_handle(handle)
|
father = dbstate.db.get_person_from_handle(handle)
|
||||||
if father:
|
if father:
|
||||||
descr1 = "%s - " % _nd.display(father)
|
descr1 = "%s - " % _nd.display(father)
|
||||||
handle = fam.get_mother_handle()
|
handle = fam.get_mother_handle()
|
||||||
|
if handle:
|
||||||
mother = dbstate.db.get_person_from_handle(handle)
|
mother = dbstate.db.get_person_from_handle(handle)
|
||||||
if mother:
|
if mother:
|
||||||
descr1 = "%s%s" % ( descr1, _nd.display(mother))
|
descr1 = "%s%s" % ( descr1, _nd.display(mother))
|
||||||
@@ -544,27 +561,35 @@ class GeoFamClose(GeoGraphyView):
|
|||||||
Create all markers for one family : all event's places with a lat/lon.
|
Create all markers for one family : all event's places with a lat/lon.
|
||||||
"""
|
"""
|
||||||
dbstate = self.dbstate
|
dbstate = self.dbstate
|
||||||
|
person = None
|
||||||
try:
|
try:
|
||||||
person = dbstate.db.get_person_from_handle(family.get_father_handle())
|
person = dbstate.db.get_person_from_handle(family.get_father_handle())
|
||||||
except:
|
except:
|
||||||
return
|
return
|
||||||
family_id = family.gramps_id
|
family_id = family.gramps_id
|
||||||
if person is None: # family without father ?
|
if person is None: # family without father ?
|
||||||
person = dbstate.db.get_person_from_handle(family.get_mother_handle())
|
handle = family.get_mother_handle()
|
||||||
|
if handle:
|
||||||
|
person = dbstate.db.get_person_from_handle(handle)
|
||||||
if person is None:
|
if person is None:
|
||||||
person = dbstate.db.get_person_from_handle(self.uistate.get_active('Person'))
|
handle = self.uistate.get_active('Person')
|
||||||
|
if handle:
|
||||||
|
person = dbstate.db.get_person_from_handle(handle)
|
||||||
if person is not None:
|
if person is not None:
|
||||||
family_list = person.get_family_handle_list()
|
family_list = person.get_family_handle_list()
|
||||||
if len(family_list) > 0:
|
if len(family_list) > 0:
|
||||||
fhandle = family_list[0] # first is primary
|
fhandle = family_list[0] # first is primary
|
||||||
fam = dbstate.db.get_family_from_handle(fhandle)
|
fam = dbstate.db.get_family_from_handle(fhandle)
|
||||||
|
father = mother = None
|
||||||
handle = fam.get_father_handle()
|
handle = fam.get_father_handle()
|
||||||
|
if handle:
|
||||||
father = dbstate.db.get_person_from_handle(handle)
|
father = dbstate.db.get_person_from_handle(handle)
|
||||||
if father:
|
if father:
|
||||||
comment = _("Father : %(id)s : %(name)s") % {'id': father.gramps_id,
|
comment = _("Father : %(id)s : %(name)s") % {'id': father.gramps_id,
|
||||||
'name': _nd.display(father)}
|
'name': _nd.display(father)}
|
||||||
self._createmap_for_one_person(father, color, place_list, reference)
|
self._createmap_for_one_person(father, color, place_list, reference)
|
||||||
handle = fam.get_mother_handle()
|
handle = fam.get_mother_handle()
|
||||||
|
if handle:
|
||||||
mother = dbstate.db.get_person_from_handle(handle)
|
mother = dbstate.db.get_person_from_handle(handle)
|
||||||
if mother:
|
if mother:
|
||||||
comment = _("Mother : %(id)s : %(name)s") % {'id': mother.gramps_id,
|
comment = _("Mother : %(id)s : %(name)s") % {'id': mother.gramps_id,
|
||||||
@@ -611,7 +636,10 @@ class GeoFamClose(GeoGraphyView):
|
|||||||
#family = self.dbstate.db.get_family_from_handle(family_x)
|
#family = self.dbstate.db.get_family_from_handle(family_x)
|
||||||
family = family_x
|
family = family_x
|
||||||
if family is None:
|
if family is None:
|
||||||
person = self.dbstate.db.get_family_from_handle(self.uistate.get_active('Person'))
|
handle = self.uistate.get_active('Person')
|
||||||
|
person = None
|
||||||
|
if handle:
|
||||||
|
person = self.dbstate.db.get_family_from_handle(handle)
|
||||||
if not person:
|
if not person:
|
||||||
return
|
return
|
||||||
family_list = person.get_family_handle_list()
|
family_list = person.get_family_handle_list()
|
||||||
|
@@ -271,10 +271,13 @@ class GeoFamily(GeoGraphyView):
|
|||||||
def family_label(self,family):
|
def family_label(self,family):
|
||||||
if family is None:
|
if family is None:
|
||||||
return "Unknown"
|
return "Unknown"
|
||||||
f = self.dbstate.db.get_person_from_handle(
|
f = m = None
|
||||||
family.get_father_handle())
|
hdl = family.get_father_handle()
|
||||||
m = self.dbstate.db.get_person_from_handle(
|
if hdl:
|
||||||
family.get_mother_handle())
|
f = self.dbstate.db.get_person_from_handle(hdl)
|
||||||
|
hdl = family.get_mother_handle()
|
||||||
|
if hdl:
|
||||||
|
m = self.dbstate.db.get_person_from_handle(hdl)
|
||||||
if f and m:
|
if f and m:
|
||||||
label = _("%(gramps_id)s : %(father)s and %(mother)s") % {
|
label = _("%(gramps_id)s : %(father)s and %(mother)s") % {
|
||||||
'father' : _nd.display(f),
|
'father' : _nd.display(f),
|
||||||
@@ -304,21 +307,28 @@ class GeoFamily(GeoGraphyView):
|
|||||||
"""
|
"""
|
||||||
dbstate = self.dbstate
|
dbstate = self.dbstate
|
||||||
self.message_layer.add_message(_("Family places for %s") % self.family_label(family))
|
self.message_layer.add_message(_("Family places for %s") % self.family_label(family))
|
||||||
try:
|
person = None
|
||||||
|
if family:
|
||||||
person = dbstate.db.get_person_from_handle(family.get_father_handle())
|
person = dbstate.db.get_person_from_handle(family.get_father_handle())
|
||||||
except:
|
else:
|
||||||
return
|
return
|
||||||
family_id = family.gramps_id
|
family_id = family.gramps_id
|
||||||
if person is None: # family without father ?
|
if person is None: # family without father ?
|
||||||
person = dbstate.db.get_person_from_handle(family.get_mother_handle())
|
handle = family.get_mother_handle()
|
||||||
|
if handle:
|
||||||
|
person = dbstate.db.get_person_from_handle(handle)
|
||||||
if person is None:
|
if person is None:
|
||||||
person = dbstate.db.get_person_from_handle(self.uistate.get_active('Person'))
|
handle = self.uistate.get_active('Person')
|
||||||
|
if handle:
|
||||||
|
person = dbstate.db.get_person_from_handle(handle)
|
||||||
if person is not None:
|
if person is not None:
|
||||||
family_list = person.get_family_handle_list()
|
family_list = person.get_family_handle_list()
|
||||||
if len(family_list) > 0:
|
if len(family_list) > 0:
|
||||||
fhandle = family_list[0] # first is primary
|
fhandle = family_list[0] # first is primary
|
||||||
fam = dbstate.db.get_family_from_handle(fhandle)
|
fam = dbstate.db.get_family_from_handle(fhandle)
|
||||||
|
father = mother = None
|
||||||
handle = fam.get_father_handle()
|
handle = fam.get_father_handle()
|
||||||
|
if handle:
|
||||||
father = dbstate.db.get_person_from_handle(handle)
|
father = dbstate.db.get_person_from_handle(handle)
|
||||||
if father:
|
if father:
|
||||||
comment = _("Father : %(id)s : %(name)s") % {'id': father.gramps_id,
|
comment = _("Father : %(id)s : %(name)s") % {'id': father.gramps_id,
|
||||||
@@ -326,6 +336,7 @@ class GeoFamily(GeoGraphyView):
|
|||||||
self._createpersonmarkers(dbstate, father,
|
self._createpersonmarkers(dbstate, father,
|
||||||
comment, family_id)
|
comment, family_id)
|
||||||
handle = fam.get_mother_handle()
|
handle = fam.get_mother_handle()
|
||||||
|
if handle:
|
||||||
mother = dbstate.db.get_person_from_handle(handle)
|
mother = dbstate.db.get_person_from_handle(handle)
|
||||||
if mother:
|
if mother:
|
||||||
comment = _("Mother : %(id)s : %(name)s") % {'id': mother.gramps_id,
|
comment = _("Mother : %(id)s : %(name)s") % {'id': mother.gramps_id,
|
||||||
|
@@ -315,11 +315,14 @@ class GeoMoves(GeoGraphyView):
|
|||||||
if family is not None:
|
if family is not None:
|
||||||
fhandle = family_list[0] # first is primary
|
fhandle = family_list[0] # first is primary
|
||||||
fam = dbstate.db.get_family_from_handle(fhandle)
|
fam = dbstate.db.get_family_from_handle(fhandle)
|
||||||
|
mother = father = None
|
||||||
handle = fam.get_father_handle()
|
handle = fam.get_father_handle()
|
||||||
|
if handle:
|
||||||
father = dbstate.db.get_person_from_handle(handle)
|
father = dbstate.db.get_person_from_handle(handle)
|
||||||
if father:
|
if father:
|
||||||
descr1 = "%s - " % _nd.display(father)
|
descr1 = "%s - " % _nd.display(father)
|
||||||
handle = fam.get_mother_handle()
|
handle = fam.get_mother_handle()
|
||||||
|
if handle:
|
||||||
mother = dbstate.db.get_person_from_handle(handle)
|
mother = dbstate.db.get_person_from_handle(handle)
|
||||||
if mother:
|
if mother:
|
||||||
descr1 = "%s%s" % ( descr1, _nd.display(mother))
|
descr1 = "%s%s" % ( descr1, _nd.display(mother))
|
||||||
@@ -383,26 +386,34 @@ class GeoMoves(GeoGraphyView):
|
|||||||
Create all markers for one family : all event's places with a lat/lon.
|
Create all markers for one family : all event's places with a lat/lon.
|
||||||
"""
|
"""
|
||||||
dbstate = self.dbstate
|
dbstate = self.dbstate
|
||||||
|
person = None
|
||||||
try:
|
try:
|
||||||
person = dbstate.db.get_person_from_handle(family.get_father_handle())
|
person = dbstate.db.get_person_from_handle(family.get_father_handle())
|
||||||
except:
|
except:
|
||||||
return
|
return
|
||||||
family_id = family.gramps_id
|
family_id = family.gramps_id
|
||||||
if person is None: # family without father ?
|
if person is None: # family without father ?
|
||||||
person = dbstate.db.get_person_from_handle(family.get_mother_handle())
|
handle = family.get_mother_handle()
|
||||||
|
if handle:
|
||||||
|
person = dbstate.db.get_person_from_handle(handle)
|
||||||
if person is None:
|
if person is None:
|
||||||
person = dbstate.db.get_person_from_handle(self.uistate.get_active('Person'))
|
handle = self.uistate.get_active('Person')
|
||||||
|
if handle:
|
||||||
|
person = dbstate.db.get_person_from_handle(handle)
|
||||||
if person is not None:
|
if person is not None:
|
||||||
self._add_person_to_list(person.gramps_id, curlevel-1)
|
self._add_person_to_list(person.gramps_id, curlevel-1)
|
||||||
family_list = person.get_family_handle_list()
|
family_list = person.get_family_handle_list()
|
||||||
for fhandle in family_list:
|
for fhandle in family_list:
|
||||||
fam = dbstate.db.get_family_from_handle(fhandle)
|
fam = dbstate.db.get_family_from_handle(fhandle)
|
||||||
|
father = mother = None
|
||||||
handle = fam.get_father_handle()
|
handle = fam.get_father_handle()
|
||||||
|
if handle:
|
||||||
father = dbstate.db.get_person_from_handle(handle)
|
father = dbstate.db.get_person_from_handle(handle)
|
||||||
if father:
|
if father:
|
||||||
self._createmap_for_next_level(father, level-1, level)
|
self._createmap_for_next_level(father, level-1, level)
|
||||||
self._add_person_to_list(father.gramps_id, curlevel-1)
|
self._add_person_to_list(father.gramps_id, curlevel-1)
|
||||||
handle = fam.get_mother_handle()
|
handle = fam.get_mother_handle()
|
||||||
|
if handle:
|
||||||
mother = dbstate.db.get_person_from_handle(handle)
|
mother = dbstate.db.get_person_from_handle(handle)
|
||||||
if mother:
|
if mother:
|
||||||
self._createmap_for_next_level(father, level-1, level)
|
self._createmap_for_next_level(father, level-1, level)
|
||||||
@@ -464,7 +475,9 @@ class GeoMoves(GeoGraphyView):
|
|||||||
self.place_without_coordinates = []
|
self.place_without_coordinates = []
|
||||||
self.minlat = self.maxlat = self.minlon = self.maxlon = 0.0
|
self.minlat = self.maxlat = self.minlon = self.maxlon = 0.0
|
||||||
if person is None:
|
if person is None:
|
||||||
person = self.dbstate.db.get_person_from_handle(self.uistate.get_active('Person'))
|
handle = self.uistate.get_active('Person')
|
||||||
|
if handle:
|
||||||
|
person = self.dbstate.db.get_person_from_handle(handle)
|
||||||
if not person:
|
if not person:
|
||||||
return
|
return
|
||||||
self.message_layer.add_message(_("All descendance for %s") % _nd.display(person))
|
self.message_layer.add_message(_("All descendance for %s") % _nd.display(person))
|
||||||
|
@@ -202,11 +202,12 @@ class GeoPerson(GeoGraphyView):
|
|||||||
Rebuild the tree with the given person handle as the root.
|
Rebuild the tree with the given person handle as the root.
|
||||||
"""
|
"""
|
||||||
active = self.get_active()
|
active = self.get_active()
|
||||||
if handle:
|
#if handle:
|
||||||
self._createmap(handle)
|
# self._createmap(handle)
|
||||||
elif active:
|
#elif active:
|
||||||
p1 = self.dbstate.db.get_person_from_handle(active)
|
# p1 = self.dbstate.db.get_person_from_handle(active)
|
||||||
self._createmap(p1)
|
# self._createmap(p1)
|
||||||
|
self._createmap()
|
||||||
self.uistate.modify_statusbar(self.dbstate)
|
self.uistate.modify_statusbar(self.dbstate)
|
||||||
|
|
||||||
def build_tree(self):
|
def build_tree(self):
|
||||||
@@ -216,7 +217,9 @@ class GeoPerson(GeoGraphyView):
|
|||||||
information.
|
information.
|
||||||
"""
|
"""
|
||||||
active = self.get_active()
|
active = self.get_active()
|
||||||
self._createmap(active)
|
#self._createmap(active)
|
||||||
|
self._createmap()
|
||||||
|
self.uistate.modify_statusbar(self.dbstate)
|
||||||
|
|
||||||
def animate(self, menu, marks, index, stepyear):
|
def animate(self, menu, marks, index, stepyear):
|
||||||
"""
|
"""
|
||||||
@@ -286,7 +289,8 @@ class GeoPerson(GeoGraphyView):
|
|||||||
menu, marks, i, stepyear)
|
menu, marks, i, stepyear)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def _createmap(self,obj):
|
#def _createmap(self,obj):
|
||||||
|
def _createmap(self):
|
||||||
"""
|
"""
|
||||||
Create all markers for each people's event in the database which has
|
Create all markers for each people's event in the database which has
|
||||||
a lat/lon.
|
a lat/lon.
|
||||||
@@ -306,7 +310,9 @@ class GeoPerson(GeoGraphyView):
|
|||||||
self.message_layer.clear_messages()
|
self.message_layer.clear_messages()
|
||||||
self.kml_layer.clear()
|
self.kml_layer.clear()
|
||||||
person_handle = self.uistate.get_active('Person')
|
person_handle = self.uistate.get_active('Person')
|
||||||
person = dbstate.db.get_person_from_handle(person_handle) if person_handle else None
|
person = None
|
||||||
|
if person_handle:
|
||||||
|
person = dbstate.db.get_person_from_handle(person_handle)
|
||||||
if person is not None:
|
if person is not None:
|
||||||
# For each event, if we have a place, set a marker.
|
# For each event, if we have a place, set a marker.
|
||||||
self.load_kml_files(person)
|
self.load_kml_files(person)
|
||||||
@@ -357,12 +363,15 @@ class GeoPerson(GeoGraphyView):
|
|||||||
if family is not None:
|
if family is not None:
|
||||||
fhandle = family_list[0] # first is primary
|
fhandle = family_list[0] # first is primary
|
||||||
fam = dbstate.db.get_family_from_handle(fhandle)
|
fam = dbstate.db.get_family_from_handle(fhandle)
|
||||||
|
father = mother = None
|
||||||
handle = fam.get_father_handle()
|
handle = fam.get_father_handle()
|
||||||
|
if handle:
|
||||||
father = dbstate.db.get_person_from_handle(handle)
|
father = dbstate.db.get_person_from_handle(handle)
|
||||||
descr1 = " - "
|
descr1 = " - "
|
||||||
if father:
|
if father:
|
||||||
descr1 = "%s - " % _nd.display(father)
|
descr1 = "%s - " % _nd.display(father)
|
||||||
handle = fam.get_mother_handle()
|
handle = fam.get_mother_handle()
|
||||||
|
if handle:
|
||||||
mother = dbstate.db.get_person_from_handle(handle)
|
mother = dbstate.db.get_person_from_handle(handle)
|
||||||
if mother:
|
if mother:
|
||||||
descr1 = "%s%s" % ( descr1, _nd.display(mother))
|
descr1 = "%s%s" % ( descr1, _nd.display(mother))
|
||||||
|
Reference in New Issue
Block a user