From 84e0d45ab6d30dc393d5ac464b56b82003c2a2c4 Mon Sep 17 00:00:00 2001 From: prculley Date: Sat, 14 Oct 2017 11:36:31 -0500 Subject: [PATCH] Fix Geography view 'Find' when db is closed. Fixes #10229 --- gramps/plugins/view/geoclose.py | 15 ++++++++++----- gramps/plugins/view/geoevents.py | 2 ++ gramps/plugins/view/geofamclose.py | 3 +++ gramps/plugins/view/geofamily.py | 2 ++ gramps/plugins/view/geoperson.py | 2 ++ gramps/plugins/view/geoplaces.py | 2 ++ 6 files changed, 21 insertions(+), 5 deletions(-) diff --git a/gramps/plugins/view/geoclose.py b/gramps/plugins/view/geoclose.py index f396582c2..3b7a3f445 100644 --- a/gramps/plugins/view/geoclose.py +++ b/gramps/plugins/view/geoclose.py @@ -313,13 +313,18 @@ class GeoClose(GeoGraphyView): all handling of visibility is now in rebuild_trees, see that for more information. """ - active = self.get_active() - person = self.dbstate.db.get_person_from_handle(active) self.lifeway_layer.clear_ways() - if person is None: - self.goto_handle(None) + if not self.dbstate.is_open(): + return + active = self.get_active() + if active: + person = self.dbstate.db.get_person_from_handle(active) + if person is None: + self.goto_handle(None) + else: + self.goto_handle(handle=person) else: - self.goto_handle(handle=person) + self.goto_handle(None) def draw(self, menu, marks, color, reference): """ diff --git a/gramps/plugins/view/geoevents.py b/gramps/plugins/view/geoevents.py index eab093acc..9cd49802e 100644 --- a/gramps/plugins/view/geoevents.py +++ b/gramps/plugins/view/geoevents.py @@ -188,6 +188,8 @@ class GeoEvents(GeoGraphyView): all handling of visibility is now in rebuild_trees, see that for more information. """ + if not self.dbstate.is_open(): + return active = self.uistate.get_active('Event') if active: self._createmap(active) diff --git a/gramps/plugins/view/geofamclose.py b/gramps/plugins/view/geofamclose.py index 068ebde41..d3af73a33 100644 --- a/gramps/plugins/view/geofamclose.py +++ b/gramps/plugins/view/geofamclose.py @@ -304,6 +304,9 @@ class GeoFamClose(GeoGraphyView): all handling of visibility is now in rebuild_trees, see that for more information. """ + self.lifeway_layer.clear_ways() + if not self.dbstate.is_open(): + return active = self.get_active() family = self.dbstate.db.get_family_from_handle(active) self.goto_handle(handle=family) diff --git a/gramps/plugins/view/geofamily.py b/gramps/plugins/view/geofamily.py index ebccc2dc1..4f6437ffa 100644 --- a/gramps/plugins/view/geofamily.py +++ b/gramps/plugins/view/geofamily.py @@ -178,6 +178,8 @@ class GeoFamily(GeoGraphyView): all handling of visibility is now in rebuild_trees, see that for more information. """ + if not self.dbstate.is_open(): + return if self.uistate.get_active('Family'): self._createmap(self.uistate.get_active('Family')) else: diff --git a/gramps/plugins/view/geoperson.py b/gramps/plugins/view/geoperson.py index b0900b6ac..00bc52167 100644 --- a/gramps/plugins/view/geoperson.py +++ b/gramps/plugins/view/geoperson.py @@ -215,6 +215,8 @@ class GeoPerson(GeoGraphyView): all handling of visibility is now in rebuild_trees, see that for more information. """ + if not self.dbstate.is_open(): + return active = self.get_active() self._createmap(active) diff --git a/gramps/plugins/view/geoplaces.py b/gramps/plugins/view/geoplaces.py index 484d5f59d..74c7ab30c 100644 --- a/gramps/plugins/view/geoplaces.py +++ b/gramps/plugins/view/geoplaces.py @@ -189,6 +189,8 @@ class GeoPlaces(GeoGraphyView): all handling of visibility is now in rebuild_trees, see that for more information. """ + if not self.dbstate.is_open(): + return active = self.uistate.get_active('Place') if active: self._createmap(active)