* src/plugins/Verify.py (on_apply_clicked): Use gramps id for

display; (get_year): Corrections.


svn: r3464
This commit is contained in:
Alex Roitman 2004-08-21 19:09:52 +00:00
parent 1790aef639
commit 5222330f5c
2 changed files with 25 additions and 22 deletions

View File

@ -28,6 +28,9 @@
* src/GrampsDbBase.py (find_event_from_handle): * src/GrampsDbBase.py (find_event_from_handle):
Add transaction argument Add transaction argument
* src/plugins/Verify.py (on_apply_clicked): Use gramps id for
display; (get_year): Corrections.
2004-08-20 Don Allingham <dallingham@users.sourceforge.net> 2004-08-20 Don Allingham <dallingham@users.sourceforge.net>
* src/gramps_main.py: update family display after EditPerson * src/gramps_main.py: update family display after EditPerson
* src/EditPerson.py: fix callback * src/EditPerson.py: fix callback

View File

@ -117,7 +117,7 @@ class Verify:
event = self.db.get_event_from_handle(event_handle) event = self.db.get_event_from_handle(event_handle)
dateObj = event.get_date_object() dateObj = event.get_date_object()
if dateObj: if dateObj:
if dateObj.get_calendar().NAME != Gregorian.NAME: if dateObj.get_calendar().NAME != Gregorian.Gregorian.NAME:
dateObj.set_calendar(Gregorian.Gregorian) dateObj.set_calendar(Gregorian.Gregorian)
year = dateObj.get_year() year = dateObj.get_year()
return year return year
@ -147,7 +147,7 @@ class Verify:
for person_handle in personList: for person_handle in personList:
person = self.db.get_person_from_handle(person_handle) person = self.db.get_person_from_handle(person_handle)
idstr = "%s (%s)" % (person.get_primary_name().get_name(),person_handle) idstr = "%s (%s)" % (person.get_primary_name().get_name(),person.get_gramps_id())
# individual checks # individual checks
ageatdeath = 0 ageatdeath = 0
@ -161,9 +161,9 @@ class Verify:
event = self.db.get_event_from_handle(event_handle) event = self.db.get_event_from_handle(event_handle)
event_name = event.get_name().lower() event_name = event.get_name().lower()
if event.get_name() == "burial": if event.get_name() == "burial":
buryear = get_year( event ) buryear = self.get_year( event.get_handle() )
elif event_name == "baptism": elif event_name == "baptism":
bapyear = get_year( event ) bapyear = self.get_year( event.get_handle() )
if byear>0 and bapyear>0: if byear>0 and bapyear>0:
if byear > bapyear: if byear > bapyear:
@ -292,11 +292,11 @@ class Verify:
father = self.db.get_person_from_handle(father_handle) father = self.db.get_person_from_handle(father_handle)
if mother_handle and father_handle: if mother_handle and father_handle:
if ( mother.get_gender() == father.get_gender() ) and mother.get_gender() != RelLib.Person.unknown: if ( mother.get_gender() == father.get_gender() ) and mother.get_gender() != RelLib.Person.unknown:
warn.write( _("Homosexual marriage: %s in family %s.\n") % ( idstr, family.get_handle() ) ) warn.write( _("Homosexual marriage: %s in family %s.\n") % ( idstr, family.get_gramps_id() ) )
if father_handle == person.get_handle() and person.get_gender() == RelLib.Person.female: if father_handle == person.get_handle() and person.get_gender() == RelLib.Person.female:
error.write( _("Female husband: %s in family %s.\n") % ( idstr, family.get_handle() ) ) error.write( _("Female husband: %s in family %s.\n") % ( idstr, family.get_gramps_id() ) )
if mother_handle == person.get_handle() and person.get_gender() == RelLib.Person.male: if mother_handle == person.get_handle() and person.get_gender() == RelLib.Person.male:
error.write( _("Male wife: %s in family %s.\n") % ( idstr, family.get_handle() ) ) error.write( _("Male wife: %s in family %s.\n") % ( idstr, family.get_gramps_id() ) )
if father_handle == person.get_handle(): if father_handle == person.get_handle():
spouse_id = mother_handle spouse_id = mother_handle
else: else:
@ -306,12 +306,12 @@ class Verify:
if person.get_gender() == RelLib.Person.male and \ if person.get_gender() == RelLib.Person.male and \
person.get_primary_name().get_surname() == spouse.get_primary_name().get_surname(): person.get_primary_name().get_surname() == spouse.get_primary_name().get_surname():
warn.write( _("Husband and wife with the same surname: %s in family %s, and %s.\n") % ( warn.write( _("Husband and wife with the same surname: %s in family %s, and %s.\n") % (
idstr,family.get_handle(), spouse.get_primary_name().get_name() ) ) idstr,family.get_gramps_id(), spouse.get_primary_name().get_name() ) )
sdyear = self.get_year( spouse.get_death_handle() ) sdyear = self.get_year( spouse.get_death_handle() )
sbyear = self.get_year( spouse.get_birth_handle() ) sbyear = self.get_year( spouse.get_birth_handle() )
if abs(sbyear-byear) > hwdif: if abs(sbyear-byear) > hwdif:
warn.write( _("Large age difference between husband and wife: %s in family %s, and %s.\n") % ( warn.write( _("Large age difference between husband and wife: %s in family %s, and %s.\n") % (
idstr,family.get_handle(), spouse.get_primary_name().get_name() ) ) idstr,family.get_gramps_id(), spouse.get_primary_name().get_name() ) )
if sdyear == 0: if sdyear == 0:
sdyear = 0 # burial year sdyear = 0 # burial year
@ -384,9 +384,9 @@ class Verify:
wdwyear = maryear-prev_sdyear wdwyear = maryear-prev_sdyear
if wdwyear > lngwdw: if wdwyear > lngwdw:
if person.get_gender() == RelLib.Person.male: if person.get_gender() == RelLib.Person.male:
warn.write( _("Long widowhood: %s was a widower %d years before, family %s.\n") % (idstr, wdwyear, family.get_handle() ) ) warn.write( _("Long widowhood: %s was a widower %d years before, family %s.\n") % (idstr, wdwyear, family.get_gramps_id() ) )
if person.get_gender() == RelLib.Person.female: if person.get_gender() == RelLib.Person.female:
warn.write( _("Long widowhood: %s was a widow %d years before, family %s.\n") % (idstr, wdwyear, family.get_handle() ) ) warn.write( _("Long widowhood: %s was a widow %d years before, family %s.\n") % (idstr, wdwyear, family.get_gramps_id() ) )
if fnum==nfam and dyear>0 and sdyear>0: if fnum==nfam and dyear>0 and sdyear>0:
wdwyear = dyear - sdyear wdwyear = dyear - sdyear
@ -414,46 +414,46 @@ class Verify:
'male_name' : idstr, 'bage' : bage, 'fam' : family.get_handle(), 'child' : child.get_primary_name().get_name() } ) 'male_name' : idstr, 'bage' : bage, 'fam' : family.get_handle(), 'child' : child.get_primary_name().get_name() } )
if person.get_gender() == RelLib.Person.female: if person.get_gender() == RelLib.Person.female:
warn.write( _("Old mother: %(female_name)s at age of %(bage)d in family %(fam)s had a child %(child)s.\n") % { warn.write( _("Old mother: %(female_name)s at age of %(bage)d in family %(fam)s had a child %(child)s.\n") % {
'female_name' : idstr, 'bage' : bage, 'fam' : family.get_handle(), 'child' : child.get_primary_name().get_name() } ) 'female_name' : idstr, 'bage' : bage, 'fam' : family.get_gramps_id(), 'child' : child.get_primary_name().get_name() } )
if bage < 0: if bage < 0:
if person.get_gender() == RelLib.Person.male: if person.get_gender() == RelLib.Person.male:
error.write( _("Unborn father: %(male_name)s born %(byear)d, in family %(fam)s had a child %(child)s born %(cbyear)d.\n") % { error.write( _("Unborn father: %(male_name)s born %(byear)d, in family %(fam)s had a child %(child)s born %(cbyear)d.\n") % {
'male_name' : idstr, 'byear' : byear, 'fam' : family.get_handle(), 'child' : child.get_primary_name().get_name(), 'cbyear' : cbyear } ) 'male_name' : idstr, 'byear' : byear, 'fam' : family.get_gramps_id(), 'child' : child.get_primary_name().get_name(), 'cbyear' : cbyear } )
if person.get_gender() == RelLib.Person.female: if person.get_gender() == RelLib.Person.female:
error.write( _("Unborn mother: %(female_name)s born %(byear)d, in family %(fam)s had a child %(child)s born %(cbyear)d.\n") % { error.write( _("Unborn mother: %(female_name)s born %(byear)d, in family %(fam)s had a child %(child)s born %(cbyear)d.\n") % {
'female_name' : idstr, 'byear' : byear, 'fam' : family.get_handle(), 'child' : child.get_primary_name().get_name(), 'cbyear' : cbyear } ) 'female_name' : idstr, 'byear' : byear, 'fam' : family.get_gramps_id(), 'child' : child.get_primary_name().get_name(), 'cbyear' : cbyear } )
else: else:
if bage < yngpar: if bage < yngpar:
if person.get_gender() == RelLib.Person.male: if person.get_gender() == RelLib.Person.male:
warn.write( _("Young father: %(male_name)s at the age of %(bage)d in family %(fam)s had a child %(child)s.\n") % { warn.write( _("Young father: %(male_name)s at the age of %(bage)d in family %(fam)s had a child %(child)s.\n") % {
'male_name' : idstr, 'bage' : bage, 'fam' : family.get_handle(), 'child' : child.get_primary_name().get_name() } ) 'male_name' : idstr, 'bage' : bage, 'fam' : family.get_gramps_id(), 'child' : child.get_primary_name().get_name() } )
if person.get_gender() == RelLib.Person.female: if person.get_gender() == RelLib.Person.female:
warn.write( _("Young mother: %(female_name)s at the age of %(bage)d in family %(fam)s had a child %(child)s.\n") % { warn.write( _("Young mother: %(female_name)s at the age of %(bage)d in family %(fam)s had a child %(child)s.\n") % {
'female_name' : idstr, 'bage' : bage, 'fam' : family.get_handle(), 'child' : child.get_primary_name().get_name() } ) 'female_name' : idstr, 'bage' : bage, 'fam' : family.get_gramps_id(), 'child' : child.get_primary_name().get_name() } )
if dyear>0 and cbyear>dyear: if dyear>0 and cbyear>dyear:
if cbyear-1>dyear: if cbyear-1>dyear:
if person.get_gender() == RelLib.Person.male: if person.get_gender() == RelLib.Person.male:
error.write( _("Dead father: %(male_name)s died %(dyear)d, but in family %(fam)s had a child %(child)s born %(cbyear)d.\n") % { error.write( _("Dead father: %(male_name)s died %(dyear)d, but in family %(fam)s had a child %(child)s born %(cbyear)d.\n") % {
'male_name' : idstr, 'dyear' : dyear, 'fam' : family.get_handle(), 'child' : child.get_primary_name().get_name(), 'cbyear' : cbyear} ) 'male_name' : idstr, 'dyear' : dyear, 'fam' : family.get_gramps_id(), 'child' : child.get_primary_name().get_name(), 'cbyear' : cbyear} )
if person.get_gender() == RelLib.Person.female: if person.get_gender() == RelLib.Person.female:
error.write( _("Dead mother: %(female_name)s died %(dyear)d, but in family %(fam)s had a child %(child)s born %(cbyear)d.\n") % { error.write( _("Dead mother: %(female_name)s died %(dyear)d, but in family %(fam)s had a child %(child)s born %(cbyear)d.\n") % {
'female_name' : idstr, 'dyear' : dyear, 'fam' : family.get_handle(), 'child' : child.get_primary_name().get_name(), 'cbyear' : cbyear} ) 'female_name' : idstr, 'dyear' : dyear, 'fam' : family.get_gramps_id(), 'child' : child.get_primary_name().get_name(), 'cbyear' : cbyear} )
else: else:
if person.get_gender() == RelLib.Person.male: if person.get_gender() == RelLib.Person.male:
warn.write( _("Dead father: %(male_name)s died %(dyear)d, but in family %(fam)s had a child %(child)s born %(cbyear)d.\n") % { warn.write( _("Dead father: %(male_name)s died %(dyear)d, but in family %(fam)s had a child %(child)s born %(cbyear)d.\n") % {
'male_name' : idstr, 'dyear' : dyear, 'fam' : family.get_handle(), 'child' : child.get_primary_name().get_name(), 'cbyear' : cbyear} ) 'male_name' : idstr, 'dyear' : dyear, 'fam' : family.get_gramps_id(), 'child' : child.get_primary_name().get_name(), 'cbyear' : cbyear} )
if person.get_gender() == RelLib.Person.female: if person.get_gender() == RelLib.Person.female:
warn.write( _("Dead mother: %(female_name)s died %(dyear)d, but in family %(fam)s had a child %(child)s born %(cbyear)d.\n") % { warn.write( _("Dead mother: %(female_name)s died %(dyear)d, but in family %(fam)s had a child %(child)s born %(cbyear)d.\n") % {
'female_name' : idstr, 'dyear' : dyear, 'fam' : family.get_handle(), 'child' : child.get_primary_name().get_name(), 'cbyear' : cbyear} ) 'female_name' : idstr, 'dyear' : dyear, 'fam' : family.get_gramps_id(), 'child' : child.get_primary_name().get_name(), 'cbyear' : cbyear} )
if cbyears: if cbyears:
cbyears.sort() cbyears.sort()
if (cbyears[-1] - cbyears[0]) > cbspan: if (cbyears[-1] - cbyears[0]) > cbspan:
warn.write(_("Large year span for all children: family %s.\n") % family.get_handle() ) warn.write(_("Large year span for all children: family %s.\n") % family.get_gramps_id() )
if len(cbyears) > 1: if len(cbyears) > 1:
cby_diff = [ cbyears[i+1]-cbyears[i] for i in range(len(cbyears)-1) ] cby_diff = [ cbyears[i+1]-cbyears[i] for i in range(len(cbyears)-1) ]
if max(cby_diff) > cspace: if max(cby_diff) > cspace:
warn.write(_("Large age differences between children: family %s.\n") % family.get_handle() ) warn.write(_("Large age differences between children: family %s.\n") % family.get_gramps_id() )
text = "" text = ""
if error: if error: