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

12.6. formSet._buildTable(): Build the image table

This method builds the table that holds the thumbnails and image data. For the XHTML, see Section 4.3, “XHTML for the form page”.

catweb
# - - -   F o r m P h o t o S e t . _ _ b u i l d T a b l e

    def _buildTable(self, body):
        '''Build the XHTML table.

          [ body  :=  body with a table added containing
                thumbnails and catalog data from self ]
        '''
        #-- 1
        # [ body  :=  body with a new table element
        #   table  :=  that table element ]
        table = subElement(body,
            E.table(dict(border='4', cellspacing='4'),
                E.colgroup(
                    E.col(ALIGN_CENTER),
                    E.col(ALIGN_CENTER, VALIGN_TOP),
                    E.col(ALIGN_CENTER, VALIGN_TOP)),
                E.thead(
                    E.tr(
                        E.th(ALIGN_CENTER, "Thumbnail"),
                        E.th(ALIGN_CENTER, "Size"),
                        E.th(ALIGN_CENTER, "Data")))))

        #-- 2
        # [ table  :=  table with a tbody element added
        #   tbody  :=  that tbody element ]
        tbody = subElement(table, E.tbody())

Finally, we add a row to the table for each contained ArchImage object.

catweb
        #-- 3
        # [ tbody  :=  tbody with rows added representing the
        #       ArchImages in self, in key order ]
        for archImage in self.genArchImages():
            #-- 3 body
            # [ archImage is an archx.ArchImage ->
            #     tbody  :=  tbody with a row added representing
            #                archImage ]
            self._addRow(tbody, archImage)