Add progress indication to long running reports
This commit is contained in:
parent
705ae9075d
commit
076d75eba4
@ -45,6 +45,7 @@ class Report:
|
||||
def __init__(self, database, options_class, user):
|
||||
self.database = database
|
||||
self.options_class = options_class
|
||||
self._user = user
|
||||
|
||||
self.doc = options_class.get_document()
|
||||
|
||||
|
@ -193,8 +193,14 @@ class RelGraphReport(Report):
|
||||
self._db.iter_person_handles())
|
||||
|
||||
if len(person_handles) > 1:
|
||||
if self._user:
|
||||
self._user.begin_progress(_("Relationship Graph"),
|
||||
_("Generating report"),
|
||||
len(person_handles) * 2)
|
||||
self.add_persons_and_families(person_handles)
|
||||
self.add_child_links_to_families(person_handles)
|
||||
if self._user:
|
||||
self._user.end_progress()
|
||||
|
||||
def add_child_links_to_families(self, person_handles):
|
||||
"""
|
||||
@ -205,6 +211,8 @@ class RelGraphReport(Report):
|
||||
person_dict = dict([handle, 1] for handle in person_handles)
|
||||
|
||||
for person_handle in person_handles:
|
||||
if self._user:
|
||||
self._user.step_progress()
|
||||
person = self._db.get_person_from_handle(person_handle)
|
||||
p_id = person.get_gramps_id()
|
||||
for fam_handle in person.get_parent_family_handle_list():
|
||||
@ -261,6 +269,8 @@ class RelGraphReport(Report):
|
||||
# so we don't do it twice
|
||||
families_done = {}
|
||||
for person_handle in person_handles:
|
||||
if self._user:
|
||||
self._user.step_progress()
|
||||
# determine per person if we use HTML style label
|
||||
if self.includeimg:
|
||||
self.use_html_output = True
|
||||
|
@ -812,12 +812,21 @@ class IndivCompleteReport(Report):
|
||||
raise ReportError(_('Empty report'),
|
||||
_('You did not specify anybody'))
|
||||
|
||||
if self._user:
|
||||
self._user.begin_progress(_("Complete Individual Report"),
|
||||
_("Generating report"),
|
||||
len(ind_list))
|
||||
for count, person_handle in enumerate(ind_list):
|
||||
if self._user:
|
||||
self._user.step_progress()
|
||||
self.person = self._db.get_person_from_handle(person_handle)
|
||||
if self.person is None:
|
||||
continue
|
||||
self.family_notes_list = []
|
||||
self.write_person(count)
|
||||
if self._user:
|
||||
self._user.end_progress()
|
||||
|
||||
|
||||
def write_person(self, count):
|
||||
""" write a person """
|
||||
|
@ -98,7 +98,13 @@ class NoteLinkReport(Report):
|
||||
|
||||
self.doc.end_row()
|
||||
|
||||
if self._user:
|
||||
self._user.begin_progress(_("Note Link Check Report"),
|
||||
_("Generating report"),
|
||||
self.database.get_number_of_notes())
|
||||
for note in self.database.iter_notes():
|
||||
if self._user:
|
||||
self._user.step_progress()
|
||||
for (ldomain, ltype, lprop, lvalue) in note.get_links():
|
||||
if ldomain == "gramps":
|
||||
tagtype = _(ltype)
|
||||
@ -141,6 +147,8 @@ class NoteLinkReport(Report):
|
||||
self.doc.end_cell()
|
||||
|
||||
self.doc.end_row()
|
||||
if self._user:
|
||||
self._user.end_progress()
|
||||
|
||||
self.doc.end_table()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user