Some minor refinements

svn: r14034
This commit is contained in:
Doug Blank 2010-01-11 19:42:35 +00:00
parent 8c851f7506
commit f15f18056b

View File

@ -203,6 +203,9 @@ class CalcToolManagedWindow(PluginWindows.ToolManagedWindowBatch):
self.window) self.window)
if not self.reselect: if not self.reselect:
return return
current_date = gen.lib.Date()
current_date.set_yr_mon_day(*time.localtime(time.time())[0:3])
self.action = {} self.action = {}
widget = self.add_results_frame(_("Select")) widget = self.add_results_frame(_("Select"))
document = TextBufDoc(make_basic_stylesheet(), None) document = TextBufDoc(make_basic_stylesheet(), None)
@ -310,16 +313,17 @@ class CalcToolManagedWindow(PluginWindows.ToolManagedWindowBatch):
ev = self.db.get_event_from_handle(birth_ref.ref) ev = self.db.get_event_from_handle(birth_ref.ref)
date1 = ev.get_date_object() date1 = ev.get_date_object()
elif not birth_ref and add_birth and date1: elif not birth_ref and add_birth and date1:
add_birth_event = True if date1.match( current_date, "<"):
date1.make_vague() add_birth_event = True
date1.make_vague()
else:
date1 = gen.lib.Date()
else: else:
date1 = gen.lib.Date() date1 = gen.lib.Date()
if death_ref: if death_ref:
ev = self.db.get_event_from_handle(death_ref.ref) ev = self.db.get_event_from_handle(death_ref.ref)
date2 = ev.get_date_object() date2 = ev.get_date_object()
elif not death_ref and add_death and date2: 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, "<"): if date2.match( current_date, "<"):
add_death_event = True add_death_event = True
date2.make_vague() date2.make_vague()
@ -517,7 +521,7 @@ class CalcToolManagedWindow(PluginWindows.ToolManagedWindowBatch):
# things are simple. # things are simple.
if death_ref and death_ref.get_role().is_primary(): if death_ref and death_ref.get_role().is_primary():
death = self.db.get_event_from_handle(death_ref.ref) 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() death_date = death.get_date_object()
# Look for Cause Of Death, Burial or Cremation events. # Look for Cause Of Death, Burial or Cremation events.
@ -534,7 +538,7 @@ class CalcToolManagedWindow(PluginWindows.ToolManagedWindowBatch):
if not birth_date: if not birth_date:
if birth_ref and birth_ref.get_role().is_primary(): if birth_ref and birth_ref.get_role().is_primary():
birth = self.db.get_event_from_handle(birth_ref.ref) 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() birth_date = birth.get_date_object()
# Look for Baptism, etc events. # Look for Baptism, etc events.