Next / Previous / Contents / Shipman's homepage

23.23. MonthCell.__sightNotes(): Render a sighting notes group

For an overview of the generated output, see Section 4.11, “XHTML rendering of sighting notes”.

noteweb
# - - -   M o n t h C e l l . _ _ s i g h t N o t e s

    def __sightNotes ( self, parent, sightNotes ):
        '''Render sighting-notes content into XHTML.

          [ (parent is an et.Element) and
            (sightNotes is a birdnotes.SightNotes instance) ->
              parent  +:=  XHTML rendering of birdForm.sightNotes ]
        '''

We'll use the method described in Section 23.15, “MonthCell.__annoBlock(): Annotation block with a label” to generate div elements with run-in initial labels.

noteweb
        #-- 1 --
        # [ if sightNotes.desc is not None ->
        #     parent  +:=  XHTML rendering of sightNotes.desc
        #   else -> I ]
        if sightNotes.desc is not None:
            self.__annoBlock ( parent, 'Description:', sightNotes.desc )
                              
        #-- 2 --
        # [ simile ]
        if sightNotes.behavior is not None:
            self.__annoBlock ( parent, 'Behavior:', sightNotes.behavior )

        #-- 3 --
        if sightNotes.voc is not None:
            self.__annoBlock ( parent, 'Vocalizations:',
                               sightNotes.voc )
        
        #-- 4 --
        if sightNotes.breeding is not None:
            self.__annoBlock ( parent, 'Breeding:',
                               sightNotes.breeding )

Next come the photos. If there are any, they are placed in a child div class='para' below.

noteweb
        #-- 5 --
        # [ parent  +:=  rendering of photos in sightNotes, if any ]
        photoList  =  [ x for x in sightNotes.genPhotos() ]
        if  len(photoList) > 0:
            photoDiv  =  et.SubElement ( parent, 'div' )
            photoDiv.attrib['class']  = PARA_CLASS
            for photo in photoList:
                self.__photo ( photoDiv, photo )

The sightNotes.notes content, if any, is not labeled; see Section 23.16, “MonthCell.__narrative(): Render a Narrative instance”.

noteweb
        #-- 6 --
        if sightNotes.notes is not None:
            self.__narrative ( parent, sightNotes.notes )