* src/plugins/Check.py: loop through family relationships until all
problems are resolved svn: r4364
This commit is contained in:
parent
daea55dc65
commit
8da903e032
@ -1,4 +1,6 @@
|
||||
2005-04-14 Don Allingham <don@gramps-project.org>
|
||||
* src/plugins/Check.py: loop through family relationships until all
|
||||
problems are resolved
|
||||
* src/FamilyView.py: make load_family more robust to signals
|
||||
|
||||
2005-04-14 Martin Hawlisch <Martin.Hawlisch@gmx.de>
|
||||
|
@ -1028,7 +1028,8 @@ class FamilyView:
|
||||
sp = self.parent.db.get_person_from_handle(sp_id)
|
||||
event = self.find_marriage(fm)
|
||||
if event:
|
||||
mdate = " - %s" % DateHandler.displayer.display(event.get_date_object())
|
||||
dobj = event.get_date_object()
|
||||
mdate = " - %s" % DateHandler.displayer.display(dobj)
|
||||
else:
|
||||
mdate = ""
|
||||
v = "%s [%s]\n\t%s%s" % (
|
||||
@ -1041,19 +1042,24 @@ class FamilyView:
|
||||
self.spouse_model.set(node,0,"%s\n" % _("<double click to add spouse>"))
|
||||
self.spouse_model.set(node,1,f)
|
||||
|
||||
|
||||
if family and family.get_handle() in flist:
|
||||
self.display_marriage(family)
|
||||
node = flist[family.get_handle()]
|
||||
self.spouse_selection.select_iter(node)
|
||||
elif len(flist) > 0:
|
||||
fid = splist[0]
|
||||
fam = self.parent.db.get_family_from_handle(fid)
|
||||
self.display_marriage(fam)
|
||||
node = flist[fid]
|
||||
self.spouse_selection.select_iter(node)
|
||||
else:
|
||||
self.display_marriage(None)
|
||||
try:
|
||||
if family and family.get_handle() in flist:
|
||||
self.display_marriage(family)
|
||||
node = flist[family.get_handle()]
|
||||
self.spouse_selection.select_iter(node)
|
||||
elif len(flist) > 0:
|
||||
fid = splist[0]
|
||||
fam = self.parent.db.get_family_from_handle(fid)
|
||||
self.display_marriage(fam)
|
||||
node = flist[fid]
|
||||
self.spouse_selection.select_iter(node)
|
||||
else:
|
||||
self.display_marriage(None)
|
||||
except KeyError:
|
||||
WarningDialog(_('Database corruption detected'),
|
||||
_('A problem was detected with the database. Please '
|
||||
'run the Check and Repair Database tool to fix the '
|
||||
'problem.'))
|
||||
|
||||
self.update_list(self.ap_parents_model,self.ap_parents,person)
|
||||
|
||||
|
@ -61,10 +61,20 @@ def runTool(database,active_person,callback,parent=None):
|
||||
trans.set_batch(True)
|
||||
database.disable_signals()
|
||||
checker = CheckIntegrity(database,parent,trans)
|
||||
checker.check_for_broken_family_links()
|
||||
checker.cleanup_missing_photos(0)
|
||||
checker.check_parent_relationships()
|
||||
checker.cleanup_empty_families(0)
|
||||
|
||||
prev_total = -1
|
||||
total = 0
|
||||
|
||||
while prev_total != total:
|
||||
prev_total = total
|
||||
|
||||
checker.check_for_broken_family_links()
|
||||
checker.check_parent_relationships()
|
||||
checker.cleanup_empty_families(0)
|
||||
|
||||
total = checker.family_errors()
|
||||
|
||||
checker.check_events()
|
||||
checker.check_place_references()
|
||||
database.transaction_commit(trans, _("Check Integrity"))
|
||||
@ -101,8 +111,10 @@ class CheckIntegrity:
|
||||
self.invalid_death_events = []
|
||||
self.invalid_place_references = []
|
||||
|
||||
def family_errors(self):
|
||||
return len(self.broken_parent_links) + len(self.broken_links) + len(self.empty_family)
|
||||
|
||||
def check_for_broken_family_links(self):
|
||||
self.broken_links = []
|
||||
# Check persons referenced by the family objects
|
||||
for family_handle in self.db.get_family_handles():
|
||||
family = self.db.get_family_from_handle(family_handle)
|
||||
|
Loading…
Reference in New Issue
Block a user