2006-12-02 Don Allingham <don@gramps-project.org>

* src/DataViews/_RelationView.py: disable buttons when person is inactive
	* src/plugins/Check.py: remove duplicate children in a family



svn: r7752
This commit is contained in:
Don Allingham 2006-12-03 05:20:15 +00:00
parent 0f445d124a
commit a2fd59a7fd
3 changed files with 41 additions and 3 deletions

View File

@ -1,3 +1,7 @@
2006-12-02 Don Allingham <don@gramps-project.org>
* src/DataViews/_RelationView.py: disable buttons when person is inactive
* src/plugins/Check.py: remove duplicate children in a family
2006-12-02 Alex Roitman <shura@gramps-project.org>
* src/Filters/SideBar/*SidebarFilter.py: Busy cursor when filtering.
* src/plugins/Check.py (check_repo_references): Add new check.

View File

@ -336,6 +336,8 @@ class RelationshipView(PageView.PersonNavView):
if self.child:
for old_child in self.vbox.get_children():
self.vbox.remove(old_child)
for old_child in self.header.get_children():
self.header.remove(old_child)
self.child = None
self.dbstate.db.connect('family-update', self.redraw)
self.dbstate.db.connect('family-add', self.redraw)
@ -373,11 +375,16 @@ class RelationshipView(PageView.PersonNavView):
for old_child in self.vbox.get_children():
self.vbox.remove(old_child)
for old_child in self.header.get_children():
self.header.remove(old_child)
person = self.dbstate.db.get_person_from_handle(obj)
if not person:
self.family_action.set_sensitive(False)
self.order_action.set_sensitive(False)
self.redrawing = False
return
self.family_action.set_sensitive(True)
self.write_title(person)

View File

@ -29,7 +29,11 @@
#-------------------------------------------------------------------------
import os
import cStringIO
import sets
try:
set()
except:
from sets import Set as set
from gettext import gettext as _
#------------------------------------------------------------------------
@ -98,7 +102,7 @@ def _table_low_level(db,table):
Low level repair for a given db table.
"""
handle_list = table.keys()
dup_handles = sets.Set(
dup_handles = set(
[ handle for handle in handle_list if handle_list.count(handle) > 1 ]
)
@ -290,7 +294,7 @@ class CheckIntegrity:
value = self.db.person_map[handle]
p = RelLib.Person(value)
splist = p.get_family_handle_list()
if len(splist) != len(sets.Set(splist)):
if len(splist) != len(set(splist)):
new_list = []
for value in splist:
if value not in new_list:
@ -388,11 +392,34 @@ class CheckIntegrity:
family.remove_child_ref(child_ref)
self.db.commit_family(family,self.trans)
self.broken_links.append((child_handle,family_handle))
new_ref_list = []
new_ref_handles = []
replace = False
for child_ref in family.get_child_ref_list():
child_handle = child_ref.ref
if child_handle in new_ref_handles:
replace = True
else:
new_ref_list.append(child_ref)
new_ref_handles.append(child_handle)
if replace:
family.set_child_ref_list(new_ref_list)
self.db.commit_family(family,self.trans)
self.progress.step()
# Check persons membership in referenced families
for person_handle in self.db.get_person_handles():
person = self.db.get_person_from_handle(person_handle)
phandle_list = person.get_parent_family_handle_list()
new_list = list(set(phandle_list))
if len(phandle_list) != len(new_list):
person.set_parent_family_handle_list(new_list)
self.db.commit_person(person,self.trans)
for par_family_handle in person.get_parent_family_handle_list():
family = self.db.get_family_from_handle(par_family_handle)
if not family: