예제 #1
0
    def get_person_label(self, person):
        "return person label string"
        # see if we have an image to use for this person
        imagePath = None
        if self.bUseHtmlOutput:
            mediaList = person.get_media_list()
            if len(mediaList) > 0:
                mediaHandle = mediaList[0].get_reference_handle()
                media = self.database.get_object_from_handle(mediaHandle)
                mediaMimeType = media.get_mime_type()
                if mediaMimeType[0:5] == "image":
                    imagePath = get_thumbnail_path(
                        media_path_full(self.database, media.get_path()),
                        rectangle=mediaList[0].get_rectangle())
                    # test if thumbnail actually exists in thumbs
                    # (import of data means media files might not be present
                    imagePath = find_file(imagePath)

        label = ""
        lineDelimiter = '\\n'

        # If we have an image, then start an HTML table; remember to close
        # the table afterwards!
        #
        # This isn't a free-form HTML format here...just a few keywords that
        # happen to be
        # similar to keywords commonly seen in HTML.  For additional
        # information on what
        # is allowed, see:
        #
        #       http://www.graphviz.org/info/shapes.html#html
        #
        if self.bUseHtmlOutput and imagePath:
            lineDelimiter = '<BR/>'
            label += '<TABLE BORDER="0" CELLSPACING="2" CELLPADDING="0" CELLBORDER="0"><TR><TD></TD><TD><IMG SRC="%s"/></TD><TD></TD>' % imagePath
            if self.imgpos == 0:
                #trick it into not stretching the image
                label += '</TR><TR><TD COLSPAN="3">'
            else:
                label += '<TD>'
        else:
            #no need for html label with this person
            self.bUseHtmlOutput = False

        # at the very least, the label must have the person's name
        nm = self._name_display.display(person)
        if self.bUseHtmlOutput:
            # avoid < and > in the name, as this is html text
            label += nm.replace('<', '&#60;').replace('>', '&#62;')
        else:
            label += nm
        p_id = person.get_gramps_id()
        if self.includeid == 1:  # same line
            label += " (%s)" % p_id
        elif self.includeid == 2:  # own line
            label += "%s(%s)" % (lineDelimiter, p_id)
        if self.event_choice != 0:
            b_date, d_date, b_place, d_place = self.get_event_strings(person)
            if self.event_choice in [1, 2, 3, 4, 5] and (b_date or d_date):
                label += '%s(' % lineDelimiter
                if b_date:
                    label += '%s' % b_date
                label += ' - '
                if d_date:
                    label += '%s' % d_date
                label += ')'
            if (self.event_choice in [2, 3, 5, 6] and (b_place or d_place)
                    and not (self.event_choice == 3 and (b_date or d_date))):
                label += '%s(' % lineDelimiter
                if b_place:
                    label += '%s' % b_place
                label += ' - '
                if d_place:
                    label += '%s' % d_place
                label += ')'

        if self.increlname and self.center_person != person:
            # display relationship info
            if self.advrelinfo:
                (relationship, Ga,
                 Gb) = self.rel_calc.get_one_relationship(self.database,
                                                          self.center_person,
                                                          person,
                                                          extra_info=True,
                                                          olocale=self._locale)
                if relationship:
                    label += "%s(%s Ga=%d Gb=%d)" % (lineDelimiter,
                                                     relationship, Ga, Gb)
            else:
                relationship = self.rel_calc.get_one_relationship(
                    self.database,
                    self.center_person,
                    person,
                    olocale=self._locale)
                if relationship:
                    label += "%s(%s)" % (lineDelimiter, relationship)

        # see if we have a table that needs to be terminated
        if self.bUseHtmlOutput:
            label += '</TD></TR></TABLE>'
            return label
        else:
            # non html label is enclosed by "" so escape other "
            return label.replace('"', '\\\"')
