~rosco2/ubuntu/wily/gramps/bug-1492304

« back to all changes in this revision

Viewing changes to src/plugins/Verify.py

  • Committer: Bazaar Package Importer
  • Author(s): James A. Treacy
  • Date: 2004-06-16 16:53:36 UTC
  • Revision ID: james.westby@ubuntu.com-20040616165336-kjzczqef4gnxrn2b
Tags: upstream-1.0.4
ImportĀ upstreamĀ versionĀ 1.0.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#
 
2
# Gramps - a GTK+/GNOME based genealogy program
 
3
#
 
4
# Copyright (C) 2000-2003  Donald N. Allingham
 
5
#
 
6
# This program is free software; you can redistribute it and/or modify
 
7
# it under the terms of the GNU General Public License as published by
 
8
# the Free Software Foundation; either version 2 of the License, or
 
9
# (at your option) any later version.
 
10
#
 
11
# This program is distributed in the hope that it will be useful,
 
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
# GNU General Public License for more details.
 
15
#
 
16
# You should have received a copy of the GNU General Public License
 
17
# along with this program; if not, write to the Free Software
 
18
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
19
#
 
20
 
 
21
#
 
22
# Modified by Alex Roitman to enable translation of warnings and errors.
 
23
# Modified further to use cStringIO object. 
 
24
#
 
25
 
 
26
"View/Verify"
 
27
 
 
28
#------------------------------------------------------------------------
 
29
#
 
30
# standard python modules
 
31
#
 
32
#------------------------------------------------------------------------
 
33
import os
 
34
import cStringIO
 
35
 
 
36
#------------------------------------------------------------------------
 
37
#
 
38
# GNOME/GTK modules
 
39
#
 
40
#------------------------------------------------------------------------
 
41
from gnome.ui import *
 
42
import gtk
 
43
import gtk.glade 
 
44
 
 
45
#------------------------------------------------------------------------
 
46
#
 
47
# GRAMPS modules
 
48
#
 
49
#------------------------------------------------------------------------
 
50
import RelLib
 
51
import Utils
 
52
import Date
 
53
import Gregorian
 
54
 
 
55
from gettext import gettext as _
 
56
 
 
57
db = None
 
58
glade_file = None
 
59
verifySettings = None
 
60
 
 
61
# returns the year of an event or 0 if no event==None or no year specified in the event
 
62
def get_year( event ):
 
63
    year = 0
 
64
    if event != None:
 
65
        dateObj = event.getDateObj()
 
66
        if dateObj != None:
 
67
            dateObj = Date.Date(dateObj)
 
68
            if dateObj.__class__ != Gregorian.Gregorian:
 
69
                dateObj.set_calendar(Gregorian.Gregorian)
 
70
            year = dateObj.getYear()
 
71
    return year
 
72
 
 
73
def runTool(database,active_person,callback):
 
74
    global glade_file
 
75
    global db 
 
76
    global verifySettings
 
77
    
 
78
    db = database
 
79
    
 
80
    base = os.path.dirname(__file__)
 
81
    glade_file = base + os.sep + "verify.glade"
 
82
 
 
83
    verifySettings = gtk.glade.XML(glade_file,"verify_settings","gramps")
 
84
    verifySettings.signal_autoconnect({
 
85
        "destroy_passed_object" : Utils.destroy_passed_object,
 
86
        "on_verify_ok_clicked" : on_apply_clicked
 
87
        })
 
88
 
 
89
    Utils.set_titles(verifySettings.get_widget('verify_settings'),
 
90
                     verifySettings.get_widget('title'),
 
91
                     _('Database Verify'))
 
92
 
 
93
 
 
94
def on_apply_clicked(obj):
 
95
    global db 
 
96
    global verifySettings
 
97
 
 
98
    personList = db.getPersonMap().values()
 
99
 
 
100
    oldage = int(verifySettings.get_widget("oldage").get_text())
 
