Handle active person and Pedigree startup issues

svn: r6306
This commit is contained in:
Don Allingham 2006-04-10 20:56:09 +00:00
parent a5634a4f8e
commit a6ccb47a55
4 changed files with 32 additions and 5 deletions

View File

@ -7,6 +7,10 @@
* src/ArgHandler.py: Get rid of obsolete self.parent.
2006-04-10 Don Allingham <don@gramps-project.org>
* src/DateViews/_PersonView.py: goto active person after a redraw.
* src/DataViews/_PedigreeViews.py: optimize the screen draws,
redrawing only when the view is displayed and when the data needs
to be updated.
* src/Editors/_EditFamily.py: Fix adding of spouse after family
has been created

View File

@ -522,6 +522,18 @@ class PedigreeView(PageView.PersonNavView):
PageView.PersonNavView.define_actions(self)
self.add_action('HomePerson',gtk.STOCK_HOME, "_Home", callback=self.home)
def build_tree(self):
"""
This is called by the parent class when the view becomes visible. Since
all handling of visibility is now in rebuild_trees, see that for more
information.
"""
active = self.dbstate.get_active_person()
if active:
self.rebuild_trees(active.handle)
else:
self.rebuild_trees(None)
def change_db(self,db):
"""
Callback associated with DbState. Whenenver the database
@ -539,6 +551,7 @@ class PedigreeView(PageView.PersonNavView):
self.rebuild_trees(None)
def goto_active_person(self,handle=None):
self.dirty = True
if handle:
self.rebuild_trees(handle)
self.handle_history(handle)
@ -546,18 +559,21 @@ class PedigreeView(PageView.PersonNavView):
self.rebuild_trees(None)
def person_updated_cb(self,handle_list):
self.dirty = True
if self.dbstate.active:
self.rebuild_trees(self.dbstate.active.handle)
else:
self.rebuild_trees(None)
def person_rebuild(self):
self.dirty = True
if self.dbstate.active:
self.rebuild_trees(self.dbstate.active.handle)
else:
self.rebuild_trees(None)
def person_edited_cb(self, p1=None, p2=None):
self.dirty = True
pass
def request_resize(self):
@ -580,6 +596,17 @@ class PedigreeView(PageView.PersonNavView):
person = None
if person_handle:
person = self.dbstate.db.get_person_from_handle( person_handle)
# Eliminate unnecessary redraws. If the window is active, clear the
# dirty flag, and redraw. If we are not begin displayed, set the dirty
# flag and do nothing.
if not self.active or not self.dirty:
self.dirty = True
return
else:
self.dirty = False
if self.tree_style == 1:
# format of the definition is:
# ((each box of the pedigree has a node here),

View File

@ -253,13 +253,9 @@ class PersonView(PageView.PersonNavView):
db.connect('person-update', self.person_updated)
db.connect('person-delete', self.person_removed)
db.connect('person-rebuild', self.build_tree)
# self.build_tree()
self.generic_filter_widget.apply_filter()
def goto_active_person(self,obj=None):
self.goto_active_person_2(None)
def goto_active_person_2(self,obj=None):
"""
Callback (and usable function) that selects the active person
in the display tree.
@ -359,6 +355,7 @@ class PersonView(PageView.PersonNavView):
self.model.tooltip_column,
True)
self.build_columns()
self.goto_active_person()
self.dirty = False
else:
self.dirty = True

View File

@ -73,7 +73,6 @@ class PageView:
self.active = False
def set_active(self):
print self, self.active, self.dirty
self.active = True
if self.dirty:
self.uistate.set_busy_cursor(True)