From f15f18056b708c0696945a74d0a9ac6438f3a5f6 Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Mon, 11 Jan 2010 19:42:35 +0000 Subject: [PATCH] Some minor refinements svn: r14034 --- src/plugins/tool/CalculateEstimatedDates.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/plugins/tool/CalculateEstimatedDates.py b/src/plugins/tool/CalculateEstimatedDates.py index 464e3cd24..f88a5123c 100644 --- a/src/plugins/tool/CalculateEstimatedDates.py +++ b/src/plugins/tool/CalculateEstimatedDates.py @@ -203,6 +203,9 @@ class CalcToolManagedWindow(PluginWindows.ToolManagedWindowBatch): self.window) if not self.reselect: return + + current_date = gen.lib.Date() + current_date.set_yr_mon_day(*time.localtime(time.time())[0:3]) self.action = {} widget = self.add_results_frame(_("Select")) document = TextBufDoc(make_basic_stylesheet(), None) @@ -310,16 +313,17 @@ class CalcToolManagedWindow(PluginWindows.ToolManagedWindowBatch): ev = self.db.get_event_from_handle(birth_ref.ref) date1 = ev.get_date_object() elif not birth_ref and add_birth and date1: - add_birth_event = True - date1.make_vague() + if date1.match( current_date, "<"): + add_birth_event = True + date1.make_vague() + else: + date1 = gen.lib.Date() else: date1 = gen.lib.Date() if death_ref: ev = self.db.get_event_from_handle(death_ref.ref) date2 = ev.get_date_object() elif not death_ref and add_death and date2: - current_date = gen.lib.Date() - current_date.set_yr_mon_day(*time.localtime(time.time())[0:3]) if date2.match( current_date, "<"): add_death_event = True date2.make_vague() @@ -517,7 +521,7 @@ class CalcToolManagedWindow(PluginWindows.ToolManagedWindowBatch): # things are simple. if death_ref and death_ref.get_role().is_primary(): death = self.db.get_event_from_handle(death_ref.ref) - if death.get_date_object().get_start_date() != gen.lib.Date.EMPTY: + if death and death.get_date_object().get_start_date() != gen.lib.Date.EMPTY: death_date = death.get_date_object() # Look for Cause Of Death, Burial or Cremation events. @@ -534,7 +538,7 @@ class CalcToolManagedWindow(PluginWindows.ToolManagedWindowBatch): if not birth_date: if birth_ref and birth_ref.get_role().is_primary(): birth = self.db.get_event_from_handle(birth_ref.ref) - if birth.get_date_object().get_start_date() != gen.lib.Date.EMPTY: + if birth and birth.get_date_object().get_start_date() != gen.lib.Date.EMPTY: birth_date = birth.get_date_object() # Look for Baptism, etc events.