Esempio n. 1
0
    def write_report(self):

        if len(report_titles) > 0:
            report_titles.clear()

        if len(report_person_ref) > 0:
            report_person_ref.clear()

        self.ca = CollectAscendants(self.database, self.user, self.title)
        self.ascendants = self.ca.collect_data(self.filter, self.center_person)

        if len(self.ascendants) > 1:
            self.user.begin_progress(self.title,
                                 _('Writing %s reports...') % \
                                 (len(self.ascendants)), len(self.ascendants))

            # If there is only one item, then no need for a table
            # of contents, however if we have more than one lets generate one
            self.write_toc()

        report_count = 0
        for person_handle in self.ascendants:
            if len(self.ascendants) > 1:
                self.user.step_progress()

            person = self.database.get_person_from_handle(person_handle)

            self.doc.start_paragraph("DR-Title")
            name = self._name_display.display(person)
            if len(self.ascendants) > 1:
                report_count = report_count + 1
                report_titles[report_count] = \
                    _("%s. Descendants of %s") % (report_count, name)
            else:
                report_titles[report_count] = _("Descendants of %s") % name
            mark = IndexMark(report_titles[report_count], INDEX_TYPE_TOC, 1)
            self.doc.write_text(report_titles[report_count], mark)
            self.doc.end_paragraph()

            recurse = RecurseDown(self.max_generations, self.database,
                                self.objPrint, self._showdups, report_count)
            recurse.recurse(1, person, None)

            self.doc.page_break()


        if len(self.ascendants) > 1:
            self.user.end_progress()