Fix some Gramplets not updating during tree changes after db change. (#865)

Fixes #11234
This commit is contained in:
Paul Culley 2019-08-08 11:50:47 -05:00 committed by GitHub
parent 3e2e8a837f
commit e59aa58c63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -33,9 +33,11 @@ LOG = logging.getLogger(".Gramplets")
# Gramps modules # Gramps modules
# #
#------------------------------------------------------------------------ #------------------------------------------------------------------------
from ...gui.dbguielement import DbGUIElement
from ..const import GRAMPS_LOCALE as glocale from ..const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext _ = glocale.translation.gettext
class Gramplet: class Gramplet:
""" """
Base class for non-graphical gramplet code. Base class for non-graphical gramplet code.
@ -397,6 +399,13 @@ class Gramplet:
if hasattr(self.gui, 'navtypes') and 'Person' in self.gui.navtypes: if hasattr(self.gui, 'navtypes') and 'Person' in self.gui.navtypes:
self.connect_signal('Person', self._active_changed) self.connect_signal('Person', self._active_changed)
self.db_changed() self.db_changed()
# Some Gramplets use DbGUIElement; and DbGUIElement needs to know if
# db is changed. However, at initialization, DbGUIElement is not yet
# initialized when _db_changed is called, thus the test for callman
if hasattr(self, "callman") and isinstance(self, DbGUIElement):
# get DbGUIElement informed if in use
self._change_db(db) # DbGUIElement method
self.update() self.update()
def _no_db(self): def _no_db(self):