Ejemplo n.º 1
0
    def write_report(self):
        """
        Overridden function to generate the report.
        """
        self.doc.start_paragraph("SR-Title")
        title = self._("Database Summary Report")
        mark = IndexMark(title, INDEX_TYPE_TOC, 1)
        self.doc.write_text(title, mark)
        self.doc.end_paragraph()

        self.doc.start_paragraph("SR-Normal")
        self.doc.write_text(
            self._("Date: %s") % f"{datetime.datetime.now(): %d.%m.%Y}")
        self.doc.end_paragraph()

        self.summarize_people()
        self.summarize_families()
        self.summarize_media()
Ejemplo n.º 2
0
    def write_report(self):
        """
        The routine the actually creates the report. At this point, the document
        is opened and ready for writing.
        """

        # Write the title line. Set in INDEX marker so that this section will be
        # identified as a major category if this is included in a Book report.

        if not self.inc_privat:
            self.database = gramps.gen.proxy.PrivateProxyDb(self.database)

        title = self._('Repositories Report')
        mark = IndexMark(title, INDEX_TYPE_TOC, 1)
        self.doc.start_paragraph('REPO-ReportTitle')
        self.doc.write_text(title, mark)
        self.doc.end_paragraph()
        self.__write_all_repositories()
Ejemplo n.º 3
0
    def write_report(self):
        "output the selected statistics..."

        mark = IndexMark(self._('Statistics Charts'), INDEX_TYPE_TOC, 1)
        self._user.begin_progress(_('Statistics Charts'),
                                  _('Saving charts...'), len(self.data))
        for data in sorted(self.data):
            self.doc.start_page()
            if mark:
                self.doc.draw_text('SC-title', '', 0, 0, mark)  # put it in TOC
                mark = None  # crock, but we only want one of them
            if len(data[3]) < self.bar_items:
                self.output_piechart(*data[:4])
            else:
                self.output_barchart(*data[:4])
            self.doc.end_page()
            self._user.step_progress()
        self._user.end_progress()
Ejemplo n.º 4
0
    def write_report(self):
        """
        The routine that actually creates the report.
        At this point, the document is opened and ready for writing.
        """

        # Write the title line. Set in INDEX marker so that this section will be
        # identified as a major category if this is included in a Book report.

        pl_format = self.pl_format
        title = self._("PlaceFamily Report")
        mark = IndexMark(title, INDEX_TYPE_TOC, 1)        
        self.doc.start_paragraph("PLC-ReportTitle")
        self.doc.write_text(title, mark)
        self.doc.end_paragraph()

        self.__write_all_places(pl_format)
        self.__write_referenced_families(pl_format)
Ejemplo n.º 5
0
 def draw_title(self, toc):
     """
     Draws the title for the page.
     """
     width = self.doc.get_usable_width()
     title_one = self._("Timeline Chart")
     title_two = "%(str1)s -- %(str2)s" % {
         'str1': self.filter.get_name(self._locale),
         # feature request 2356: avoid genitive form
         'str2': self._("Sorted by %s") % self.sort_name
     }
     mark = None
     if toc:
         mark = IndexMark(title_one, INDEX_TYPE_TOC, 1)
     self.doc.center_text('TLG-title', title_one, width / 2.0, 0, mark)
     style_sheet = self.doc.get_style_sheet()
     title_font = style_sheet.get_paragraph_style('TLG-Title').get_font()
     title_y = 1.2 - (pt2cm(title_font.get_size()) * 1.2)
     self.doc.center_text('TLG-title', title_two, width / 2.0, title_y)
Ejemplo n.º 6
0
    def write_report(self):
        """
        The routine that actually creates the report.
        At this point, the document is opened and ready for writing.
        """

        # Write the title line. Set in INDEX marker so that this section will be
        # identified as a major category if this is included in a Book report.

        title = self._("Ledigenquote und Verheiratetenanteile ")
        mark = IndexMark(title, INDEX_TYPE_TOC, 1)
        self.doc.start_paragraph("PLC-ReportTitle")
        self.doc.write_text(title, mark)
        self.doc.end_paragraph()

        self.doc.start_paragraph("PLC-Section")
        self.doc.write_text(
            "Enthält alle Personen, die in diesem Ort geboren oder getauft wurden"
        )
        self.doc.end_paragraph()
        self.doc.start_table("LEQUODETTable", "SRC-LEQUODETTable")
        column_titles = [
            _("person"),
            _("name"),
            _("ID"),
            _("m/w"),
            _("birth"),
            _("death"), ("marriage"),
            _("place")
        ]
        i = 0
        self.doc.start_row()
        for title in column_titles:
            self.doc.start_cell("SRC-TableColumn")
            self.doc.start_paragraph("SRC-ColumnTitle")
            self.doc.write_text(title)
            self.doc.end_paragraph()
            self.doc.end_cell()
        self.doc.end_row()

        self.__write_data()

        self.doc.end_table()
Ejemplo n.º 7
0
    def write_report(self):
        """
        Overridden function to generate the report.
        """
        self.doc.start_paragraph("SR-Title")
        title = self._("Database Summary Report")
        mark = IndexMark(title, INDEX_TYPE_TOC, 1)
        self.doc.write_text(title, mark)
        self.doc.end_paragraph()

        self.summarize_people()
        self.summarize_families()
        self.summarize_events()
        self.summarize_places()
        self.summarize_sources()
        self.summarize_citations()
        self.summarize_repositories()
        self.summarize_media()
        self.summarize_notes()
Ejemplo n.º 8
0
    def write_report(self):
        """
        The routine that actually creates the report.
        At this point, the document is opened and ready for writing.
        """

        # Write the title line. Set in INDEX marker so that this section will be
        # identified as a major category if this is included in a Book report.

        title = self._("Place Report")
        mark = IndexMark(title, INDEX_TYPE_TOC, 1)
        self.doc.start_paragraph("PLC-ReportTitle")
        self.doc.write_text(title, mark)
        self.doc.end_paragraph()
        if self._lv != LivingProxyDb.MODE_INCLUDE_ALL:
            self.doc.start_paragraph("PLC-ReportSubtitle")
            self.doc.write_text(self.living_desc)
            self.doc.end_paragraph()
        self.__write_all_places()
Ejemplo n.º 9
0
    def write_report(self):
        """
        The routine the actually creates the report. At this point, the
        document is opened and ready for writing.
        """

        # Create progress meter bar
        with self.user.progress(_("Liste Eclair"), _("Generating report"),
                                len(self.place_handles)) as self.step:

            # Write the title line. Set in INDEX marker so that this section
            # will be identified as a major category if this is included in a
            # Book report.

            title = _("Liste Eclair")
            mark = IndexMark(title, INDEX_TYPE_TOC, 1)
            self.doc.start_paragraph("Eclair-ReportTitle")
            self.doc.write_text(title, mark)
            self.doc.end_paragraph()
            self.__write_all_places()
Ejemplo n.º 10
0
    def output_piechart(self, title1, typename, data, lookup):

        # set layout variables
        middle_w = self.doc.get_usable_width() / 2
        middle_h = self.doc.get_usable_height() / 2
        middle = min(middle_w, middle_h)

        # start output
        style_sheet = self.doc.get_style_sheet()
        pstyle = style_sheet.get_paragraph_style('SC-Title')
        mark = IndexMark(title1, INDEX_TYPE_TOC, 2)
        self.doc.center_text('SC-title', title1, middle_w, 0, mark)
        yoffset = utils.pt2cm(pstyle.get_font().get_size())
        self.doc.center_text('SC-title', self.fil_name, middle_w, yoffset)
        yoffset = 2 * utils.pt2cm(pstyle.get_font().get_size())
        self.doc.center_text('SC-title', self.living_desc, middle_w, yoffset)

        # collect data for output
        color = 0
        chart_data = []
        for key in lookup:
            style = "SC-color-%d" % color
            text = "%s (%d)" % (self._(key), data[key])
            # graphics style, value, and it's label
            chart_data.append((style, data[key], text))
            color = (color+1) % 7    # There are only 7 color styles defined

        margin = 1.0
        legendx = 2.0

        # output data...
        radius = middle - 2*margin
        yoffset += margin + radius
        draw_pie_chart(self.doc, middle_w, yoffset, radius, chart_data, -90)
        yoffset += radius + 2*margin
        if middle == middle_h:   # Landscape
            legendx = 1.0
            yoffset = margin

        text = self._("%s (persons):") % self._(typename)
        draw_legend(self.doc, legendx, yoffset, chart_data, text, 'SC-legend')
