~ubuntu-branches/ubuntu/utopic/gramps/utopic

« back to all changes in this revision

Viewing changes to src/plugins/tool/Verify.py

  • Committer: Package Import Robot
  • Author(s): James A. Treacy
  • Date: 2012-05-22 17:18:36 UTC
  • mfrom: (39.1.4 sid)
  • Revision ID: package-import@ubuntu.com-20120522171836-35fi62lp4w7jnrd7
Tags: 3.4.0-1
* New upstream version
* Updated desktop file. Closes: #667472

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
# Copyright (C) 2000-2007  Donald N. Allingham
5
5
# Copyright (C) 2008       Brian G. Matherly
6
6
# Copyright (C) 2010       Jakim Friant
7
 
# Copyright (C) 2011       PaulFranklin
 
7
# Copyright (C) 2011       Paul Franklin
8
8
#
9
9
# This program is free software; you can redistribute it and/or modify
10
10
# it under the terms of the GNU General Public License as published by
21
21
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
22
22
#
23
23
 
24
 
# $Id: Verify.py 17470 2011-05-11 02:42:06Z pez4brian $
 
24
# $Id: Verify.py 19450 2012-05-06 09:46:29Z m_d_n $
25
25
 
26
26
"""
27
27
A plugin to verify the data against user-adjusted tests.
81
81
_person_cache = {}
82
82
_family_cache = {}
83
83
_event_cache = {}
 
84
_today = gen.lib.date.Today().get_sort_value()
84
85
 
85
86
def find_event(db, handle):
86
87
    if handle in _event_cache:
297
298
        GrampsDisplay.help(webpage=WIKI_HELP_PAGE, section=WIKI_HELP_SEC)
298
299
 
299
300
    def on_apply_clicked(self, obj):
 
301
        run_button = self.top.get_object('button4')
 
302
        close_button = self.top.get_object('button5')
 
303
        run_button.set_sensitive(False)
 
304
        close_button.set_sensitive(False)
300
305
        for option in self.options.handler.options_dict:
301
306
            if option in ['estimate_age', 'invdate']:
302
307
                self.options.handler.options_dict[option] = \
324
329
 
325
330
        self.uistate.progress.hide()
326
331
        self.uistate.window.window.set_cursor(None)
327
 
        self.window.window.set_cursor(None)
328
332
        try:
 
333
            self.window.window.set_cursor(None)
329
334
            self.vr.window.window.set_cursor(None)
330
335
        except AttributeError:
331
336
            pass
 
337
        run_button.set_sensitive(True)
 
338
        close_button.set_sensitive(True)
332
339
        self.reset()
333
340
        
334
341
        # Save options
359
366
                BirthAfterDeath(self.db,person),
360
367
                BaptAfterBury(self.db,person),
361
368
                OldAge(self.db,person, oldage,estimate_age),
 
369
                OldAgeButNoDeath(self.db,person, oldage,estimate_age),
362
370
                UnknownGender(self.db,person),
363
371
                MultipleParents(self.db,person),
364
372
                MarriedOften(self.db,person,wedder),
521
529
    def load_ignored(self,db_filename):
522
530
        md5sum = md5(db_filename)
523
531
        self.ignores_filename = os.path.join(
524
 
            const.HOME_DIR,md5sum.hexdigest() + os.path.extsep + 'vfm')
 
532
            const.VERSION_DIR,md5sum.hexdigest() + os.path.extsep + 'vfm')
525
533
        if not self._load_ignored(self.ignores_filename):
526
534
            self.ignores = {}
527
535
 
736
744
                              "Number of years"),
737
745
            'oldunm'       : ("=num","Maximum age for an unmarried person"
738
746
                              "Number of years"),
739
 
            'estimate_age' : ("=0/1","Whether to estimate missing dates",
 
747
            'estimate_age' : ("=0/1","Whether to estimate missing or inexact dates",
740
748
                              ["Do not estimate","Estimate dates"],
741
749
                              True),
742
750
            'invdate'      : ("=0/1","Whether to check for invalid dates"
1539
1547
 
1540
1548
    def get_message(self):
1541
1549
        return _("Marriage date but not married")
 
1550
 
 
1551
class OldAgeButNoDeath(PersonRule):
 
1552
    ID = 32
 
1553
    SEVERITY = Rule.WARNING
 
1554
    def __init__(self,db,person, old_age,est):
 
1555
        PersonRule.__init__(self,db,person)
 
1556
        self.old_age = old_age
 
1557
        self.est = est
 
1558
 
 
1559
    def _get_params(self):
 
1560
        return (self.old_age,self.est)
 
1561
 
 
1562
    def broken(self):
 
1563
        birth_date = get_birth_date(self.db,self.obj,self.est)
 
1564
        dead = get_death_date(self.db,self.obj,True) # if no death use burial
 
1565
        if dead or not birth_date:
 
1566
            return 0
 
1567
        age = ( _today - birth_date ) / 365
 
1568
        return ( age > self.old_age )
 
1569
 
 
1570
    def get_message(self):
 
1571
        return _("Old age but no death")
 
1572