* src/plugins/Check.py: new database callback scheme; Use Utils.family_name.

* src/plugins/ChangeNames.py: new database callback scheme
* src/plugins/TestcaseGenerator.py: new database callback scheme


svn: r4268
This commit is contained in:
Martin Hawlisch 2005-04-01 07:39:21 +00:00
parent 862ba59a2f
commit a0429eabd3
4 changed files with 13 additions and 28 deletions

View File

@ -1,3 +1,8 @@
2005-04-01 Martin Hawlisch <Martin.Hawlisch@gmx.de>
* src/plugins/Check.py: new database callback scheme; Use Utils.family_name.
* src/plugins/ChangeNames.py: new database callback scheme
* src/plugins/TestcaseGenerator.py: new database callback scheme
2005-03-31 Don Allingham <don@gramps-project.org>
* src/AddSpouse.py: new database callback scheme. This scheme
provides a registration mechanism to signal interested objects

View File

@ -79,6 +79,7 @@ class ChangeNames:
return
self.win_key = self.__class__
self.trans = db.transaction_begin()
self.trans.set_batch(True)
self.name_list = []
for name in self.db.get_surname_list():

View File

@ -58,6 +58,7 @@ def runTool(database,active_person,callback,parent=None):
try:
trans = database.transaction_begin()
self.trans.set_batch(True)
checker = CheckIntegrity(database,parent,trans)
checker.check_for_broken_family_links()
checker.cleanup_missing_photos(0)
@ -356,25 +357,12 @@ class CheckIntegrity:
self.text.write(_("%d broken child/family links were found\n") % blink)
for (person_handle,family_handle) in self.broken_links:
person = self.db.get_person_from_handle(person_handle)
family = self.db.get_family_from_handle(family_handle)
if person:
cn = person.get_primary_name().get_name()
else:
cn = _("Non existing child")
if family:
f = self.db.get_person_from_handle(family.get_father_handle())
m = self.db.get_person_from_handle(family.get_mother_handle())
if f and m:
pn = _("%s and %s") % (f.get_primary_name().get_name(),\
m.get_primary_name().get_name())
elif f:
pn = f.get_primary_name().get_name()
elif m:
pn = m.get_primary_name().get_name()
else:
pn = _("unknown")
else:
pn = _("Non existing family")
family = self.db.get_family_from_handle(family_handle)
pn = Utils.family_name(family,self.db)
self.text.write('\t')
self.text.write(_("%s was removed from the family of %s\n") % (cn,pn))
@ -385,22 +373,12 @@ class CheckIntegrity:
self.text.write(_("%d broken spouse/family links were found\n") % plink)
for (person_handle,family_handle) in self.broken_parent_links:
person = self.db.get_person_from_handle(person_handle)
family = self.db.get_family_from_handle(family_handle)
if person:
cn = person.get_primary_name().get_name()
else:
cn = _("Non existing person")
f = self.db.get_person_from_handle(family.get_father_handle())
m = self.db.get_person_from_handle(family.get_mother_handle())
if f and m:
pn = _("%s and %s") % (f.get_primary_name().get_name(),\
m.get_primary_name().get_name())
elif f:
pn = f.get_primary_name().get_name()
elif m:
pn = m.get_primary_name().get_name()
else:
pn = "Non existing person"
family = self.db.get_family_from_handle(family_handle)
pn = Utils.family_name(family,self.db)
self.text.write('\t')
self.text.write(_("%s was restored to the family of %s\n") % (cn,pn))

View File

@ -124,7 +124,8 @@ class TestcaseGenerator:
self.max_person_count = generate_max_persons
self.trans = self.db.transaction_begin()
self.trans.set_batch(True)
if generate_bugs:
self.generate_broken_relations()