Ejemplo n.º 11
0
    def write_report(self):
        self.doc.start_paragraph("TR-Title")
        # feature request 2356: avoid genitive form
        title = self._("Tag Report for %s Items") % self.tag
        mark = IndexMark(title, INDEX_TYPE_TOC, 1)
        self.doc.write_text(title, mark)
        self.doc.end_paragraph()
        if self._lv != LivingProxyDb.MODE_INCLUDE_ALL:
            self.doc.start_paragraph("TR-ReportSubtitle")
            self.doc.write_text(self.living_desc)
            self.doc.end_paragraph()

        self.write_people()
        self.write_families()
        self.write_events()
        self.write_places()
        self.write_notes()
        self.write_media()
        self.write_repositories()
        self.write_sources()
        self.write_citations()
Ejemplo n.º 12
0
    def write_report(self):
        """
        The routine the actually creates the report. At this point, the document
        is opened and ready for writing.
        """

        # Title
        name = name_displayer.display_formal(self.person)
        title = _("Census Report for %s") % name
        mark = IndexMark(title, INDEX_TYPE_TOC, 1)        
        self.doc.start_paragraph("CEN-Title")
        self.doc.write_text(title, mark)
        self.doc.end_paragraph()

        self.first_page = True
        if self.report_type in (TYPE_ALL, TYPE_SOURCE):
            for handle in self.database.get_event_handles():
                self.check_event(handle)
        else:
            for event_ref in self.person.get_event_ref_list():
                self.check_event(event_ref.ref)
Ejemplo n.º 13
0
    def write_report(self):
        """
        The routine the actually creates the report. At this point, the document
        is opened and ready for writing.
        """

        # Create progress meter bar
        self.progress = ProgressMeter(_("Liste Eclair"), '')

        # Write the title line. Set in INDEX marker so that this section will be
        # identified as a major category if this is included in a Book report.

        title = _("Liste Eclair")
        mark = IndexMark(title, INDEX_TYPE_TOC, 1)
        self.doc.start_paragraph("Eclair-ReportTitle")
        self.doc.write_text(title, mark)
        self.doc.end_paragraph()
        self.__write_all_places()

        # Close the progress meter
        self.progress.close()
Ejemplo n.º 14
0
 def draw_title(self, toc):
     """
     Draws the title for the page.
     """
     width = self.doc.get_usable_width()
     # feature request 2356: avoid genitive form
     # FIXME the %(author)s was chosen because it already existed in the
     # gramps.pot file (in a "string freeze") so should probably be changed
     # FIXME this concatenation will fail for RTL languages
     title_two = (self._("Created for %(author)s") % {
         'author': self.filter.get_name()
     } + ' -- ' + self._("Sorted by %s") % self.sort_name)
     # feature request 2356: avoid genitive form
     title_one = self._("Timeline Chart")
     # FIXME the "Timeline Chart" was chosen because it already existed in
     # the gramps.pot file (in a "string freeze"); make it "Timeline Graph"
     if self._lang == 'default':
         title = title_one + "\n" + title_two
     else:
         title = title_one  # FIXME
         # The only way which I thought of to get a desired non-English
         # filter name if the starting UI is a non-English one, was to
         # change ReportUtils.get_person_filters so that it creates the
         # filters with English (untranslated) names, but that would mean
         # changing every filter.get_name() in every place that the
         # get_person_filters filters are used, to always translate the
         # get_name, and I wasn't in the mood to do that to all of them,
         # so until that happen -- assuming it works, since I didn't try
         # it to see, since the person's name will be in get_person_filters
         # but the deferred translation will be where the filter.get_name()
         # is, so it might not work at all -- but until it does, or another
         # way is found, there will be no translated subtitle, only a
         # subtitle if the report's output is in the main/UI language
     mark = None
     if toc:
         mark = IndexMark(title, INDEX_TYPE_TOC, 1)
     self.doc.center_text('TLG-title', title, width / 2.0, 0, mark)
Ejemplo n.º 15
0
    def write_sources(self):
        """ write the sources associated with the tag """
        slist = self.database.get_source_handles(sort_handles=True,
                                                 locale=self._locale)
        filter_class = GenericFilterFactory('Source')
        a_filter = filter_class()
        a_filter.add_rule(rules.source.HasTag([self.tag]))
        source_list = a_filter.apply(self.database, slist)

        if not source_list:
            return

        self.doc.start_paragraph("TR-Heading")
        header = self._("Source")
        mark = IndexMark(header, INDEX_TYPE_TOC, 2)
        self.doc.write_text(header, mark)
        self.doc.end_paragraph()

        self.doc.start_table('SourceTable', 'TR-Table')

        self.doc.start_row()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Id"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Title"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Author"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Publication Information"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.end_row()

        for source_handle in source_list:
            source = self.database.get_source_from_handle(source_handle)

            self.doc.start_row()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            self.doc.write_text(source.get_gramps_id())
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            self.doc.write_text(source.get_title())
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            self.doc.write_text(source.get_author())
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            self.doc.write_text(source.get_publication_info())
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.end_row()

        self.doc.end_table()
Ejemplo n.º 16
0
    def write_repositories(self):
        """ write the repositories associated with the tag """
        rlist = self.database.get_repository_handles()
        filter_class = GenericFilterFactory('Repository')
        a_filter = filter_class()
        a_filter.add_rule(rules.repository.HasTag([self.tag]))
        repo_list = a_filter.apply(self.database, rlist)

        if not repo_list:
            return

        self.doc.start_paragraph("TR-Heading")
        header = self._("Repositories")
        mark = IndexMark(header, INDEX_TYPE_TOC, 2)
        self.doc.write_text(header, mark)
        self.doc.end_paragraph()

        self.doc.start_table('ReopTable', 'TR-Table')

        self.doc.start_row()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Id"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Name"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Type"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Email Address"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.end_row()

        for repo_handle in repo_list:
            repo = self.database.get_repository_from_handle(repo_handle)

            self.doc.start_row()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            self.doc.write_text(repo.get_gramps_id())
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            self.doc.write_text(repo.get_name())
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            self.doc.write_text(str(repo.get_type()))
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            home_page = ''
            for url in repo.get_url_list():
                if url.get_type() == UrlType.EMAIL:
                    home_page = url.get_path()
                    break
            self.doc.write_text(home_page)
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.end_row()

        self.doc.end_table()
Ejemplo n.º 17
0
    def write_media(self):
        """ write the media associated with the tag """
        mlist = self.database.get_media_handles(sort_handles=True,
                                                locale=self._locale)
        filter_class = GenericFilterFactory('Media')
        a_filter = filter_class()
        a_filter.add_rule(rules.media.HasTag([self.tag]))
        media_list = a_filter.apply(self.database, mlist)

        if not media_list:
            return

        self.doc.start_paragraph("TR-Heading")
        header = self._("Media")
        mark = IndexMark(header, INDEX_TYPE_TOC, 2)
        self.doc.write_text(header, mark)
        self.doc.end_paragraph()

        self.doc.start_table('MediaTable', 'TR-Table')

        self.doc.start_row()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Id"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Title"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Type"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Date"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.end_row()

        for media_handle in media_list:
            media = self.database.get_media_from_handle(media_handle)

            self.doc.start_row()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            self.doc.write_text(media.get_gramps_id())
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            title = media.get_description()
            self.doc.write_text(str(title))
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            mime_type = media.get_mime_type()
            self.doc.write_text(str(mime_type))
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            date = self._get_date(media.get_date_object())
            if date:
                self.doc.write_text(date)
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.end_row()

        self.doc.end_table()
Ejemplo n.º 18
0
    def write_notes(self):
        """ write the notes associated with the tag """
        nlist = self.database.get_note_handles()
        filter_class = GenericFilterFactory('Note')
        a_filter = filter_class()
        a_filter.add_rule(rules.note.HasTag([self.tag]))
        note_list = a_filter.apply(self.database, nlist)

        if not note_list:
            return

        self.doc.start_paragraph("TR-Heading")
        header = self._("Notes")
        mark = IndexMark(header, INDEX_TYPE_TOC, 2)
        self.doc.write_text(header, mark)
        self.doc.end_paragraph()

        self.doc.start_table('NoteTable', 'TR-Table')

        self.doc.start_row()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Id"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Type"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.start_cell('TR-TableCell', 2)
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Text"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.end_row()

        for note_handle in note_list:
            note = self.database.get_note_from_handle(note_handle)

            self.doc.start_row()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            self.doc.write_text(note.get_gramps_id())
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            note_type = note.get_type()
            self.doc.write_text(str(note_type))
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.start_cell('TR-TableCell', 2)
            self.doc.write_styled_note(
                note.get_styledtext(), note.get_format(), 'TR-Note',
                contains_html=((note.get_type() == NoteType.HTML_CODE)))
            self.doc.end_cell()

            self.doc.end_row()

        self.doc.end_table()
Ejemplo n.º 19
0
    def write_places(self):
        """ write the places associated with the tag """
        plist = self.database.get_place_handles()
        filter_class = GenericFilterFactory('Place')
        a_filter = filter_class()
        a_filter.add_rule(rules.place.HasTag([self.tag]))
        place_list = a_filter.apply(self.database, plist)

        if not place_list:
            return

        self.doc.start_paragraph("TR-Heading")
        header = self._("Places")
        mark = IndexMark(header, INDEX_TYPE_TOC, 2)
        self.doc.write_text(header, mark)
        self.doc.end_paragraph()

        self.doc.start_table('PlaceTable', 'TR-Table')

        self.doc.start_row()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Id"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Title"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Name"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Type"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.end_row()

        for place_handle in place_list:
            place = self.database.get_place_from_handle(place_handle)
            place_title = _pd.display(self.database, place)

            self.doc.start_row()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            self.doc.write_text(place.get_gramps_id())
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            self.doc.write_text(place_title)
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            self.doc.write_text(place.get_name().get_value())
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            self.doc.write_text(str(place.get_type()))
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.end_row()

        self.doc.end_table()
Ejemplo n.º 20
0
    def write_events(self):
        """ write the events associated with the tag """
        elist = self.database.get_event_handles()
        filter_class = GenericFilterFactory('Event')
        a_filter = filter_class()
        a_filter.add_rule(rules.event.HasTag([self.tag]))
        event_list = a_filter.apply(self.database, elist)

        if not event_list:
            return

        self.doc.start_paragraph("TR-Heading")
        header = self._("Events")
        mark = IndexMark(header, INDEX_TYPE_TOC, 2)
        self.doc.write_text(header, mark)
        self.doc.end_paragraph()

        self.doc.start_table('EventTable', 'TR-Table')

        self.doc.start_row()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Id"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Type"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Participants"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Date"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.end_row()

        for event_handle in event_list:
            event = self.database.get_event_from_handle(event_handle)

            self.doc.start_row()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            self.doc.write_text(event.get_gramps_id())
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            self.doc.write_text(self._(self._get_type(event.get_type())))
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            self.doc.write_text(get_participant_from_event(self.database,
                                                           event_handle))
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            date = self._get_date(event.get_date_object())
            if date:
                self.doc.write_text(date)
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.end_row()

        self.doc.end_table()
Ejemplo n.º 21
0
    def write_families(self):
        """ write the families associated with the tag """
        flist = self.database.iter_family_handles()
        filter_class = GenericFilterFactory('Family')
        a_filter = filter_class()
        a_filter.add_rule(rules.family.HasTag([self.tag]))
        fam_list = a_filter.apply(self.database, flist)

        if not fam_list:
            return

        self.doc.start_paragraph("TR-Heading")
        header = self._("Families")
        mark = IndexMark(header, INDEX_TYPE_TOC, 2)
        self.doc.write_text(header, mark)
        self.doc.end_paragraph()

        self.doc.start_table('FamilyTable', 'TR-Table')

        self.doc.start_row()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Id"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Father"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Mother"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Relationship"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.end_row()

        for family_handle in fam_list:
            family = self.database.get_family_from_handle(family_handle)

            self.doc.start_row()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            self.doc.write_text(family.get_gramps_id())
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            father_handle = family.get_father_handle()
            if father_handle:
                father = self.database.get_person_from_handle(father_handle)
                mark = utils.get_person_mark(self.database, father)
                self.doc.write_text(self._name_display.display(father), mark)
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            mother_handle = family.get_mother_handle()
            if mother_handle:
                mother = self.database.get_person_from_handle(mother_handle)
                mark = utils.get_person_mark(self.database, mother)
                self.doc.write_text(self._name_display.display(mother), mark)
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            relation = family.get_relationship()
            self.doc.write_text(str(relation))
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.end_row()

        self.doc.end_table()
Ejemplo n.º 22
0
    def write_people(self):
        """ write the people associated with the tag """
        plist = self.database.iter_person_handles()
        filter_class = GenericFilterFactory('Person')
        a_filter = filter_class()
        a_filter.add_rule(rules.person.HasTag([self.tag]))
        ind_list = a_filter.apply(self.database, plist)

        if not ind_list:
            return

        self.doc.start_paragraph("TR-Heading")
        header = self._("People")
        mark = IndexMark(header, INDEX_TYPE_TOC, 2)
        self.doc.write_text(header, mark)
        self.doc.end_paragraph()

        self.doc.start_table('PeopleTable', 'TR-Table')

        self.doc.start_row()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Id"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Name"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Birth"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Death"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.end_row()

        for person_handle in ind_list:
            person = self.database.get_person_from_handle(person_handle)

            self.doc.start_row()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            self.doc.write_text(person.get_gramps_id())
            self.doc.end_paragraph()
            self.doc.end_cell()

            name = self._name_display.display(person)
            mark = utils.get_person_mark(self.database, person)
            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            self.doc.write_text(name, mark)
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            birth_ref = person.get_birth_ref()
            if birth_ref:
                event = self.database.get_event_from_handle(birth_ref.ref)
                self.doc.write_text(self._get_date(event.get_date_object()))
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            death_ref = person.get_death_ref()
            if death_ref:
                event = self.database.get_event_from_handle(death_ref.ref)
                self.doc.write_text(self._get_date(event.get_date_object()))
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.end_row()

        self.doc.end_table()
Ejemplo n.º 23
0
    def write_report(self):
        """
        The routine the actually creates the report. At this point, the document
        is opened and ready for writing.
        """

        # Call apply_filter to build the self.map array of people in the
        # database that match the ancestry.

        self.apply_filter(self.center_person.get_handle(), 1)

        # Write the title line. Set in INDEX marker so that this section will be
        # identified as a major category if this is included in a Book report.

        name = self._name_display.display_formal(self.center_person)
        # feature request 2356: avoid genitive form
        title = self._("Ahnentafel Report for %s") % name
        mark = IndexMark(title, INDEX_TYPE_TOC, 1)
        self.doc.start_paragraph("AHN-Title")
        self.doc.write_text(title, mark)
        self.doc.end_paragraph()

        # get the entries out of the map, and sort them.

        generation = 0

        for key in sorted(self.map):

            # check the index number to see if we need to start a new generation
            if generation == log2(key):

                # generate a page break if requested
                if self.pgbrk and generation > 0:
                    self.doc.page_break()
                generation += 1

                # Create the Generation title, set an index marker
                gen_text = self._("Generation %d") % generation
                mark = None  # don't need any with no page breaks
                if self.pgbrk:
                    mark = IndexMark(gen_text, INDEX_TYPE_TOC, 2)
                self.doc.start_paragraph("AHN-Generation")
                self.doc.write_text(gen_text, mark)
                self.doc.end_paragraph()

            # Build the entry

            self.doc.start_paragraph("AHN-Entry", "%d." % key)
            person = self.database.get_person_from_handle(self.map[key])
            if person is None:
                continue
            name = self._name_display.display(person)
            mark = utils.get_person_mark(self.database, person)

            # write the name in bold
            self.doc.start_bold()
            self.doc.write_text(name.strip(), mark)
            self.doc.end_bold()

            # terminate with a period if it is not already terminated.
            # This can happen if the person's name ends with something 'Jr.'
            if name[-1:] == '.':
                self.doc.write_text(" ")
            else:
                self.doc.write_text(". ")

            # Add a line break if requested (not implemented yet)
            if self.opt_namebrk:
                self.doc.write_text('\n')

            self.__narrator.set_subject(person)
            self.doc.write_text(self.__narrator.get_born_string())
            self.doc.write_text(self.__narrator.get_baptised_string())
            self.doc.write_text(self.__narrator.get_christened_string())
            self.doc.write_text(self.__narrator.get_died_string())
            self.doc.write_text(self.__narrator.get_buried_string())

            self.doc.end_paragraph()
Ejemplo n.º 24
0
    def write_report(self):
        self.doc.start_page()

        self.apply_filter(self.center_person.get_handle(), 1)
        p_rn = self.center_person.get_primary_name().get_regular_name()

        if self.circle == FULL_CIRCLE:
            max_angle = 360.0
            start_angle = 90
            max_circular = 5
            _x_ = self.doc.get_usable_width() / 2.0
            _y_ = self.doc.get_usable_height() / 2.0
            min_xy = min(_x_, _y_)

        elif self.circle == HALF_CIRCLE:
            max_angle = 180.0
            start_angle = 180
            max_circular = 3
            _x_ = (self.doc.get_usable_width()/2.0)
            _y_ = self.doc.get_usable_height()
            min_xy = min(_x_, _y_)

        else:  # quarter circle
            max_angle = 90.0
            start_angle = 270
            max_circular = 2
            _x_ = 0
            _y_ = self.doc.get_usable_height()
            min_xy = min(self.doc.get_usable_width(), _y_)

        # choose  one line or two lines translation according to the width
        title = self._("%(generations)d Generation Fan Chart "
                       "for %(person)s") % {
                           'generations' : self.max_generations,
                           'person' : p_rn}
        title_nb_lines = 1
        style_sheet = self.doc.get_style_sheet()
        if style_sheet:
            p_style = style_sheet.get_paragraph_style('FC-Title')
            if p_style:
                font = p_style.get_font()
                if font:
                    title_width = utils.pt2cm(self.doc.string_width(font,
                                                                    title))
                    if title_width > self.doc.get_usable_width():
                        title = self._(
                            "%(generations)d Generation Fan Chart "
                            "for\n%(person)s") % {
                                'generations' : self.max_generations,
                                'person' : p_rn}
                        title_nb_lines = 2

        if self.circle == FULL_CIRCLE or self.circle == QUAR_CIRCLE:
            # adjust only if full circle or 1/4 circle in landscape mode
            if self.doc.get_usable_height() <= self.doc.get_usable_width():
                # Should be in Landscape now
                style_sheet = self.doc.get_style_sheet()
                p_style = style_sheet.get_paragraph_style('FC-Title')
                if p_style:
                    font = p_style.get_font()
                    if font:
                        fontsize = utils.pt2cm(font.get_size())
                        # _y_ is vertical distance to center of circle,
                        # move center down 1 fontsize
                        _y_ += fontsize*title_nb_lines
                        # min_XY is the diameter of the circle,
                        # subtract two fontsize
                        # so we dont draw outside bottom of the paper
                        min_xy = min(min_xy, _y_ - 2*fontsize*title_nb_lines)
        if self.max_generations > max_circular:
            block_size = min_xy / (self.max_generations * 2 - max_circular)
        else:
            block_size = min_xy / self.max_generations

        # adaptation of the fonts (title and others)
        optimized_style_sheet = self.get_optimized_style_sheet(
            title, max_circular, block_size, self.same_style,
            not self.same_style,
            # if same_style, use default generated colors
            self.background == BACKGROUND_WHITE)

        if optimized_style_sheet:
            self.doc.set_style_sheet(optimized_style_sheet)

        # title
        mark = IndexMark(title, INDEX_TYPE_TOC, 1)
        self.doc.center_text('FC-Graphic-title', title,
                             self.doc.get_usable_width() / 2, 0, mark)
        # wheel
        for generation in range(0, min(max_circular, self.max_generations)):
            self.draw_circular(_x_, _y_,
                               start_angle, max_angle, block_size, generation)
        for generation in range(max_circular, self.max_generations):
            self.draw_radial(_x_, _y_,
                             start_angle, max_angle, block_size, generation)
        self.doc.end_page()
Ejemplo n.º 25
0
    def write_citations(self):
        """ write the citations associated with the tag """
        clist = self.database.get_citation_handles(sort_handles=True,
                                                   locale=self._locale)
        filter_class = GenericFilterFactory('Citation')
        a_filter = filter_class()
        a_filter.add_rule(rules.citation.HasTag([self.tag]))
        citation_list = a_filter.apply(self.database, clist)

        if not citation_list:
            return

        self.doc.start_paragraph("TR-Heading")
        header = self._("Citations")
        mark = IndexMark(header, INDEX_TYPE_TOC, 2)
        self.doc.write_text(header, mark)
        self.doc.end_paragraph()

        self.doc.start_table('CitationTable', 'TR-Table')

        self.doc.start_row()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Id"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Volume/Page"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Date"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.start_cell('TR-TableCell')
        self.doc.start_paragraph('TR-Normal-Bold')
        self.doc.write_text(self._("Source"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.end_row()

        for citation_handle in citation_list:
            citation = self.database.get_citation_from_handle(citation_handle)

            self.doc.start_row()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            self.doc.write_text(citation.get_gramps_id())
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            self.doc.write_text(citation.get_page())
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            date = self._get_date(citation.get_date_object())
            if date:
                self.doc.write_text(date)
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.start_cell('TR-TableCell')
            self.doc.start_paragraph('TR-Normal')
            source_handle = citation.get_reference_handle()
            source = self.database.get_source_from_handle(source_handle)
            self.doc.write_text(source.get_title())
            self.doc.end_paragraph()
            self.doc.end_cell()

            self.doc.end_row()

        self.doc.end_table()
Ejemplo n.º 26
0
    def print_page(self, month):
        """
        This method actually writes the calendar page.
        """
        style_sheet = self.doc.get_style_sheet()
        ptitle = style_sheet.get_paragraph_style("CAL-Title")
        ptext = style_sheet.get_paragraph_style("CAL-Text")
        pdaynames = style_sheet.get_paragraph_style("CAL-Daynames")
        pnumbers = style_sheet.get_paragraph_style("CAL-Numbers")
        numpos = pt2cm(pnumbers.get_font().get_size())
        ptext1style = style_sheet.get_paragraph_style("CAL-Text1style")
        long_days = self._ldd.long_days

        self.doc.start_page()
        width = self.doc.get_usable_width()
        height = self.doc.get_usable_height()
        header = 2.54  # one inch
        mark = None
        if month == 1:
            mark = IndexMark(self._('Calendar Report'), INDEX_TYPE_TOC, 1)
        self.draw_rectangle("CAL-Border", 0, 0, width, height)
        self.doc.draw_box("CAL-Title", "", 0, 0, width, header, mark)
        self.doc.draw_line("CAL-Border", 0, header, width, header)
        year = self.year
        # TRANSLATORS: see
        # http://gramps-project.org/wiki/index.php?title=Translating_Gramps#Translating_dates
        # to learn how to select proper inflection for your language.
        title = self._("{long_month} {year}").format(
            long_month=self._ldd.long_months[month], year=year).capitalize()
        mark = IndexMark(title, INDEX_TYPE_TOC, 2)
        font_height = pt2cm(ptitle.get_font().get_size())
        self.doc.center_text("CAL-Title", title, width / 2, font_height * 0.25,
                             mark)
        cell_width = width / 7
        cell_height = (height - header) / 6
        current_date = datetime.date(year, month, 1)
        spacing = pt2cm(1.25 * ptext.get_font().get_size())  # 158
        if current_date.isoweekday() != g2iso(self.start_dow + 1):
            # Go back to previous first day of week, and start from there
            current_ord = (current_date.toordinal() - (
                (current_date.isoweekday() + 7) - g2iso(self.start_dow + 1)) %
                           7)
        else:
            current_ord = current_date.toordinal()
        for day_col in range(7):
            font_height = pt2cm(pdaynames.get_font().get_size())
            self.doc.center_text(
                "CAL-Daynames",
                long_days[(day_col + g2iso(self.start_dow + 1)) % 7 +
                          1].capitalize(),
                day_col * cell_width + cell_width / 2,
                header - font_height * 1.5)
        for week_row in range(6):
            something_this_week = 0
            for day_col in range(7):
                thisday = current_date.fromordinal(current_ord)
                if thisday.month == month:
                    something_this_week = 1
                    self.draw_rectangle("CAL-Border", day_col * cell_width,
                                        header + week_row * cell_height,
                                        (day_col + 1) * cell_width,
                                        header + (week_row + 1) * cell_height)
                    last_edge = (day_col + 1) * cell_width
                    self.doc.center_text("CAL-Numbers", str(thisday.day),
                                         day_col * cell_width + cell_width / 2,
                                         header + week_row * cell_height)
                    list_ = self.calendar.get(month, {}).get(thisday.day, [])
                    list_.sort()  # to get CAL-Holiday on bottom
                    position = spacing
                    for (format, p, m_list) in list_:
                        for line in reversed(p.split("\n")):
                            # make sure text will fit:
                            if position - 0.1 >= cell_height - numpos:  # font daynums
                                break
                            font = ptext.get_font()
                            line = string_trim(font, line,
                                               cm2pt(cell_width + 0.2))
                            self.doc.draw_text(
                                format, line, day_col * cell_width + 0.1,
                                header + (week_row + 1) * cell_height -
                                position - 0.1, m_list[0])
                            if len(m_list) > 1:  # index the spouse too
                                self.doc.draw_text(format, "", 0, 0, m_list[1])
                            position += spacing
                current_ord += 1
        if not something_this_week:
            last_edge = 0
        font_height = pt2cm(1.5 * ptext1style.get_font().get_size())
        x = last_edge + (width - last_edge) / 2
        text1 = str(self.text1)
        if text1 == _(_TITLE1):
            text1 = self._(_TITLE1)
        self.doc.center_text("CAL-Text1style", text1, x,
                             height - font_height * 3)
        text2 = str(self.text2)
        if text2 == _(_TITLE2):
            text2 = self._(_TITLE2)
        self.doc.center_text("CAL-Text2style", text2, x,
                             height - font_height * 2)
        self.doc.center_text("CAL-Text3style", self.text3, x,
                             height - font_height * 1)
        self.doc.end_page()
Ejemplo n.º 27
0
    def write_report(self):
        """
        Build the actual report.
        """

        records = find_records(self.database,
                               self.filter,
                               self.top_size,
                               self.callname,
                               trans_text=self._,
                               name_format=self._nf,
                               living_mode=self._lv,
                               user=self._user)

        self.doc.start_paragraph('REC-Title')
        title = self._("Records")
        mark = IndexMark(title, INDEX_TYPE_TOC, 1)
        self.doc.write_text(title, mark)
        self.doc.end_paragraph()

        self.doc.start_paragraph('REC-Subtitle')
        filter_name = self.filter.get_name(self._locale)
        self.doc.write_text("(%s)" % filter_name)
        self.doc.end_paragraph()
        if self._lv != LivingProxyDb.MODE_INCLUDE_ALL:
            self.doc.start_paragraph('REC-Subtitle')
            self.doc.write_text(self.living_desc)
            self.doc.end_paragraph()

        for (text, varname, top) in records:
            if not self.include[varname]:
                continue

            self.doc.start_paragraph('REC-Heading')
            self.doc.write_text(self._(text))
            self.doc.end_paragraph()

            last_value = None
            rank = 0
            for (number, (sort, value, name, handletype,
                          handle)) in enumerate(top):
                mark = None
                if handletype == 'Person':
                    person = self.database.get_person_from_handle(handle)
                    mark = utils.get_person_mark(self.database, person)
                elif handletype == 'Family':
                    family = self.database.get_family_from_handle(handle)
                    # librecords.py checks that the family has both
                    # a father and a mother and also that each one is
                    # in the filter if any filter was used, so we don't
                    # have to do any similar checking here, it's been done
                    f_handle = family.get_father_handle()
                    dad = self.database.get_person_from_handle(f_handle)
                    f_mark = utils.get_person_mark(self.database, dad)
                    m_handle = family.get_mother_handle()
                    mom = self.database.get_person_from_handle(m_handle)
                    m_mark = utils.get_person_mark(self.database, mom)
                else:
                    raise ReportError(
                        _("Option '%(opt_name)s' is present "
                          "in %(file)s\n  but is not known to "
                          "the module.  Ignoring...") % {
                              'opt_name': handletype,
                              'file': 'libnarrate.py'
                          })
                    # since the error is very unlikely I reused the string
                if value != last_value:
                    last_value = value
                    rank = number
                self.doc.start_paragraph('REC-Normal')
                self.doc.write_text(
                    self._("%(number)s. ") % {'number': rank + 1})
                self.doc.write_markup(str(name), name.get_tags(), mark)
                if handletype == 'Family':
                    self.doc.write_text('', f_mark)
                    self.doc.write_text('', m_mark)
                if isinstance(value, Span):
                    tvalue = value.get_repr(dlocale=self._locale)
                else:
                    tvalue = value
                self.doc.write_text(" (%s)" % tvalue)
                self.doc.end_paragraph()

        self.doc.start_paragraph('REC-Footer')
        self.doc.write_text(self.footer)
        self.doc.end_paragraph()
Ejemplo n.º 28
0
    def write_person(self, count):
        if count != 0:
            self.doc.page_break()
        self.bibli = Bibliography(Bibliography.MODE_DATE|Bibliography.MODE_PAGE)

        text = self._name_display.display(self.person)
        # feature request 2356: avoid genitive form
        title = self._("Summary of %s") % text
        mark = IndexMark(title, INDEX_TYPE_TOC, 1)
        self.doc.start_paragraph("IDS-Title")
        self.doc.write_text(title, mark)
        self.doc.end_paragraph()

        self.doc.start_paragraph("IDS-Normal")
        self.doc.end_paragraph()

        name = self.person.get_primary_name()
        text = self.get_name(self.person)
        mark = ReportUtils.get_person_mark(self._db, self.person)
        endnotes = self._cite_endnote(self.person)
        endnotes = self._cite_endnote(name, prior=endnotes)

        family_handle = self.person.get_main_parents_family_handle()
        if family_handle:
            family = self._db.get_family_from_handle(family_handle)
            father_inst_id = family.get_father_handle()
            if father_inst_id:
                father_inst = self._db.get_person_from_handle(
                    father_inst_id)
                father = self.get_name(father_inst)
                fmark = ReportUtils.get_person_mark(self._db, father_inst)
            else:
                father = ""
                fmark = None
            mother_inst_id = family.get_mother_handle()
            if mother_inst_id:
                mother_inst = self._db.get_person_from_handle(mother_inst_id)
                mother = self.get_name(mother_inst)
                mmark = ReportUtils.get_person_mark(self._db, mother_inst)
            else:
                mother = ""
                mmark = None
        else:
            father = ""
            fmark = None
            mother = ""
            mmark = None

        media_list = self.person.get_media_list()
        p_style = 'IDS-PersonTable2'
        self.mime0 = None
        if self.use_images and len(media_list) > 0:
            media0 = media_list[0]
            media_handle = media0.get_reference_handle()
            media = self._db.get_media_from_handle(media_handle)
            self.mime0 = media.get_mime_type()
            if self.mime0 and self.mime0.startswith("image"):
                image_filename = media_path_full(self._db, media.get_path())
                if os.path.exists(image_filename):
                    p_style = 'IDS-PersonTable' # this is tested for, also
                else:
                    self._user.warn(_("Could not add photo to page"),
                                    # translators: for French, else ignore
                                    _("%(str1)s: %(str2)s") %
                                         {'str1' : image_filename,
                                          'str2' : _('File does not exist') } )

        self.doc.start_table('person', p_style)
        self.doc.start_row()

        self.doc.start_cell('IDS-NormalCell')
        # translators: needed for French, ignore otherwise
        ignore4 = self._("%s:")
        self.write_paragraph(self._("%s:") % self._("Name"))
        self.write_paragraph(self._("%s:") % self._("Gender"))
        self.write_paragraph(self._("%s:") % self._("Father"))
        self.write_paragraph(self._("%s:") % self._("Mother"))
        self.doc.end_cell()

        self.doc.start_cell('IDS-NormalCell')
        self.write_paragraph(text, endnotes, mark)
        if self.person.get_gender() == Person.MALE:
            self.write_paragraph(self._("Male"))
        elif self.person.get_gender() == Person.FEMALE:
            self.write_paragraph(self._("Female"))
        else:
            self.write_paragraph(self._("Unknown"))
        self.write_paragraph(father, mark=fmark)
        self.write_paragraph(mother, mark=mmark)
        self.doc.end_cell()

        if p_style == 'IDS-PersonTable':
            self.doc.start_cell('IDS-NormalCell')
            self.doc.add_media(image_filename, "right", 4.0, 4.0,
                                      crop=media0.get_rectangle())
            endnotes = self._cite_endnote(media0)
            attr_list = media0.get_attribute_list()
            if len(attr_list) == 0:
                text = _('(image)')
            else:
                for attr in attr_list:
                    attr_type = attr.get_type().type2base()
                    # translators: needed for French, ignore otherwise
                    text = self._("%(str1)s: %(str2)s") % {
                                        'str1' : self._(attr_type),
                                        'str2' : attr.get_value() }
                    endnotes = self._cite_endnote(attr, prior=endnotes)
                    self.write_paragraph("(%s)" % text,
                                         endnotes=endnotes,
                                         style='IDS-ImageNote')
                    endnotes = ''
            if endnotes and len(attr_list) == 0:
                self.write_paragraph(text, endnotes=endnotes,
                                     style='IDS-ImageNote')
            self.doc.end_cell()

        self.doc.end_row()
        self.doc.end_table()

        self.doc.start_paragraph("IDS-Normal")
        self.doc.end_paragraph()

        self.write_alt_names()
        self.write_events()
        self.write_alt_parents()
        self.write_families()
        self.write_addresses()
        self.write_associations()
        self.write_attributes()
        self.write_LDS_ordinances()
        self.write_tags()
        self.write_images()
        self.write_note()
        if self.use_srcs:
            if self.use_pagebreak and self.bibli.get_citation_count():
                self.doc.page_break()
            Endnotes.write_endnotes(self.bibli, self._db, self.doc,
                                    printnotes=self.use_srcs_notes,
                                    elocale=self._locale)
Ejemplo n.º 29
0
    def write_report(self):
        """
        The routine that actually creates the report.
        At this point, the document is opened and ready for writing.
        """
        sdb = SimpleAccess(self.database)

        self.doc.start_paragraph("NoteLink-Title")
        title = _("Note Link Check Report")
        mark = IndexMark(title, INDEX_TYPE_TOC, 1)
        self.doc.write_text(title, mark)
        self.doc.end_paragraph()
        self.doc.start_table('NoteLinkTable', 'NoteLink-Table')

        self.doc.start_row()

        self.doc.start_cell('NoteLink-TableCell')
        self.doc.start_paragraph('NoteLink-Normal-Bold')
        self.doc.write_text(_("Note ID"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.start_cell('NoteLink-TableCell')
        self.doc.start_paragraph('NoteLink-Normal-Bold')
        self.doc.write_text(_("Link Type"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.start_cell('NoteLink-TableCell')
        self.doc.start_paragraph('NoteLink-Normal-Bold')
        self.doc.write_text(_("Links To"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.start_cell('NoteLink-TableCell')
        self.doc.start_paragraph('NoteLink-Normal-Bold')
        self.doc.write_text(_("Status"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.end_row()

        for note in self.database.iter_notes():
            for (ldomain, ltype, lprop, lvalue) in note.get_links():
                if ldomain == "gramps":
                    tagtype = _(ltype)
                    ref_obj = sdb.get_link(ltype, lprop, lvalue)
                    if ref_obj:
                        tagvalue = sdb.describe(ref_obj)
                        tagcheck = _("Ok")
                    else:
                        tagvalue = "%s://%s/%s/%s" % (ldomain, ltype, lprop,
                                                      lvalue)
                        tagcheck = _("Failed")
                else:
                    tagtype = _("Internet")
                    tagvalue = lvalue
                    tagcheck = ""

                self.doc.start_row()

                self.doc.start_cell('NoteLink-TableCell')
                self.doc.start_paragraph('NoteLink-Normal')
                self.doc.write_text(note.gramps_id)
                self.doc.end_paragraph()
                self.doc.end_cell()

                self.doc.start_cell('NoteLink-TableCell')
                self.doc.start_paragraph('NoteLink-Normal')
                self.doc.write_text(tagtype)
                self.doc.end_paragraph()
                self.doc.end_cell()

                self.doc.start_cell('NoteLink-TableCell')
                self.doc.start_paragraph('NoteLink-Normal')
                self.doc.write_text(tagvalue)
                self.doc.end_paragraph()
                self.doc.end_cell()

                self.doc.start_cell('NoteLink-TableCell')
                self.doc.start_paragraph('NoteLink-Normal')
                self.doc.write_text(tagcheck)
                self.doc.end_paragraph()
                self.doc.end_cell()

                self.doc.end_row()

        self.doc.end_table()
    def __write_referenced_families(self, pl_format):
        """
        This procedure writes out each of the families related to the place
        """
        i = 0
        iw = 0
        ifam = 0
        marrevt_handle_list = []
        marr = []
        fam_list = []
        fam_index = {}
        #        Paten_list = []

        if self.showgodparents:
            pedic = {}
            pedic = defaultdict(list)
            for pe in self.database.get_person_handles():
                for eventref in self.database.get_person_from_handle(
                        pe).event_ref_list:
                    if not eventref.get_role().is_primary():
                        pedic[eventref.ref].append((eventref.get_role(), pe))

        with self._user.progress(_("PlaceFamily Report"),
                                 ("Generating report"),
                                 len(self.place_handles)) as step:

            for handle in self.place_handles:
                # first all events
                event_handles = [
                    event_handle for (object_type, event_handle) in
                    self.database.find_backlink_handles(handle, ['Event'])
                ]
                event_handles.sort(key=self.sort.by_date_key)
                # only marriage
                for evt_handle in event_handles:
                    if self.database.get_event_from_handle(
                            evt_handle).get_type().is_marriage():
                        marrevt_handle_list.append(evt_handle)
    # no dups
            marr = list(OrderedDict.fromkeys(marrevt_handle_list))
            #        print(len(marr))
            mi = 0
            for evt_handle in marr:
                event = self.database.get_event_from_handle(evt_handle)
                date = self._get_date(event.get_date_object())
                date_sort = event.get_date_object().get_sort_value()
                descr = event.get_description()
                #                event_type = self._(self._get_type(event.get_type()))
                #                event_place = event.place
                ref_handles = [
                    x for x in self.database.find_backlink_handles(evt_handle)
                ]
                #            print(mi, evt_handle)
                mi += 1
                for (ref_type, ref_handle) in ref_handles:
                    if ref_type == 'Person':
                        continue
                    else:
                        family = self.database.get_family_from_handle(
                            ref_handle)
                        ifam += 1
                        father_handle = family.get_father_handle()
                        # now from the families only fathers
                        if father_handle:
                            fp = self.database.get_person_from_handle(
                                father_handle)
                            father_name = \
                                self._name_display.display_name(fp.get_primary_name()).lower()
                        else:
                            father_name = _("unknown")
                        place_d = place_displayer.display_event(
                            self.database, event, pl_format)
                        #                        print(place_d)
                        event_details = [
                            father_handle, father_name, date, ref_handle,
                            descr, place_d, family, date_sort
                        ]
                        fam_list.append(event_details)

    #        print(sorted(fam_list, key=itemgetter(1,7)))
    #        print(len(fam_list))
            printsurname = "NOW"
            index = 0
            ##########################
            #for fn in sorted(fam_list, key=itemgetter(1,7)):

            #fam_list_name
            # TEST FOR SORTING
            #            lastnames = ["Bange", "Änger", "Amman", "Änger", "Zelch", "Ösbach"]
            #            print(sorted(lastnames, key=locale.strxfrm))
            #            print()
            #
            #            lastnames_firstnames_groups =[
            #                ["Bange", "Michael", 2],
            #                ["Änger", "Ämma", 2],
            #                ["Amman", "Anton", 1],
            #                ["Änger", "Chris", 2],
            #                ["Zelch", "Sven", 1],
            #                ["Ösbach", "Carl", 1]
            #            ]
            #            print(sorted(lastnames_firstnames_groups, key=operator.itemgetter(2,0,1)))
            #            print(
            #                sorted(
            #                    lastnames_firstnames_groups,
            #                    key=lambda t: (t[2], locale.strxfrm(t[0]), locale.strxfrm(t[1]))
            #                )
            #            )
            #**************************
            for fn in sorted(fam_list,
                             key=lambda t: (locale.strxfrm(t[1]), t[7])):
                index += 1
                fam_index[fn[6].get_gramps_id()] = index
    #            print(index)
    #        for ifn in fam_index.keys():
    #            print(ifn, fam_index[ifn])
            fam_index_keys = fam_index.keys()

            for fn in sorted(fam_list,
                             key=lambda t: (locale.strxfrm(t[1]), t[7])):
                if fn[0] is None:
                    surname = _("unknown")
                else:
                    surname = self.database.get_person_from_handle(
                        fn[0]).get_primary_name().get_surname()
    #            print(fn[0], surname)
                if printsurname == surname:
                    pass
                else:
                    #Family Surname
                    printsurname = surname
                    #                  S_Name = ("%s " % surname)
                    #                    mark = IndexMark(S_Name, INDEX_TYPE_TOC, 1)
                    self.doc.start_paragraph("PLC-PlaceTitle")
                    # self.doc.write_text("%s " % surname)

                    #   mark = ReportUtils.get_person_mark(self.database,surname)

                    #                    mark = IndexMark( surname, INDEX_TYPE_ALP )
                    #                    indexname = surname+" P_INDEX"
                    indexname = surname + " P_INDEX"
                    mark = IndexMark(indexname, INDEX_TYPE_ALP, 2)

                    self.doc.write_text(surname, mark)
                    self.doc.end_paragraph()
                i += 1
                # weddingdetails
                family = fn[6]
                iw += 1
                self.doc.start_paragraph("PLC-Details")
                self.doc.start_bold()
                #            self.doc.write_text("<%s> " % iw)
                self.doc.write_text(" <%s>" % fam_index[fn[6].gramps_id])
                #            self.doc.write_text("Heirat %s " % fn[1])
                self.doc.write_text("%s " % u'\u26AD')
                self.doc.write_text("%s " % fn[2])
                self.doc.end_bold()

                # increment progress bar
                step()

                #given Name
                # wedding place
                #UINDEX                self.doc.write_text(" %s." % fn[5]+" P_INDEX"+" LLL")
                self.doc.write_text(" %s." % fn[5])
                # FamID
                self.doc.write_text(" [%s]" % fn[6].gramps_id)
                self.doc.end_paragraph()

                ##################################################
                # fatherdetails
                father = self.database.get_person_from_handle(
                    fn[6].father_handle)
                if father:
                    self.doc.start_paragraph("PLC-PlaceDetails")
                    #given Name
                    self.doc.start_bold()
                    #    self.doc.write_text("%s " % father.get_primary_name().get_first_name())
                    mark = ReportUtils.get_person_mark(self.database, father)
                    text = father.get_primary_name().get_first_name()
                    self.doc.write_text(text, mark)
                    self.doc.write_text(
                        " %s" % father.get_primary_name().get_surname())

                    self.doc.end_bold()
                    self.doc.write_text("[%s] " % father.get_gramps_id())
                    #ggf familyID
                    for fam in father.get_family_handle_list():
                        if self.database.get_family_from_handle(
                                fam).gramps_id == fn[6].gramps_id:
                            pass
                        else:
                            self.doc.write_text(
                                " [%s]" % self.database.get_family_from_handle(
                                    fam).gramps_id)
                            if self.database.get_family_from_handle(
                                    fam).gramps_id in fam_index_keys:
                                self.doc.start_bold()
                                self.doc.write_text(" <%s>" % fam_index[
                                    self.database.get_family_from_handle(
                                        fam).gramps_id])
                                self.doc.end_bold()

    #birth date
                    birth_ref = father.get_birth_ref()
                    if birth_ref:
                        # erst event
                        birth_event = self.database.get_event_from_handle(
                            birth_ref.ref)
                        self.doc.write_text(" * ")
                        self.doc.write_text(
                            self.__format_date(birth_event.get_date_object()))
                        #birth place
                        # dann display place
                        #P                       print("HIER")
                        #p                       print(place_displayer.display_event(self.database, birth_event, pl_format))
                        self.doc.write_text(
                            " " + place_displayer.display_event(
                                self.database, birth_event, pl_format))
        #bapt date
                    for eventref in father.event_ref_list:
                        if eventref.role == EventRoleType.PRIMARY:
                            if self.database.get_event_from_handle(
                                    eventref.ref).get_type(
                                    ) == EventType.BAPTISM:
                                # erst event
                                bapt_event = self.database.get_event_from_handle(
                                    eventref.ref)
                                self.doc.write_text(" %s " % u'\u2053')
                                self.doc.write_text(
                                    self.__format_date(
                                        bapt_event.get_date_object()))
                                #bapt place
                                #        # erst event
                                bapt_event = self.database.get_event_from_handle(
                                    eventref.ref)
                                # dann display place
                                self.doc.write_text(
                                    " " + place_displayer.display_event(
                                        self.database, bapt_event, pl_format))

        #death date
                    death_ref = father.get_death_ref()
                    if death_ref:
                        # erst event
                        death_event = self.database.get_event_from_handle(
                            death_ref.ref)
                        self.doc.write_text(" † ")
                        self.doc.write_text(
                            self.__format_date(death_event.get_date_object()))
                        #death place
                        self.doc.write_text(
                            " " + place_displayer.display_event(
                                self.database, death_event, pl_format))

        #burr date
                    for eventref in father.event_ref_list:
                        if eventref.role == EventRoleType.PRIMARY:
                            if self.database.get_event_from_handle(
                                    eventref.ref).get_type(
                                    ) == EventType.BURIAL:
                                # erst event
                                burr_event = self.database.get_event_from_handle(
                                    eventref.ref)
                                self.doc.write_text("%s " % u'\u26B0')
                                self.doc.write_text(
                                    self.__format_date(
                                        burr_event.get_date_object()))
                                #burr place
                                # dann display place
                                self.doc.write_text(
                                    " " + place_displayer.display_event(
                                        self.database, burr_event, pl_format))
                    self.doc.end_paragraph()

    ############################################################
    # motherdetails
                mother = self.database.get_person_from_handle(
                    fn[6].mother_handle)
                if mother:
                    self.doc.start_paragraph("PLC-PlaceDetails")
                    #given Name
                    self.doc.write_text("und ")
                    self.doc.start_bold()

                    mark = ReportUtils.get_person_mark(self.database, mother)
                    text = mother.get_primary_name().get_surname()
                    self.doc.write_text(text, mark)

                    #         self.doc.write_text("%s, " % mother.get_primary_name().get_surname())
                    self.doc.end_bold()
                    self.doc.write_text(
                        " %s " % mother.get_primary_name().get_first_name())
                    self.doc.write_text("[%s] " % mother.get_gramps_id())
                    #ggf familyID
                    for fam in mother.get_family_handle_list():
                        if self.database.get_family_from_handle(
                                fam).gramps_id == fn[6].gramps_id:
                            pass
                        else:
                            self.doc.write_text(
                                " [%s]" % self.database.get_family_from_handle(
                                    fam).gramps_id)
                            if self.database.get_family_from_handle(
                                    fam).gramps_id in fam_index_keys:
                                self.doc.start_bold()
                                self.doc.write_text(" <%s>" % fam_index[
                                    self.database.get_family_from_handle(
                                        fam).gramps_id])
                                self.doc.end_bold()

    #birth date
                    birth_ref = mother.get_birth_ref()
                    if birth_ref:
                        # erst event
                        birth_event = self.database.get_event_from_handle(
                            birth_ref.ref)
                        self.doc.write_text(" * ")
                        self.doc.write_text(
                            self.__format_date(birth_event.get_date_object()))
                        #birth place
                        # dann display place
                        place_string = place_displayer.display_event(
                            self.database, birth_event, pl_format)
                        self.doc.write_text(" " + place_string)

        #bapt date
                    for eventref in mother.event_ref_list:
                        if eventref.role == EventRoleType.PRIMARY:
                            if self.database.get_event_from_handle(
                                    eventref.ref).get_type(
                                    ) == EventType.BAPTISM:
                                # erst event
                                bapt_event = self.database.get_event_from_handle(
                                    eventref.ref)

                                self.doc.write_text(" %s " % u'\u2053')
                                self.doc.write_text(
                                    self.__format_date(
                                        bapt_event.get_date_object()))
                                #bapt place
                                # dann display place
                                place_string = place_displayer.display_event(
                                    self.database, bapt_event, pl_format)
                                self.doc.write_text(" " + place_string)

        #death date
                    death_ref = mother.get_death_ref()
                    if death_ref:
                        # erst event
                        death_event = self.database.get_event_from_handle(
                            death_ref.ref)
                        self.doc.write_text(" † ")
                        self.doc.write_text(
                            self.__format_date(death_event.get_date_object()))
                        #death place
                        place_string = place_displayer.display_event(
                            self.database, death_event, pl_format)
                        self.doc.write_text(" " + place_string)

        #burr date
                    for eventref in mother.event_ref_list:
                        if eventref.role == EventRoleType.PRIMARY:
                            if self.database.get_event_from_handle(
                                    eventref.ref).get_type(
                                    ) == EventType.BURIAL:
                                # erst event
                                burr_event = self.database.get_event_from_handle(
                                    eventref.ref)
                                self.doc.write_text("%s " % u'\u26B0')
                                self.doc.write_text(
                                    self.__format_date(
                                        burr_event.get_date_object()))
                                #burr place
                                # dann display place
                                place_string = place_displayer.display_event(
                                    self.database, burr_event, pl_format)
                                self.doc.write_text(" " + place_string)
                    self.doc.end_paragraph()

    ############################################################
    # Children

                fc = 0
                for ch in fn[6].get_child_ref_list():
                    self.doc.start_paragraph("PLC-PlaceDetailsChildren")
                    fc += 1
                    child = self.database.get_person_from_handle(ch.ref)
                    if child:
                        #lnr
                        self.doc.write_text("     %s " % fc)
                        #given Name
                        mark = ReportUtils.get_person_mark(
                            self.database, child)
                        text = child.get_primary_name().get_first_name()
                        self.doc.write_text(text, mark)
                        #             self.doc.write_text("%s " % child.get_primary_name().get_first_name())
                        self.doc.write_text("[%s] " % child.get_gramps_id())
                        #ggf familyID
                        for fam in child.get_family_handle_list():
                            if self.database.get_family_from_handle(
                                    fam).gramps_id == fn[6].gramps_id:
                                pass
                            else:
                                self.doc.write_text(
                                    " [%s]" %
                                    self.database.get_family_from_handle(
                                        fam).gramps_id)
                                if self.database.get_family_from_handle(
                                        fam).gramps_id in fam_index_keys:
                                    self.doc.start_bold()
                                    self.doc.write_text(" <%s>" % fam_index[
                                        self.database.get_family_from_handle(
                                            fam).gramps_id])
                                    self.doc.end_bold()

            #birth date

                        birth_ref = child.get_birth_ref()
                        if birth_ref:
                            # erst event
                            birth_event = self.database.get_event_from_handle(
                                birth_ref.ref)
                            self.doc.write_text(" * ")
                            self.doc.write_text(
                                self.__format_date(
                                    birth_event.get_date_object()))
                            #birth place
                            place_string = place_displayer.display_event(
                                self.database, birth_event, pl_format)
                            self.doc.write_text(" " + place_string)

            #bapt date
                        for eventref in child.event_ref_list:
                            if eventref.role == EventRoleType.PRIMARY:
                                if self.database.get_event_from_handle(
                                        eventref.ref).get_type(
                                        ) == EventType.BAPTISM:
                                    # erst event
                                    bapt_event = self.database.get_event_from_handle(
                                        eventref.ref)

                                    self.doc.write_text(" %s " % u'\u2053')
                                    self.doc.write_text(
                                        self.__format_date(
                                            bapt_event.get_date_object()))
                                    #bapt place
                                    # dann display place
                                    place_string = place_displayer.display_event(
                                        self.database, bapt_event, pl_format)
                                    self.doc.write_text(" " + place_string)

                                    if self.showgodparents:
                                        Patenlist = []
                                        Patenlist = pedic[eventref.ref]
            #death date
                        death_ref = child.get_death_ref()
                        if death_ref:
                            # erst event
                            death_event = self.database.get_event_from_handle(
                                death_ref.ref)
                            self.doc.write_text(" † ")
                            self.doc.write_text(
                                self.__format_date(
                                    death_event.get_date_object()))
                            #death place
                            # dann display place
                            place_string = place_displayer.display_event(
                                self.database, death_event, pl_format)
                            self.doc.write_text(" " + place_string)

            #burr date
                        for eventref in child.event_ref_list:
                            if eventref.role == EventRoleType.PRIMARY:
                                if self.database.get_event_from_handle(
                                        eventref.ref).get_type(
                                        ) == EventType.BURIAL:
                                    # erst event
                                    burr_event = self.database.get_event_from_handle(
                                        eventref.ref)
                                    self.doc.write_text("%s " % u'\u26B0')
                                    self.doc.write_text(
                                        self.__format_date(
                                            burr_event.get_date_object()))
                                    #burr place
                                    # dann display place
                                    place_string = place_displayer.display_event(
                                        self.database, burr_event, pl_format)
                                    # dann drucken
                                    self.doc.write_text(" " + place_string)
                        self.doc.end_paragraph()

                        #                       print(len(Patenlist))
                        if self.showgodparents:
                            if len(Patenlist) > 0:
                                self.doc.start_paragraph("PLC-Godparents")
                                self.doc.write_text(" Paten: ")
                                for i, (pa_a, pa_b) in enumerate(Patenlist):
                                    self.doc.write_text(" (%s) " % str(i + 1))
                                    pate_name = self.database.get_person_from_handle(
                                        pa_b
                                    ).get_primary_name().get_first_name(
                                    ) + " " + self.database.get_person_from_handle(
                                        pa_b).get_primary_name().get_surname()
                                    pate = self.database.get_person_from_handle(
                                        pa_b)
                                    #                                    print(pate, pate_name)
                                    mark = ReportUtils.get_person_mark(
                                        self.database, pate)
                                    self.doc.write_text(
                                        pate.get_primary_name().get_first_name(
                                        ) + " " +
                                        pate.get_primary_name().get_surname(),
                                        mark)
                                self.doc.end_paragraph()
                                Patenlist = []