예제 #2
0
    def __write_gallery(self, thumbs, mediapath):
        """
        This procedure writes out the media
        """

        LOG.info('Looking at gallery')

        from gramps.gui.thumbnails import get_thumbnail_path

        # full clear line for proper styling

        fullclear = Html("div", class_="fullclear", inline=True)

        LOG.info('Start to enumerate for gallery')
        #LOG.debug(thumbs)

        for i, thumb in enumerate(thumbs):

            # list of tuples [('',''),('','')]

            if (list(thumb)[0])[0] == 'src':
                src = (list(thumb)[0])[1]
            else:
                src = 'No src'
            #LOG.debug(src)

            if (list(thumb)[1])[0] == 'mime':
                mime = (list(thumb)[1])[1]
            else:
                mime = 'No mime'
            #LOG.debug(mime)

            if (list(thumb)[2])[0] == 'checksum':
                checksum = (list(thumb)[2])[1]
            else:
                checksum = 'No checksum'
            #LOG.debug(checksum)

            if (list(thumb)[2])[0] == 'description':
                description = (list(thumb)[2])[1]
            elif len(thumb) == 4:
                description = (list(thumb)[3])[1]
            else:
                description = 'No description'
            #LOG.debug(description)

            # relative and absolute paths

            src = os.path.join(mediapath, src)

            # windows OS ???
            if not src.startswith("/"):
                src = os.path.join(USER_HOME, src)

            #LOG.debug(src)

            # only images

            if mime.startswith("image"):
                thumb = get_thumbnail_path(str(src),
                                           mtype=None,
                                           rectangle=None)
                #LOG.debug(thumb)
                self.text += Html('img', src=str(thumb), mtype=str(mime))
                self.text += fullclear
                self.text += Html('a',
                                  str(description),
                                  href=str(src),
                                  target='blank',
                                  title=str(mime))
                self.text += fullclear

        return self.text
예제 #3
0
    def writePeople(self):

        self.doc.add_comment('')

        # If we're going to attempt to include images, then use the HTML style 
        # of .gv file.
        bUseHtmlOutput = False
        if self._incimages:
            bUseHtmlOutput = True

        # loop through all the people we need to output
        for handle in sorted(self._people): # enable a diff
            person = self._db.get_person_from_handle(handle)
            name = self._name_display.display(person)
            p_id = person.get_gramps_id()

            # figure out what colour to use
            gender = person.get_gender()
            colour = self._colorunknown
            if gender == Person.MALE:
                colour = self._colormales
            elif gender == Person.FEMALE:
                colour = self._colorfemales

            # see if we have surname colours that match this person
            surname = person.get_primary_name().get_surname().encode('iso-8859-1','xmlcharrefreplace')
            if surname in self._surnamecolors:
                colour = self._surnamecolors[surname]

            # see if we have a birth/death or fallback dates we can use
            if self._incdates or self._incplaces:
                bth_event = get_birth_or_fallback(self._db, person)
                dth_event = get_death_or_fallback(self._db, person)
            else:
                bth_event = None
                dth_event = None

            # output the birth or fallback event
            birthStr = None
            if bth_event and self._incdates:
                date = bth_event.get_date_object()
                if self._just_years and date.get_year_valid():
                    birthStr = '%i' % date.get_year()
                else:
                    birthStr = self._get_date(date)

            # get birth place (one of:  city, state, or country) we can use
            birthplace = None
            if bth_event and self._incplaces:
                place = self._db.get_place_from_handle(
                                             bth_event.get_place_handle())
                if place:
                    location = get_main_location(self._db, place)
                    if location.get(PlaceType.CITY):
                        birthplace = location.get(PlaceType.CITY)
                    elif location.get(PlaceType.STATE):
                        birthplace = location.get(PlaceType.STATE)
                    elif location.get(PlaceType.COUNTRY):
                        birthplace = location.get(PlaceType.COUNTRY)

            # see if we have a deceased date we can use
            deathStr = None
            if dth_event and self._incdates:
                date = dth_event.get_date_object()
                if self._just_years and date.get_year_valid():
                    deathStr = '%i' % date.get_year()
                else:
                    deathStr = self._get_date(date)

            # get death place (one of:  city, state, or country) we can use
            deathplace = None
            if dth_event and self._incplaces:
                place = self._db.get_place_from_handle(
                                             dth_event.get_place_handle())
                if place:
                    location = get_main_location(self._db, place)
                    if location.get(PlaceType.CITY):
                        deathplace = location.get(PlaceType.CITY)
                    elif location.get(PlaceType.STATE):
                        deathplace = location.get(PlaceType.STATE)
                    elif location.get(PlaceType.COUNTRY):
                        deathplace = location.get(PlaceType.COUNTRY)

            # see if we have an image to use for this person
            imagePath = None
            if self._incimages:
                mediaList = person.get_media_list()
                if len(mediaList) > 0:
                    mediaHandle = mediaList[0].get_reference_handle()
                    media = self._db.get_object_from_handle(mediaHandle)
                    mediaMimeType = media.get_mime_type()
                    if mediaMimeType[0:5] == "image":
                        imagePath = get_thumbnail_path(
                                        media_path_full(self._db, 
                                                        media.get_path()),
                                        rectangle=mediaList[0].get_rectangle())

            # put the label together and output this person
            label = ""
            lineDelimiter = '\\n'
            if bUseHtmlOutput:
                lineDelimiter = '<BR/>'

            # if we have an image, then start an HTML table;
            # remember to close the table afterwards!
            if imagePath:
                label = ('<TABLE BORDER="0" CELLSPACING="2" CELLPADDING="0" '
                         'CELLBORDER="0"><TR><TD><IMG SRC="%s"/></TD>'
                            % imagePath
                        )
                if self._imageonside == 0:
                    label += '</TR><TR>'
                label += '<TD>'

            # at the very least, the label must have the person's name
            label += name
            if self.includeid == 1: # same line
                label += " (%s)" % p_id
            elif self.includeid == 2: # own line
                label += "%s(%s)" % (lineDelimiter, p_id)

            if birthStr or deathStr:
                label += '%s(' % lineDelimiter
                if birthStr:
                    label += '%s' % birthStr
                label += ' - '
                if deathStr:
                    label += '%s' % deathStr
                label += ')'
            if birthplace or deathplace:
                if birthplace == deathplace:
                    deathplace = None    # no need to print the same name twice
                label += '%s' % lineDelimiter
                if birthplace:
                    label += '%s' % birthplace
                if birthplace and deathplace:
                    label += ' / '
                if deathplace:
                    label += '%s' % deathplace

            # see if we have a table that needs to be terminated
            if imagePath:
                label += '</TD></TR></TABLE>'

            shape   = "box"
            style   = "solid"
            border  = colour
            fill    = colour

            # do not use colour if this is B&W outline
            if self._colorize == 'outline':
                border  = ""
                fill    = ""

            if gender == person.FEMALE and self._useroundedcorners:
                style = "rounded"
            elif gender == person.UNKNOWN:
                shape = "hexagon"

            # if we're filling the entire node:
            if self._colorize == 'filled':
                style += ",filled"
                border = ""

            # we're done -- add the node
            self.doc.add_node(p_id,
                 label=label,
                 shape=shape,
                 color=border,
                 style=style,
                 fillcolor=fill,
                 htmloutput=bUseHtmlOutput)
