* src/DataViews/_PersonView.py: handle unsetting of rows changing

the active person when the model is rebuilt.


svn: r6922
This commit is contained in:
Don Allingham 2006-06-20 04:25:44 +00:00
parent f1950ef831
commit 7c6b044711
3 changed files with 28 additions and 27 deletions

View File

@ -2,6 +2,8 @@
* src/Mime/_WinMime.py: Get application description from registry
2006-06-19 Don Allingham <don@gramps-project.org>
* src/DataViews/_PersonView.py: handle unsetting of rows changing
the active person when the model is rebuilt.
* src/DataViews/_Relationship.py: handle person set to None
* src/ViewManger.py: try tabs on the side
* src/DisplayTabs/_PersonRefEmbedList.py: change Relationships to

View File

@ -95,6 +95,7 @@ class PersonView(PageView.PersonNavView):
'F2' : self.key_goto_home_person,
'F3' : self.key_edit_selected_person,
}
self.dirty = True
def change_page(self):
pass
@ -163,11 +164,12 @@ class PersonView(PageView.PersonNavView):
if p1 and p2:
Merge.PersonCompare(self.dbstate, self.uistate, p1, p2)
else:
msg = _("Cannot merge people")
msg2 = _("Exactly two people must be selected to perform a merge. "
"A second person can be selected by holding down the "
"control key while clicking on the desired person.")
ErrorDialog(msg,msg2)
ErrorDialog(
_("Cannot merge people"),
_("Exactly two people must be selected to perform a "
"merge. A second person can be selected by holding "
"down the control key while clicking on the desired "
"person."))
def fast_merge(self, obj):
mlist = self.get_selected_objects()
@ -368,7 +370,6 @@ class PersonView(PageView.PersonNavView):
db.connect('person-delete', self.person_removed)
db.connect('person-rebuild', self.build_tree)
self.build_tree()
self.goto_active_person()
self.bookmarks.update_bookmarks(db.get_bookmarks())
if self.active:
self.bookmarks.redraw()
@ -400,10 +401,20 @@ class PersonView(PageView.PersonNavView):
# mark inactive to prevent recusion
self.inactive = True
self._goto()
# disable the inactive flag
self.inactive = False
# update history
self.handle_history(self.dbstate.active.handle)
def _goto(self):
# select the active person in the person view
p = self.dbstate.active
try:
if self.model:
if self.model and p:
path = self.model.on_get_path(p.get_handle())
group_name = p.get_primary_name().get_group_name()
top_name = self.dbstate.db.get_name_group_mapping(group_name)
@ -421,12 +432,6 @@ class PersonView(PageView.PersonNavView):
self.uistate.push_message(_("Active person not visible"))
self.dbstate.active = p
# disable the inactive flag
self.inactive = False
# update history
self.handle_history(p.handle)
def setup_filter(self):
"""
Builds the default filters and add them to the filter menu.
@ -444,7 +449,8 @@ class PersonView(PageView.PersonNavView):
def build_tree(self):
"""
Creates a new PeopleModel instance. Essentially creates a complete
rebuild of the data.
rebuild of the data. We need to temporarily store the active person,
since it can change when rows are unselected when the model is set.
"""
if self.active:
@ -455,15 +461,18 @@ class PersonView(PageView.PersonNavView):
self.model = PeopleModel(self.dbstate.db, filter_info)
active = self.dbstate.active
self.tree.set_model(self.model)
if const.use_tips and self.model.tooltip_column != None:
self.tooltips = TreeTips.TreeTips(self.tree,
self.model.tooltip_column,
True)
self.build_columns()
self.setup_filter()
self.goto_active_person()
self.dbstate.change_active_person(active)
self._goto()
self.dirty = False
else:
self.dirty = True

View File

@ -103,11 +103,7 @@ class RelationshipView(PageView.PersonNavView):
self.redraw()
def build_tree(self):
if self.active:
self.redraw()
self.dirty = False
else:
self.dirty = True
def connect_to_db(self, db):
db.connect('person-update', self.person_update)
@ -123,7 +119,6 @@ class RelationshipView(PageView.PersonNavView):
pass
else:
self.change_person(None)
self.dirty = False
def person_rebuild(self):
if self.dbstate.active:
@ -131,7 +126,6 @@ class RelationshipView(PageView.PersonNavView):
pass
else:
self.change_person(None)
self.dirty = False
def family_update(self, handle_list):
if self.dbstate.active:
@ -139,7 +133,6 @@ class RelationshipView(PageView.PersonNavView):
pass
else:
self.change_person(None)
self.dirty = False
def family_add(self, handle_list):
if self.dbstate.active:
@ -147,7 +140,6 @@ class RelationshipView(PageView.PersonNavView):
pass
else:
self.change_person(None)
self.dirty = False
def family_delete(self, handle_list):
if self.dbstate.active:
@ -155,7 +147,6 @@ class RelationshipView(PageView.PersonNavView):
pass
else:
self.change_person(None)
self.dirty = False
def family_rebuild(self):
if self.dbstate.active:
@ -163,7 +154,6 @@ class RelationshipView(PageView.PersonNavView):
pass
else:
self.change_person(None)
self.dirty = False
def get_stock(self):
"""