101
    yngmar = int(verifySettings.get_widget("yngmar").get_text())
 
102
    oldmar = int(verifySettings.get_widget("oldmar").get_text())
 
103
    oldmom = int(verifySettings.get_widget("oldmom").get_text())
 
104
    yngmom = int(verifySettings.get_widget("yngmom").get_text())
 
105
    olddad = int(verifySettings.get_widget("olddad").get_text())
 
106
    yngdad = int(verifySettings.get_widget("yngdad").get_text())
 
107
    wedder = int(verifySettings.get_widget("wedder").get_text())
 
108
    lngwdw = int(verifySettings.get_widget("lngwdw").get_text())
 
109
    estimate_age = verifySettings.get_widget("estimate").get_active()
 
110
 
 
111
    oldunm = 99  # maximum age at death for unmarried person 
 
112
 
 
113
    error = cStringIO.StringIO()
 
114
    warn = cStringIO.StringIO()
 
115
 
 
116
    for person in personList:
 
117
        idstr = person.getPrimaryName().getName() + " (" + person.getId() + ")"
 
118
        
 
119
        # individual checks
 
120
        ageatdeath = 0
 
121
        byear = get_year( person.getBirth() )
 
122
        bapyear = 0
 
123
        dyear = get_year( person.getDeath() )
 
124
        buryear = 0
 
125
        if byear>0 and bapyear>0:
 
126
            if byear > bapyear:
 
127
                if person.getGender() == RelLib.Person.male:
 
128
                        error.write( _("Baptized before birth: %(male_name)s born %(byear)d, baptized %(bapyear)d.\n") % { 
 
129
                                'male_name' : idstr, 'byear' : byear, 'bapyear' : bapyear } )
 
130
                if person.getGender() == RelLib.Person.female:
 
131
                        error.write( _("Baptized before birth: %(female_name)s born %(byear)d, baptized %(bapyear)d.\n") % { 
 
132
                                'female_name' : idstr, 'byear' : byear, 'bapyear' : bapyear } )
 
133
            if byear < bapyear:
 
134
                if person.getGender() == RelLib.Person.male:
 
135
                        warn.write( _("Baptized late: %(male_name)s born %(byear)d, baptized %(bapyear)d.\n") % { 
 
136
                                'male_name' : idstr, 'byear' : byear, 'bapyear' : bapyear } )
 
137
                if person.getGender() == RelLib.Person.female:
 
138
                        warn.write( _("Baptized late: %(female_name)s born %(byear)d, baptized %(bapyear)d.\n") % { 
 
139
                                'female_name' : idstr, 'byear' : byear, 'bapyear' : bapyear } )
 
140
        if dyear>0 and buryear>0:
 
141
            if dyear > buryear:
 
142
                if person.getGender() == RelLib.Person.male:
 
143
                        error.write( _("Buried before death: %(male_name)s died %(dyear)d, buried %(buryear)d.\n") % { 
 
144
                                'male_name' : idstr, 'dyear' : dyear, 'buryear' : buryear } )
 
145
                if person.getGender() == RelLib.Person.female:
 
146
                        error.write( _("Buried before death: %(female_name)s died %(dyear)d, buried %(buryear)d.\n") % { 
 
147
                                'female_name' : idstr, 'dyear' : dyear, 'buryear' : buryear } )
 
148
            if dyear < buryear:
 
149
                if person.getGender() == RelLib.Person.male:
 
150
                        warn.write( _("Buried late: %(male_name)s died %(dyear)d, buried %(buryear)d.\n") % { 
 
151
                                'male_name' : idstr, 'dyear' : dyear, 'buryear' : buryear } )
 
152
                if person.getGender() == RelLib.Person.female:
 
153
                        warn.write( _("Buried late: %(female_name)s died %(dyear)d, buried %(buryear)d.\n") % { 
 
154
                                'female_name' : idstr, 'dyear' : dyear, 'buryear' : buryear } )
 
