* src/gramps_main.py (post_load): Emit "database-changed" signal instead of calling change_db().

* src/PedView.py: Connect to "database-changed" signal and handle person-update signals to redraw the view.
* src/FamilyView.py (__init__) connect to database-changed signal, dont call change_cb because on initialisation there is no real database. (change_db): use database parameter supplied by signal emission.
* src/PeopleView.py (__init__) dont connect the signals, this will be done by change_db, (change_db): Use supplied database.
* src/SourceView.py (__init__): dont call change_cb because on initialisation there is no real database and this will be done by the signal.


svn: r4304
This commit is contained in:
Martin Hawlisch
2005-04-06 09:40:41 +00:00
parent 379f097746
commit 6f6f57e55d
6 changed files with 45 additions and 34 deletions

View File

@ -164,6 +164,9 @@ class DispBox:
class PedigreeView:
def __init__(self,parent,canvas,update,status_bar,lp):
self.parent = parent
self.parent.connect('database-changed',self.change_db)
self.canvas = canvas
self.canvas_items = []
self.boxes = []
@ -181,6 +184,17 @@ class PedigreeView:
self.anchor = None
self.canvas.parent.connect('button-press-event',self.on_canvas_press)
def change_db(self,db):
# Reconnect signals
db.connect('person-add', self.person_updated_cb)
db.connect('person-update', self.person_updated_cb)
db.connect('person-delete', self.person_updated_cb)
db.connect('person-rebuild', self.person_updated_cb)
def person_updated_cb(self,handle_list):
# Redraw view on changes of persons
self.load_canvas(self.active_person)
def clear(self):
for i in self.canvas_items:
i.destroy()