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

12.7. formSet._addRow(): Generate one row of the table

This method translates one ArchImage instance into a table row.

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

    def _addRow(self, tbody, archImage):
        '''Add one row to the table.

          [ (tbody is an et.Element) and
            (archImage is an archx.ArchImage) ->
              tbody  :=  tbody with a tr element added containing
                  the thumbnail and data from archImage ]
        '''
        #-- 1
        # [ tbody  :=  tbody with a new, empty tr element added
        #   tr     :=  that tr element ]
        tr = subElement(tbody, E.tr())

Just to keep things uncomplicated, we'll delegate production of each of the three cells in the row to separate methods.

catweb
        #-- 2
        # [ tr  :=  tr with a new td added containing the
        #           thumbnail for archImage ]
        self._addThumbnail(tr, archImage)

        #-- 3
        # [ tr  :=  tr with a new td added containing size data
        #           from archImage ]
        self._addSize(tr, archImage)

        #-- 4
        # [ tr  :=  tr with a new td added containing general
        #           data from archImage)
        self._addData(tr, archImage)