155
        if dyear>0 and (byear>dyear):
 
156
            if person.getGender() == RelLib.Person.male:
 
157
                    error.write( _("Died before birth: %(male_name)s born %(byear)d, died %(dyear)d.\n") % { 
 
158
                        'male_name' : idstr, 'byear' : byear, 'dyear' : dyear } )
 
159
            if person.getGender() == RelLib.Person.female:
 
160
                    error.write( _("Died before birth: %(female_name)s born %(byear)d, died %(dyear)d.\n") % { 
 
161
                        'female_name' : idstr, 'byear' : byear, 'dyear' : dyear } )
 
162
        if dyear>0 and (bapyear>dyear):
 
163
            if person.getGender() == RelLib.Person.male:
 
164
                error.write( _("Died before baptism: %(male_name)s baptized %(bapyear)d, died %(dyear)d.\n") % { 
 
165
                        'male_name' : idstr, 'bapyear' : bapyear, 'dyear' : dyear } )
 
166
            if person.getGender() == RelLib.Person.female:
 
167
                error.write( _("Died before baptism: %(female_name)s baptized %(bapyear)d, died %(dyear)d.\n") % { 
 
168
                        'female_name' : idstr, 'bapyear' : bapyear, 'dyear' : dyear } )
 
169
        if buryear>0 and (byear>buryear):
 
170
            if person.getGender() == RelLib.Person.male:
 
171
                error.write( _("Buried before birth: %(male_name)s born %(byear)d, buried %(buryear)d.\n") % { 
 
172
                        'male_name' : idstr, 'byear' : byear, 'buryear' : buryear } )
 
173
            if person.getGender() == RelLib.Person.female:
 
174
                error.write( _("Buried before birth: %(female_name)s born %(byear)d, buried %(buryear)d.\n") % { 
 
175
                        'female_name' : idstr, 'byear' : byear, 'buryear' : buryear } )
 
176
        if buryear>0 and (bapyear>buryear):
 
177
            if person.getGender() == RelLib.Person.male:
 
178
                error.write( _("Buried before baptism: %(male_name)s baptized %(bapyear)d, buried %(buryear)d.\n") % { 
 
179
                        'male_name' : idstr, 'bapyear' : bapyear, 'buryear' : buryear } )
 
180
            if person.getGender() == RelLib.Person.female:
 
181
                error.write( _("Buried before baptism: %(female_name)s baptized %(bapyear)d, buried %(buryear)d.\n") % { 
 
182
                        'female_name' : idstr, 'bapyear' : bapyear, 'buryear' : buryear } )
 
183
        if byear == 0 and estimate_age:
 
184
            byear = bapyear  # guess baptism = birth
 
185
        if dyear == 0 and estimate_age:
 
186
            dyear = buryear  # guess burial = death
 
187
        if byear>0 and dyear>0:
 
188
            ageatdeath = dyear - byear
 
189
        else:
 
190
            ageatdeath = 0
 
191
        if ageatdeath > oldage:
 
192
            if person.getGender() == RelLib.Person.male:
 
193
                warn.write( _("Old age: %(male_name)s born %(byear)d, died %(dyear)d, at the age of %(ageatdeath)d.\n") % { 
 
194
                    'male_name' : idstr, 'byear' : byear, 'dyear' : dyear, 'ageatdeath' : ageatdeath } )
 
195
            if person.getGender() == RelLib.Person.female:
 
196
                warn.write( _("Old age: %(female_name)s born %(byear)d, died %(dyear)d, at the age of %(ageatdeath)d.\n") % { 
 
197
                    'female_name' : idstr, 'byear' : byear, 'dyear' : dyear, 'ageatdeath' : ageatdeath } )
 
198
            
 
199
        # gender checks
 
200
 
 
201
        if person.getGender() == RelLib.Person.female:
 
202
            oldpar = oldmom
 
203
            yngpar = yngmom
 
204
        if person.getGender() == RelLib.Person.male:
 