예제 #4
0
    def __write_gallery(self, thumbs, mediapath):
        """
        This procedure writes out the media
        """

        LOG.info('Looking at gallery')

        from gramps.gui.thumbnails import get_thumbnail_path

        # full clear line for proper styling

        fullclear = Html("div", class_ = "fullclear", inline = True)

        LOG.info('Start to enumerate for gallery')
        #LOG.debug(thumbs)

        for i, thumb in enumerate(thumbs):

            # list of tuples [('',''),('','')]

            if (list(thumb)[0])[0] == 'src':
                src = (list(thumb)[0])[1]
            else:
                src = 'No src'
            #LOG.debug(src)

            if (list(thumb)[1])[0] == 'mime':
                mime = (list(thumb)[1])[1]
            else:
                mime = 'No mime'
            #LOG.debug(mime)

            if (list(thumb)[2])[0] == 'checksum':
                checksum = (list(thumb)[2])[1]
            else:
                checksum = 'No checksum'
            #LOG.debug(checksum)

            if (list(thumb)[2])[0] == 'description':
                description = (list(thumb)[2])[1]
            elif len(thumb) == 4:
                description = (list(thumb)[3])[1]
            else:
                description = 'No description'
            #LOG.debug(description)

            # relative and absolute paths

            src = os.path.join(mediapath, src)

            # windows OS ???
            if not src.startswith("/"):
                src = os.path.join(USER_HOME, src)

            #LOG.debug(src)

            # only images

            if mime.startswith("image"):
                thumb = get_thumbnail_path(str(src), mtype=None, rectangle=None)
                #LOG.debug(thumb)
                self.text += Html('img', src=str(thumb), mtype=str(mime))
                self.text += fullclear
                self.text += Html('a', str(description), href=str(src), target='blank', title=str(mime))
                self.text += fullclear

        return self.text
