Next / Previous / Contents / TCC Help System / NM Tech homepage

12.10. FormPhotoSet._addData(): Add the cataloging data cell

This method adds all the remaining catalog data to the third column of the table row. First we add the cell's td element.

catweb
# - - -   F o r m P h o t o S e t . _ _ a d d D a t a

    def _addData(self, tr, archImage):
        '''Add the catalog data cell to the table row.

          [ (tr is an et.Element) and
            (archImage is an archx.ArchImage) ->
              tr  :=  tr with a new td added containing general
                      data from archImage)
        '''
        #-- 1
        # [ tr  :=  tr with a new td element added
        #   td  :=  that new td element ]
        td = subElement(tr,
                 E.td(ALIGN_LEFT, VALIGN_TOP, CLASS(CSS_CAT_INFO)))

The elements inside this cell are stacked vertically using div elements. The first div holds the catalog number, state, and locality. The catalog number is additionally wrapped in a span element of class cat-no.

catweb
        #-- 2
        # [ td  :=  td with a new div element added containing
        #       the catalog number and state code from archImage ]
        #   majorDiv  :=  that new div ]
        majorDiv = subElement(td,
            E.div(CLASS(CSS_IDENT),
                E.span(CLASS(CSS_CAT_NO),
                       archImage.original.catNo, " ",
                       archImage.original.state.upper())))

Add the locality data (and the colon that precedes it) only if there is locality data.

catweb
        #-- 3
        # [ majorDiv  :=  majorDiv with archImage's state and
        #                 locality added ]
        if  archImage.original.loc:
            text = archImage.original.loc
            addText(majorDiv, u": {0}".format(text))

Eventually we'll add special divs for each element such as pose, beh, and so on. For now, just put up the note content.

catweb
        #-- 4
        # [ td  :=  td with a new div element added containing
        #           archImage.original.note ]
        if  archImage.original.note:
            td.append(
                E.div(archImage.original.note))