205
            oldpar = olddad
 
206
            yngpar = yngdad
 
207
        if (person.getGender() != RelLib.Person.female) and (person.getGender() != RelLib.Person.male):
 
208
            warn.write( _("Unknown gender for %s.\n") % idstr )
 
209
            oldpar = olddad
 
210
            yngpar = yngdad
 
211
        if (person.getGender() == RelLib.Person.female) and (person.getGender() == RelLib.Person.male):
 
212
            error.write( _("Ambiguous gender for %s.\n") % idstr )
 
213
            oldpar = olddad
 
214
            yngpar = yngdad
 
215
            
 
216
        # multiple parentage check
 
217
        if( len( person.getParentList() ) > 1 ):
 
218
            warn.write( _("Multiple parentage for %s.\n") % idstr )
 
219
 
 
220
        # marriage checks
 
221
        nkids = 0
 
222
        nfam  = len( person.getFamilyList() )
 
223
        if nfam > wedder:
 
224
            if person.getGender() == RelLib.Person.male:
 
225
                warn.write( _("Married often: %(male_name)s married %(nfam)d times.\n") % { 
 
226
                        'male_name' : idstr, 'nfam' : nfam } )
 
227
            if person.getGender() == RelLib.Person.female:
 
228
                warn.write( _("Married often: %(female_name)s married %(nfam)d times.\n") % { 
 
229
                        'female_name' : idstr, 'nfam' : nfam } )
 
230
        if ageatdeath>oldunm and nfam == 0:
 
231
            if person.getGender() == RelLib.Person.male:
 
232
                warn.write( _("Old and unmarried: %(male_name)s died unmarried, at the age of %(ageatdeath)d years.\n") % { 
 
233
                        'male_name' : idstr, 'ageatdeath' : ageatdeath } )
 
234
            if person.getGender() == RelLib.Person.female:
 
235
                warn.write( _("Old and unmarried: %(female_name)s died unmarried, at the age of %(ageatdeath)d years.\n") % { 
 
236
                        'female_name' : idstr, 'ageatdeath' : ageatdeath } )
 
237
        first_cbyear = 99999
 
238
        last_cbyear=0
 
239
        prev_cbyear=0
 
240
        prev_maryear=0
 
241
        prev_sdyear=0
 
242
        fnum = 0
 
243
        for family in person.getFamilyList():
 
244
            fnum = fnum + 1
 
245
            mother = family.getMother()
 
246
            father = family.getFather()
 
247
            if mother!=None and father!=None:
 
248
                if ( mother.getGender() == father.getGender() ) and mother.getGender() != RelLib.Person.unknown:
 
249
                    warn.write( _("Homosexual marriage: %s in family %s.\n") % ( idstr, family.getId() ) )
 
250
            if family.getFather() == person and person.getGender() == RelLib.Person.female:
 
251
                error.write( _("Female husband: %s in family %s.\n") % ( idstr, family.getId() ) )
 
252
            if family.getMother() == person and person.getGender() == RelLib.Person.male:
 
253
                error.write( _("Male wife: %s in family %s.\n") % ( idstr, family.getId() ) )
 
254
            if family.getFather() == person:
 
255
               spouse = family.getMother()
 
256
            else:
 
257
               spouse = family.getFather()
 
258
            if spouse != None:
 
259
                if person.getGender() == RelLib.Person.male and \
 
260
                       person.getPrimaryName().getSurname() == spouse.getPrimaryName().getSurname():
 
261
                    warn.write( _("Husband and wife with the same surname: %s in family %s, and %s.\n") % (
 
262
                        idstr,family.getId(), spouse.getPrimaryName().getName() ) )
 
263
                sdyear = get_year( spouse.getDeath() )
 
264
                if sdyear == 0:
 
265
                    sdyear = 0  # burial year
 
266
                maryear = get_year( family.getMarriage() )
 
267
 
 
268
                if maryear == 0 and estimate_age:   #  estimate marriage year
 
