* 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 19fe252c4c
commit 692fafe9c9
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> 2005-03-31 Don Allingham <don@gramps-project.org>
* src/AddSpouse.py: new database callback scheme. This scheme * src/AddSpouse.py: new database callback scheme. This scheme
provides a registration mechanism to signal interested objects provides a registration mechanism to signal interested objects

View File

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

View File

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

View File

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