diff --git a/gramps/plugins/gramplet/locations.py b/gramps/plugins/gramplet/locations.py index dee8d6bf4..3c12a4e7f 100644 --- a/gramps/plugins/gramplet/locations.py +++ b/gramps/plugins/gramplet/locations.py @@ -50,7 +50,6 @@ class Locations(Gramplet, DbGUIElement): def __init__(self, gui, nav_group=0): Gramplet.__init__(self, gui, nav_group) DbGUIElement.__init__(self, self.dbstate.db) - self.db = self.dbstate.db def init(self): self.gui.WIDGET = self.build_gui() @@ -96,7 +95,7 @@ class Locations(Gramplet, DbGUIElement): def update_has_data(self): active_handle = self.get_active('Place') if active_handle: - active = self.db.get_place_from_handle(active_handle) + active = self.dbstate.db.get_place_from_handle(active_handle) self.set_has_data(self.get_has_data(active)) else: self.set_has_data(False) @@ -112,7 +111,7 @@ class Locations(Gramplet, DbGUIElement): self.callman.unregister_all() active_handle = self.get_active('Place') if active_handle: - active = self.db.get_place_from_handle(active_handle) + active = self.dbstate.db.get_place_from_handle(active_handle) if active: self.display_place(active, None, [active_handle]) else: @@ -151,7 +150,7 @@ class Locations(Gramplet, DbGUIElement): model, iter_ = treeview.get_selection().get_selected() if iter_: handle = model.get_value(iter_, 0) - place = self.db.get_place_from_handle(handle) + place = self.dbstate.db.get_place_from_handle(handle) try: EditPlace(self.dbstate, self.uistate, [], place) except WindowActiveError: @@ -173,7 +172,7 @@ class EnclosedBy(Locations): if placeref.ref in visited: continue - parent_place = self.db.get_place_from_handle(placeref.ref) + parent_place = self.dbstate.db.get_place_from_handle(placeref.ref) self.add_place(placeref, parent_place, node, visited) self.set_has_data(self.model.count > 0) @@ -201,12 +200,12 @@ class Encloses(Locations): Display the location hierarchy for the active place. """ self.callman.register_obj(place) - for link in self.db.find_backlink_handles(place.handle, - include_classes=['Place']): + for link in self.dbstate.db.find_backlink_handles( + place.handle, include_classes=['Place']): if link[1] in visited: continue - child_place = self.db.get_place_from_handle(link[1]) + child_place = self.dbstate.db.get_place_from_handle(link[1]) placeref = None for placeref in child_place.get_placeref_list(): if placeref.ref != place.handle: @@ -224,7 +223,7 @@ class Encloses(Locations): """ if place is None: return False - for link in self.db.find_backlink_handles(place.handle, - include_classes=['Place']): + for link in self.dbstate.db.find_backlink_handles( + place.handle, include_classes=['Place']): return True return False