269
                    cnum=0
 
270
                    for child in family.getChildList():
 
271
                        cnum = cnum + 1
 
272
                        if maryear == 0:
 
273
                            birthyear = get_year( child.getBirth() )
 
274
                            if birthyear > 0:
 
275
                                maryear = birthyear-cnum
 
276
                
 
277
                if maryear > 0:
 
278
                    if byear > 0:
 
279
                        marage = maryear - byear
 
280
                        if marage < 0:
 
281
                            if person.getGender() == RelLib.Person.male:
 
282
                                error.write( _("Married before birth: %(male_name)s born %(byear)d, married %(maryear)d to %(spouse)s.\n") %  { 
 
283
                                        'male_name' : idstr, 'byear' : byear, 'maryear' : maryear, 'spouse' : spouse.getPrimaryName().getName() } )
 
284
                            if person.getGender() == RelLib.Person.female:
 
285
                                error.write( _("Married before birth: %(female_name)s born %(byear)d, married %(maryear)d to %(spouse)s.\n") %  { 
 
286
                                        'female_name' : idstr, 'byear' : byear, 'maryear' : maryear, 'spouse' : spouse.getPrimaryName().getName() } )
 
287
                        else:
 
288
                            if marage < yngmar:
 
289
                               if person.getGender() == RelLib.Person.male:
 
290
                                warn.write( _("Young marriage: %(male_name)s married at age %(marage)d to %(spouse)s.\n") % { 
 
291
                                        'male_name' : idstr, 'marage' : marage, 'spouse' : spouse.getPrimaryName().getName() } )
 
292
                               if person.getGender() == RelLib.Person.female:
 
293
                                warn.write( _("Young marriage: %(female_name)s married at age %(marage)d to %(spouse)s.\n") % { 
 
294
                                        'female_name' : idstr, 'marage' : marage, 'spouse' : spouse.getPrimaryName().getName() } )
 
295
                            if marage > oldmar:
 
296
                               if person.getGender() == RelLib.Person.male:
 
297
                                warn.write( _("Old marriage: %(male_name)s married at age %(marage)d to %(spouse)s.\n") % { 
 
298
                                        'male_name' : idstr, 'marage' : marage, 'spouse' : spouse.getPrimaryName().getName() } )
 
299
                               if person.getGender() == RelLib.Person.female:
 
300
                                warn.write( _("Old marriage: %(female_name)s married at age %(marage)d to %(spouse)s.\n") % { 
 
301
                                        'female_name' : idstr, 'marage' : marage, 'spouse' : spouse.getPrimaryName().getName() } )
 
302
                    if dyear>0 and maryear > dyear:
 
303
                        if person.getGender() == RelLib.Person.male:
 
304
                                error.write( _("Married after death: %(male_name)s died %(dyear)d, married %(maryear)d to %(spouse)s.\n") % { 
 
305
                                        'male_name' : idstr, 'dyear' : dyear, 'maryear' : maryear, 'spouse' : spouse.getPrimaryName().getName() } )
 
306
                        if person.getGender() == RelLib.Person.female:
 
307
                                error.write( _("Married after death: %(female_name)s died %(dyear)d, married %(maryear)d to %(spouse)s.\n") % { 
 
308
                                        'female_name' : idstr, 'dyear' : dyear, 'maryear' : maryear, 'spouse' : spouse.getPrimaryName().getName() } )
 
309
                    if prev_cbyear > maryear:
 
310
                        if person.getGender() == RelLib.Person.male:
 
311
                                warn.write( _("Marriage before birth from previous family: %(male_name)s married %(maryear)d to %(spouse)s, previous birth %(prev_cbyear)d.\n") % { 
 
312
                                        'male_name' : idstr, 'maryear' : maryear, 'spouse' : spouse.getPrimaryName().getName(), 'prev_cbyear' : prev_cbyear } )
 
313
                        if person.getGender() == RelLib.Person.female:
 
