5232: Connect database signals using the callback manager

svn: r18671
This commit is contained in:
Nick Hall 2011-12-31 22:03:44 +00:00
parent 111cfce6fd
commit 16ed3156af

View File

@ -860,6 +860,19 @@ class PedigreeView(NavigationView):
except AttributeError, msg: except AttributeError, msg:
RunDatabaseRepair(str(msg)) RunDatabaseRepair(str(msg))
def _connect_db_signals(self):
"""
Connect database signals.
"""
self._add_db_signal('person-add', self.person_rebuild)
self._add_db_signal('person-update', self.person_rebuild)
self._add_db_signal('person-delete', self.person_rebuild)
self._add_db_signal('person-rebuild', self.person_rebuild_bm)
self._add_db_signal('family-update', self.person_rebuild)
self._add_db_signal('family-add', self.person_rebuild)
self._add_db_signal('family-delete', self.person_rebuild)
self._add_db_signal('family-rebuild', self.person_rebuild)
def change_db(self, db): def change_db(self, db):
""" """
Callback associated with DbState. Whenever the database Callback associated with DbState. Whenever the database
@ -868,14 +881,7 @@ class PedigreeView(NavigationView):
is no need to store the database, since we will get the value is no need to store the database, since we will get the value
from self.state.db from self.state.db
""" """
db.connect('person-add', self.person_rebuild) self._change_db(db)
db.connect('person-update', self.person_rebuild)
db.connect('person-delete', self.person_rebuild)
db.connect('person-rebuild', self.person_rebuild_bm)
db.connect('family-update', self.person_rebuild)
db.connect('family-add', self.person_rebuild)
db.connect('family-delete', self.person_rebuild)
db.connect('family-rebuild', self.person_rebuild)
self.bookmarks.update_bookmarks(self.dbstate.db.get_bookmarks()) self.bookmarks.update_bookmarks(self.dbstate.db.get_bookmarks())
if self.active: if self.active:
self.bookmarks.redraw() self.bookmarks.redraw()