예제 #5
0
    def writePeople(self):

        self.doc.add_comment('')

        # If we're going to attempt to include images, then use the HTML style
        # of .gv file.
        bUseHtmlOutput = False
        if self._incimages:
            bUseHtmlOutput = True

        # loop through all the people we need to output
        for handle in sorted(self._people):  # enable a diff
            person = self._db.get_person_from_handle(handle)
            name = self._name_display.display(person)
            p_id = person.get_gramps_id()

            # figure out what colour to use
            gender = person.get_gender()
            colour = self._colorunknown
            if gender == Person.MALE:
                colour = self._colormales
            elif gender == Person.FEMALE:
                colour = self._colorfemales

            # see if we have surname colours that match this person
            surname = person.get_primary_name().get_surname().encode(
                'iso-8859-1', 'xmlcharrefreplace')
            if surname in self._surnamecolors:
                colour = self._surnamecolors[surname]

            # see if we have a birth/death or fallback dates we can use
            if self._incdates or self._incplaces:
                bth_event = get_birth_or_fallback(self._db, person)
                dth_event = get_death_or_fallback(self._db, person)
            else:
                bth_event = None
                dth_event = None

            # output the birth or fallback event
            birthStr = None
            if bth_event and self._incdates:
                date = bth_event.get_date_object()
                if self._just_years and date.get_year_valid():
                    birthStr = '%i' % date.get_year()
                else:
                    birthStr = self._get_date(date)

            # get birth place (one of:  city, state, or country) we can use
            birthplace = None
            if bth_event and self._incplaces:
                place = self._db.get_place_from_handle(
                    bth_event.get_place_handle())
                if place:
                    location = get_main_location(self._db, place)
                    if location.get(PlaceType.CITY):
                        birthplace = location.get(PlaceType.CITY)
                    elif location.get(PlaceType.STATE):
                        birthplace = location.get(PlaceType.STATE)
                    elif location.get(PlaceType.COUNTRY):
                        birthplace = location.get(PlaceType.COUNTRY)

            # see if we have a deceased date we can use
            deathStr = None
            if dth_event and self._incdates:
                date = dth_event.get_date_object()
                if self._just_years and date.get_year_valid():
                    deathStr = '%i' % date.get_year()
                else:
                    deathStr = self._get_date(date)

            # get death place (one of:  city, state, or country) we can use
            deathplace = None
            if dth_event and self._incplaces:
                place = self._db.get_place_from_handle(
                    dth_event.get_place_handle())
                if place:
                    location = get_main_location(self._db, place)
                    if location.get(PlaceType.CITY):
                        deathplace = location.get(PlaceType.CITY)
                    elif location.get(PlaceType.STATE):
                        deathplace = location.get(PlaceType.STATE)
                    elif location.get(PlaceType.COUNTRY):
                        deathplace = location.get(PlaceType.COUNTRY)

            # see if we have an image to use for this person
            imagePath = None
            if self._incimages:
                mediaList = person.get_media_list()
                if len(mediaList) > 0:
                    mediaHandle = mediaList[0].get_reference_handle()
                    media = self._db.get_object_from_handle(mediaHandle)
                    mediaMimeType = media.get_mime_type()
                    if mediaMimeType[0:5] == "image":
                        imagePath = get_thumbnail_path(
                            media_path_full(self._db, media.get_path()),
                            rectangle=mediaList[0].get_rectangle())

            # put the label together and output this person
            label = ""
            lineDelimiter = '\\n'
            if bUseHtmlOutput:
                lineDelimiter = '<BR/>'

            # if we have an image, then start an HTML table;
            # remember to close the table afterwards!
            if imagePath:
                label = ('<TABLE BORDER="0" CELLSPACING="2" CELLPADDING="0" '
                         'CELLBORDER="0"><TR><TD><IMG SRC="%s"/></TD>' %
                         imagePath)
                if self._imageonside == 0:
                    label += '</TR><TR>'
                label += '<TD>'

            # at the very least, the label must have the person's name
            label += name
            if self.includeid == 1:  # same line
                label += " (%s)" % p_id
            elif self.includeid == 2:  # own line
                label += "%s(%s)" % (lineDelimiter, p_id)

            if birthStr or deathStr:
                label += '%s(' % lineDelimiter
                if birthStr:
                    label += '%s' % birthStr
                label += ' - '
                if deathStr:
                    label += '%s' % deathStr
                label += ')'
            if birthplace or deathplace:
                if birthplace == deathplace:
                    deathplace = None  # no need to print the same name twice
                label += '%s' % lineDelimiter
                if birthplace:
                    label += '%s' % birthplace
                if birthplace and deathplace:
                    label += ' / '
                if deathplace:
                    label += '%s' % deathplace

            # see if we have a table that needs to be terminated
            if imagePath:
                label += '</TD></TR></TABLE>'

            shape = "box"
            style = "solid"
            border = colour
            fill = colour

            # do not use colour if this is B&W outline
            if self._colorize == 'outline':
                border = ""
                fill = ""

            if gender == person.FEMALE and self._useroundedcorners:
                style = "rounded"
            elif gender == person.UNKNOWN:
                shape = "hexagon"

            # if we're filling the entire node:
            if self._colorize == 'filled':
                style += ",filled"
                border = ""

            # we're done -- add the node
            self.doc.add_node(p_id,
                              label=label,
                              shape=shape,
                              color=border,
                              style=style,
                              fillcolor=fill,
                              htmloutput=bUseHtmlOutput)
예제 #6
0
    def get_person_label(self, person):
        "return person label string"
        # see if we have an image to use for this person
        imagePath = None
        if self.bUseHtmlOutput:
            mediaList = person.get_media_list()
            if len(mediaList) > 0:
                mediaHandle = mediaList[0].get_reference_handle()
                media = self.database.get_object_from_handle(mediaHandle)
                mediaMimeType = media.get_mime_type()
                if mediaMimeType[0:5] == "image":
                    imagePath = get_thumbnail_path(
                                    media_path_full(self.database, 
                                                    media.get_path()),
                                    rectangle=mediaList[0].get_rectangle())
                    # test if thumbnail actually exists in thumbs
                    # (import of data means media files might not be present
                    imagePath = find_file(imagePath)

        label = ""
        lineDelimiter = '\\n'

        # If we have an image, then start an HTML table; remember to close
        # the table afterwards!
        #
        # This isn't a free-form HTML format here...just a few keywords that
        # happen to be
        # similar to keywords commonly seen in HTML.  For additional
        # information on what
        # is allowed, see:
        #
        #       http://www.graphviz.org/info/shapes.html#html
        #
        if self.bUseHtmlOutput and imagePath:
            lineDelimiter = '<BR/>'
            label += '<TABLE BORDER="0" CELLSPACING="2" CELLPADDING="0" CELLBORDER="0"><TR><TD></TD><TD><IMG SRC="%s"/></TD><TD></TD>'  % imagePath
            if self.imgpos == 0:
                #trick it into not stretching the image
                label += '</TR><TR><TD COLSPAN="3">'
            else :
                label += '<TD>'
        else :
            #no need for html label with this person
            self.bUseHtmlOutput = False

        # at the very least, the label must have the person's name
        nm = self._name_display.display(person)
        if self.bUseHtmlOutput :
            # avoid < and > in the name, as this is html text
            label += nm.replace('<', '&#60;').replace('>', '&#62;')
        else :
            label += nm
        p_id = person.get_gramps_id()
        if self.includeid == 1: # same line
            label += " (%s)" % p_id
        elif self.includeid == 2: # own line
            label += "%s(%s)" % (lineDelimiter, p_id)
        if self.event_choice != 0:
            b_date, d_date, b_place, d_place = self.get_event_strings(person)
            if self.event_choice in [1, 2, 3, 4, 5] and (b_date or d_date):
                label += '%s(' % lineDelimiter
                if b_date:
                    label += '%s' % b_date
                label += ' - '
                if d_date:
                    label += '%s' % d_date
                label += ')'
            if (self.event_choice in [2, 3, 5, 6] and
                (b_place or d_place) and
                not (self.event_choice == 3 and (b_date or d_date))
               ):
                label += '%s(' % lineDelimiter
                if b_place:
                    label += '%s' % b_place
                label += ' - '
                if d_place:
                    label += '%s' % d_place
                label += ')'

        if self.increlname and self.center_person != person:
            # display relationship info
            if self.advrelinfo:
                (relationship, Ga, Gb) = self.rel_calc.get_one_relationship(
                            self.database, self.center_person, person,
                            extra_info=True, olocale=self._locale)
                if relationship:
                    label += "%s(%s Ga=%d Gb=%d)" % (lineDelimiter,
                                                     relationship, Ga, Gb)
            else:
                relationship = self.rel_calc.get_one_relationship(
                            self.database, self.center_person, person,
                            olocale=self._locale)
                if relationship:
                    label += "%s(%s)" % (lineDelimiter, relationship)

        # see if we have a table that needs to be terminated
        if self.bUseHtmlOutput:
            label += '</TD></TR></TABLE>'
            return label
        else :
            # non html label is enclosed by "" so escape other "
            return label.replace('"', '\\\"')
