parent
b56032b5ab
commit
302291f107
@ -152,8 +152,8 @@ class CalcToolManagedWindow(PluginWindows.ToolManagedWindowBatch):
|
|||||||
return _("Options")
|
return _("Options")
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
self.add_results_frame()
|
self.add_results_frame(_("Results"))
|
||||||
self.results_write("Processing...\n")
|
self.results_write(_("Processing...\n"))
|
||||||
self.trans = self.db.transaction_begin("",batch=True)
|
self.trans = self.db.transaction_begin("",batch=True)
|
||||||
self.db.disable_signals()
|
self.db.disable_signals()
|
||||||
self.filter_option = self.options.menu.get_option_by_name('filter')
|
self.filter_option = self.options.menu.get_option_by_name('filter')
|
||||||
@ -171,8 +171,8 @@ class CalcToolManagedWindow(PluginWindows.ToolManagedWindowBatch):
|
|||||||
self.MAX_AGE_PROB_ALIVE = self.options.handler.options_dict['MAX_AGE_PROB_ALIVE']
|
self.MAX_AGE_PROB_ALIVE = self.options.handler.options_dict['MAX_AGE_PROB_ALIVE']
|
||||||
self.AVG_GENERATION_GAP = self.options.handler.options_dict['AVG_GENERATION_GAP']
|
self.AVG_GENERATION_GAP = self.options.handler.options_dict['AVG_GENERATION_GAP']
|
||||||
if remove_old:
|
if remove_old:
|
||||||
self.results_write("Replacing...\n")
|
self.results_write(_("Replacing...\n"))
|
||||||
self.progress.set_pass(_("Removing '%s'..." % source_text),
|
self.progress.set_pass((_("Removing '%s'...") % source_text),
|
||||||
len(people))
|
len(people))
|
||||||
for person_handle in people:
|
for person_handle in people:
|
||||||
self.progress.step()
|
self.progress.step()
|
||||||
@ -213,7 +213,7 @@ class CalcToolManagedWindow(PluginWindows.ToolManagedWindowBatch):
|
|||||||
if pupdate == 1:
|
if pupdate == 1:
|
||||||
self.db.commit_person(person, self.trans)
|
self.db.commit_person(person, self.trans)
|
||||||
if add_birth or add_death:
|
if add_birth or add_death:
|
||||||
self.results_write("Calculating...\n")
|
self.results_write(_("Calculating...\n"))
|
||||||
self.progress.set_pass(_('Calculating estimated dates...'),
|
self.progress.set_pass(_('Calculating estimated dates...'),
|
||||||
len(people))
|
len(people))
|
||||||
source = self.get_or_create_source(source_text)
|
source = self.get_or_create_source(source_text)
|
||||||
@ -228,7 +228,7 @@ class CalcToolManagedWindow(PluginWindows.ToolManagedWindowBatch):
|
|||||||
#print date1, date2
|
#print date1, date2
|
||||||
if not birth_ref and add_birth and date1:
|
if not birth_ref and add_birth and date1:
|
||||||
#print "added birth"
|
#print "added birth"
|
||||||
birth = self.create_event("Estimated birth date",
|
birth = self.create_event(_("Estimated birth date"),
|
||||||
gen.lib.EventType.BIRTH,
|
gen.lib.EventType.BIRTH,
|
||||||
date1, source)
|
date1, source)
|
||||||
event_ref = gen.lib.EventRef()
|
event_ref = gen.lib.EventRef()
|
||||||
@ -244,7 +244,7 @@ class CalcToolManagedWindow(PluginWindows.ToolManagedWindowBatch):
|
|||||||
pass # FIXME: sometimes adds one in future?
|
pass # FIXME: sometimes adds one in future?
|
||||||
else:
|
else:
|
||||||
#print "added death"
|
#print "added death"
|
||||||
death = self.create_event("Estimated death date",
|
death = self.create_event(_("Estimated death date"),
|
||||||
gen.lib.EventType.DEATH,
|
gen.lib.EventType.DEATH,
|
||||||
date2, source)
|
date2, source)
|
||||||
event_ref = gen.lib.EventRef()
|
event_ref = gen.lib.EventRef()
|
||||||
@ -256,14 +256,14 @@ class CalcToolManagedWindow(PluginWindows.ToolManagedWindowBatch):
|
|||||||
self.results_write_link(name_displayer.display(person),
|
self.results_write_link(name_displayer.display(person),
|
||||||
person, person_handle)
|
person, person_handle)
|
||||||
if added_birth:
|
if added_birth:
|
||||||
self.results_write(" added birth on %s" % date1)
|
self.results_write(_(" added birth on %s") % date1)
|
||||||
if added_death:
|
if added_death:
|
||||||
self.results_write(" added death on %s" % date2)
|
self.results_write(_(" added death on %s") % date2)
|
||||||
self.results_write("\n")
|
self.results_write("\n")
|
||||||
self.db.transaction_commit(self.trans, _("Calculate date estimates"))
|
self.db.transaction_commit(self.trans, _("Calculate date estimates"))
|
||||||
self.db.enable_signals()
|
self.db.enable_signals()
|
||||||
self.db.request_rebuild()
|
self.db.request_rebuild()
|
||||||
self.results_write("Done!\n")
|
self.results_write(_("Done!\n"))
|
||||||
|
|
||||||
def get_or_create_source(self, source_text):
|
def get_or_create_source(self, source_text):
|
||||||
source_list = self.db.get_source_handles()
|
source_list = self.db.get_source_handles()
|
||||||
@ -276,7 +276,7 @@ class CalcToolManagedWindow(PluginWindows.ToolManagedWindowBatch):
|
|||||||
self.db.add_source(source, self.trans)
|
self.db.add_source(source, self.trans)
|
||||||
return source
|
return source
|
||||||
|
|
||||||
def create_event(self, description="Estimated date",
|
def create_event(self, description=_("Estimated date"),
|
||||||
type=None, date=None, source=None):
|
type=None, date=None, source=None):
|
||||||
event = gen.lib.Event()
|
event = gen.lib.Event()
|
||||||
event.set_description(description)
|
event.set_description(description)
|
||||||
|
Loading…
Reference in New Issue
Block a user