314
                                warn.write( _("Marriage before birth from previous family: %(female_name)s married %(maryear)d to %(spouse)s, previous birth %(prev_cbyear)d.\n") % { 
 
315
                                        'female_name' : idstr, 'maryear' : maryear, 'spouse' : spouse.getPrimaryName().getName(), 'prev_cbyear' : prev_cbyear } )
 
316
                    prev_maryear = maryear
 
317
                else:
 
318
                    maryear = prev_maryear
 
319
                
 
320
                if maryear>0 and prev_sdyear > 0:
 
321
                    wdwyear = maryear-prev_sdyear
 
322
                    if wdwyear > lngwdw:
 
323
                        if person.getGender() == RelLib.Person.male:
 
324
                                warn.write( _("Long widowhood: %s was a widower %d years before, family %s.\n") % (idstr, wdwyear, family.getId() ) )
 
325
                        if person.getGender() == RelLib.Person.female:
 
326
                                warn.write( _("Long widowhood: %s was a widow %d years before, family %s.\n") % (idstr, wdwyear, family.getId() ) )
 
327
                
 
328
                if fnum==nfam and dyear>0 and sdyear>0:
 
329
                    wdwyear = dyear - sdyear
 
330
                    if wdwyear > lngwdw:
 
331
                        if person.getGender() == RelLib.Person.male:
 
332
                                warn.write( _("Long widowhood: %s was a widower %d years.\n") % (idstr, wdwyear) )
 
333
                        if person.getGender() == RelLib.Person.female:
 
334
                                warn.write( _("Long widowhood: %s was a widow %d years.\n") % (idstr, wdwyear) )
 
335
 
 
336
                nkids = 0
 
337
                for child in family.getChildList():
 
338
                    nkids = nkids+1
 
339
                    cbyear = get_year( child.getBirth() )
 
340
                    if cbyear>0 and cbyear < first_cbyear:
 
341
                        first_cbyear = cbyear
 
342
                    if cbyear>last_cbyear:
 
343
                        last_cbyear = cbyear
 
344
                    # parentage checks 
 
345
                    if byear>0 and cbyear>0:
 
346
                        bage = cbyear - byear
 
347
                        if bage > oldpar:
 
348
                                if person.getGender() == RelLib.Person.male:
 
349
                                    warn.write( _("Old father: %(male_name)s at age of %(bage)d in family %(fam)s had a child %(child)s.\n") % { 
 
350
                                        'male_name' : idstr, 'bage' : bage, 'fam' : family.getId(), 'child' : child.getPrimaryName().getName() } ) 
 
351
                                if person.getGender() == RelLib.Person.female:
 
352
                                    warn.write( _("Old mother: %(female_name)s at age of %(bage)d in family %(fam)s had a child %(child)s.\n") % { 
 
353
                                        'female_name' : idstr, 'bage' : bage, 'fam' : family.getId(), 'child' : child.getPrimaryName().getName() } ) 
 
354
                        if bage < 0:
 
355
                                if person.getGender() == RelLib.Person.male:
 
356
                                        error.write( _("Unborn father: %(male_name)s born %(byear)d, in family %(fam)s had a child %(child)s born %(cbyear)d.\n") % { 
 
357
                                                'male_name' : idstr, 'byear' : byear, 'fam' : family.getId(), 'child' : child.getPrimaryName().getName(), 'cbyear' : cbyear } )
 
358
                                if person.getGender() == RelLib.Person.female:
 
359
                                        error.write( _("Unborn mother: %(female_name)s born %(byear)d, in family %(fam)s had a child %(child)s born %(cbyear)d.\n") % { 
 
360
                                                'female_name' : idstr, 'byear' : byear, 'fam' : family.getId(), 'child' : child.getPrimaryName().getName(), 'cbyear' : cbyear } )
 
361
                        else:
 
362
                                if bage < yngpar:
 
363
                                        if person.getGender() == RelLib.Person.male:
 