예제 #7
0
    def writePeople(self):

        self.doc.add_comment('')

        # If we're going to attempt to include images, then use the HTML style
        # of .gv file.
        bUseHtmlOutput = False
        if self._incimages:
            bUseHtmlOutput = True

        # TODO there could be improvement and is still something wrong (wrong order)
        # also people should be sorted by their marriage - so first marriage, then 2nd marriage
        def personSorter(handle):
            person = self._db.get_person_from_handle(handle)
            fHandle = person.get_main_parents_family_handle()
            if fHandle:
                family = self._db.get_family_from_handle(fHandle)
                if family:
                    childList = family.get_child_ref_list()
                    childListRef = []
                    for ch in childList:
                        childListRef.append(ch.ref)
                    try:
                        return childListRef.index(person.get_handle())
                    except:
                        pass
            return 0

        sorted_people = sorted(self._people, key=personSorter)
        for handle in sorted_people:
            person = self._db.get_person_from_handle(handle)
            name = self._name_display.display(person)

            # figure out what colour to use
            gender = person.get_gender()
            colour = self._colorunknown
            if gender == Person.MALE:
                colour = self._colormales
            elif gender == Person.FEMALE:
                colour = self._colorfemales

            # see if we have surname colours that match this person
            surname = person.get_primary_name().get_surname().encode(
                'iso-8859-1', 'xmlcharrefreplace')
            if surname in self._surnamecolors:
                colour = self._surnamecolors[surname]

            # see if we have a birth/death or fallback dates we can use
            if self._incdates or self._incplaces:
                bth_event = get_birth_or_fallback(self._db, person)
                dth_event = get_death_or_fallback(self._db, person)
            else:
                bth_event = None
                dth_event = None

            # output the birth or fallback event
            birthStr = None
            if bth_event and self._incdates:
                if not bth_event.private or self._incprivate:
                    date = bth_event.get_date_object()
                    if self._just_years and date.get_year_valid():
                        birthStr = '%i' % date.get_year()
                    else:
                        birthStr = self._get_date(date)

            # get birth place (one of:  city, state, or country) we can use
            birthplace = None
            if bth_event and self._incplaces:
                if not bth_event.private or self._incprivate:
                    place = self._db.get_place_from_handle(
                        bth_event.get_place_handle())
                    if place:
                        location = get_main_location(self._db, place)
                        if location.get(PlaceType.CITY):
                            birthplace = location.get(PlaceType.CITY)
                        elif location.get(PlaceType.STATE):
                            birthplace = location.get(PlaceType.STATE)
                        elif location.get(PlaceType.COUNTRY):
                            birthplace = location.get(PlaceType.COUNTRY)

            # see if we have a deceased date we can use
            deathStr = None
            if dth_event and self._incdates:
                if not dth_event.private or self._incprivate:
                    date = dth_event.get_date_object()
                    if self._just_years and date.get_year_valid():
                        deathStr = '%i' % date.get_year()
                    else:
                        deathStr = self._get_date(date)

            # get death place (one of:  city, state, or country) we can use
            deathplace = None
            if dth_event and self._incplaces:
                if not dth_event.private or self._incprivate:
                    place = self._db.get_place_from_handle(
                        dth_event.get_place_handle())
                    if place:
                        location = get_main_location(self._db, place)
                        if location.get(PlaceType.CITY):
                            deathplace = location.get(PlaceType.CITY)
                        elif location.get(PlaceType.STATE):
                            deathplace = location.get(PlaceType.STATE)
                        elif location.get(PlaceType.COUNTRY):
                            deathplace = location.get(PlaceType.COUNTRY)

            occupations = self.getOccupations(person)

            # see if we have an image to use for this person
            imagePath = None
            if self._incimages:
                mediaList = person.get_media_list()
                if len(mediaList) > 0:
                    mediaHandle = mediaList[0].get_reference_handle()
                    media = self._db.get_object_from_handle(mediaHandle)
                    mediaMimeType = media.get_mime_type()
                    if mediaMimeType[0:5] == "image":
                        imagePath = get_thumbnail_path(
                            media_path_full(self._db, media.get_path()),
                            rectangle=mediaList[0].get_rectangle())

            # put the label together and output this person
            label = ""
            lineDelimiter = '\\n'
            if bUseHtmlOutput:
                lineDelimiter = '<BR/>'

            # if we have an image, then start an HTML table;
            # remember to close the table afterwards!
            if imagePath:
                label = ('<TABLE BORDER="0" CELLSPACING="2" CELLPADDING="0" '
                         'CELLBORDER="0"><TR><TD><IMG SRC="%s"/></TD>' %
                         imagePath)
                if self._imageonside == 0:
                    label += '</TR><TR>'
                label += '<TD>'

            # at the very least, the label must have the person's name
            label += name
            print name
            if birthStr or deathStr:
                label += '%s(' % lineDelimiter
                if birthStr:
                    label += '%s' % birthStr
                label += ' - '
                if deathStr:
                    label += '%s' % deathStr
                label += ')'
            if birthplace or deathplace:
                if birthplace == deathplace:
                    deathplace = None  # no need to print the same name twice
                label += '%s' % lineDelimiter
                if birthplace:
                    label += '%s' % birthplace
                if birthplace and deathplace:
                    label += ' / '
                if deathplace:
                    label += '%s' % deathplace

            if len(occupations) > 0:
                plural = ''
                if len(occupations) > 1:
                    plural = 'e'
                label += '%s Beruf%s: %s' % (lineDelimiter, plural,
                                             ', '.join(occupations))

            for family_handle in person.get_family_handle_list():
                if family_handle not in self._families:
                    # label += '<small>'
                    family = self._db.get_family_from_handle(family_handle)

                    children = []
                    grandChildren = []
                    for childRef in family.get_child_ref_list():
                        child = self._db.get_person_from_handle(childRef.ref)
                        if (child.private
                                and self._incprivate) or not child.private:
                            children.append(self.getNameAndBirthDeath(child))
                            for family_handle2 in child.get_family_handle_list(
                            ):
                                family2 = self._db.get_family_from_handle(
                                    family_handle2)
                                for childRef2 in family2.get_child_ref_list():
                                    child2 = self._db.get_person_from_handle(
                                        childRef2.ref)
                                    if (child2.private and self._incprivate
                                        ) or not child2.private:
                                        grandChildren.append(
                                            self.getNameAndBirthDeath(child2))

                    if len(children) > 0:
                        # label += '<div style="text-align:left">'
                        label += lineDelimiter + 'Mehr Kinder: ' + unicode(
                            len(children))
                        if len(children) < 3:
                            for i in children:
                                if i:
                                    label += lineDelimiter + i
                        if len(grandChildren) > 0:
                            label += lineDelimiter + 'Enkel: ' + unicode(
                                len(grandChildren))
                            if len(grandChildren) < 3:
                                for i in grandChildren:
                                    if i:
                                        label += lineDelimiter + i
                        # label += '</small>'
                        # label += '</div>'

            # see if we have a table that needs to be terminated
            if imagePath:
                label += '</TD></TR></TABLE>'

            shape = "box"
            style = "solid"
            border = colour
            fill = colour

            # do not use colour if this is B&W outline
            if self._colorize == 'outline':
                border = ""
                fill = ""

            if gender == person.FEMALE and self._useroundedcorners:
                style = "rounded"
            elif gender == person.UNKNOWN:
                shape = "hexagon"

            # if we're filling the entire node:
            if self._colorize == 'filled':
                style += ",filled"
                border = ""

            # we're done -- add the node
            self.doc.add_node(person.get_gramps_id(),
                              label=label,
                              shape=shape,
                              color=border,
                              style=style,
                              fillcolor=fill,
                              htmloutput=bUseHtmlOutput)