* src/plugins/Check.py: loop through family relationships until all
problems are resolved svn: r4364
This commit is contained in:
parent
5617c42d2c
commit
350ed9e36d
@ -1,4 +1,6 @@
|
|||||||
2005-04-14 Don Allingham <don@gramps-project.org>
|
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
|
* src/FamilyView.py: make load_family more robust to signals
|
||||||
|
|
||||||
2005-04-14 Martin Hawlisch <Martin.Hawlisch@gmx.de>
|
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)
|
sp = self.parent.db.get_person_from_handle(sp_id)
|
||||||
event = self.find_marriage(fm)
|
event = self.find_marriage(fm)
|
||||||
if event:
|
if event:
|
||||||
mdate = " - %s" % DateHandler.displayer.display(event.get_date_object())
|
dobj = event.get_date_object()
|
||||||
|
mdate = " - %s" % DateHandler.displayer.display(dobj)
|
||||||
else:
|
else:
|
||||||
mdate = ""
|
mdate = ""
|
||||||
v = "%s [%s]\n\t%s%s" % (
|
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,0,"%s\n" % _("<double click to add spouse>"))
|
||||||
self.spouse_model.set(node,1,f)
|
self.spouse_model.set(node,1,f)
|
||||||
|
|
||||||
|
try:
|
||||||
if family and family.get_handle() in flist:
|
if family and family.get_handle() in flist:
|
||||||
self.display_marriage(family)
|
self.display_marriage(family)
|
||||||
node = flist[family.get_handle()]
|
node = flist[family.get_handle()]
|
||||||
self.spouse_selection.select_iter(node)
|
self.spouse_selection.select_iter(node)
|
||||||
elif len(flist) > 0:
|
elif len(flist) > 0:
|
||||||
fid = splist[0]
|
fid = splist[0]
|
||||||
fam = self.parent.db.get_family_from_handle(fid)
|
fam = self.parent.db.get_family_from_handle(fid)
|
||||||
self.display_marriage(fam)
|
self.display_marriage(fam)
|
||||||
node = flist[fid]
|
node = flist[fid]
|
||||||
self.spouse_selection.select_iter(node)
|
self.spouse_selection.select_iter(node)
|
||||||
else:
|
else:
|
||||||
self.display_marriage(None)
|
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)
|
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)
|
trans.set_batch(True)
|
||||||
database.disable_signals()
|
database.disable_signals()
|
||||||
checker = CheckIntegrity(database,parent,trans)
|
checker = CheckIntegrity(database,parent,trans)
|
||||||
checker.check_for_broken_family_links()
|
|
||||||
checker.cleanup_missing_photos(0)
|
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_events()
|
||||||
checker.check_place_references()
|
checker.check_place_references()
|
||||||
database.transaction_commit(trans, _("Check Integrity"))
|
database.transaction_commit(trans, _("Check Integrity"))
|
||||||
@ -101,8 +111,10 @@ class CheckIntegrity:
|
|||||||
self.invalid_death_events = []
|
self.invalid_death_events = []
|
||||||
self.invalid_place_references = []
|
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):
|
def check_for_broken_family_links(self):
|
||||||
self.broken_links = []
|
|
||||||
# Check persons referenced by the family objects
|
# Check persons referenced by the family objects
|
||||||
for family_handle in self.db.get_family_handles():
|
for family_handle in self.db.get_family_handles():
|
||||||
family = self.db.get_family_from_handle(family_handle)
|
family = self.db.get_family_from_handle(family_handle)
|
||||||
|
Loading…
Reference in New Issue
Block a user