364
                                                warn.write( _("Young father: %(male_name)s at the age of %(bage)d in family %(fam)s had a child %(child)s.\n") % { 
 
365
                                                        'male_name' : idstr, 'bage' : bage, 'fam' : family.getId(), 'child' : child.getPrimaryName().getName() } )
 
366
                                        if person.getGender() == RelLib.Person.female:
 
367
                                                warn.write( _("Young mother: %(female_name)s at the age of %(bage)d in family %(fam)s had a child %(child)s.\n") % { 
 
368
                                                        'female_name' : idstr, 'bage' : bage, 'fam' : family.getId(), 'child' : child.getPrimaryName().getName() } )
 
369
                    if dyear>0 and cbyear>dyear:
 
370
                        if cbyear-1>dyear:
 
371
                                if person.getGender() == RelLib.Person.male:
 
372
                                        error.write( _("Dead father: %(male_name)s died %(dyear)d, but in family %(fam)s had a child %(child)s born %(cbyear)d.\n") % { 
 
373
                                                'male_name' : idstr, 'dyear' : dyear, 'fam' : family.getId(), 'child' : child.getPrimaryName().getName(), 'cbyear' : cbyear} )
 
374
                                if person.getGender() == RelLib.Person.female:
 
375
                                        error.write( _("Dead mother: %(female_name)s died %(dyear)d, but in family %(fam)s had a child %(child)s born %(cbyear)d.\n") % { 
 
376
                                                'female_name' : idstr, 'dyear' : dyear, 'fam' : family.getId(), 'child' : child.getPrimaryName().getName(), 'cbyear' : cbyear} )
 
377
                        else:
 
378
                                if person.getGender() == RelLib.Person.male:
 
379
                                        warn.write( _("Dead father: %(male_name)s died %(dyear)d, but in family %(fam)s had a child %(child)s born %(cbyear)d.\n") % { 
 
380
                                                'male_name' : idstr, 'dyear' : dyear, 'fam' : family.getId(), 'child' : child.getPrimaryName().getName(), 'cbyear' : cbyear} )
 
381
                                if person.getGender() == RelLib.Person.female:
 
382
                                        warn.write( _("Dead mother: %(female_name)s died %(dyear)d, but in family %(fam)s had a child %(child)s born %(cbyear)d.\n") % { 
 
383
                                                'female_name' : idstr, 'dyear' : dyear, 'fam' : family.getId(), 'child' : child.getPrimaryName().getName(), 'cbyear' : cbyear} )
 
384
                            
 
385
        
 
386
    text = ""
 
387
    if error != "":
 
388
        text = _("ERRORS:\n") + error.getvalue() + "\n" 
 
389
    if warn != "":
 
390
        text = _("WARNINGS:\n") + warn.getvalue()
 
391
            
 
392
    error.close()
 
393
    warn.close()
 
394
    
 
395
    verifyResult = gtk.glade.XML(glade_file,"verify_result","gramps")
 
396
    Utils.set_titles(verifyResult.get_widget('verify_result'),
 
397
                     verifyResult.get_widget('title'),
 
398
                     _('Database Verify'))
 
399
    
 
400
    verifyResult.signal_autoconnect({
 
401
        "destroy_passed_object" : Utils.destroy_passed_object,
 
402
        })
 
403
    top = verifyResult.get_widget("verify_result")
 
404
    textwindow = verifyResult.get_widget("textwindow")
 
405
    textwindow.get_buffer().set_text(text)
 
406
    top.show()
 
407
    
 
408
#-------------------------------------------------------------------------
 
409
#
 
410
#
 
411
#
 
412
#-------------------------------------------------------------------------
 
413
from Plugins import register_tool
 
414
 
 
415
register_tool(
 
416
    runTool,
 
417
    _("Verify the database"),
 
418
    category=_("Utilities"),
 
419
    description=_("Lists exceptions to assertions or checks about the database")
 
420
    )
 
421