def __init__(self, subhead='subhead', image_=None, **args): Table.__init__(self, width='100%', class_='mainheader', colspan=0, **args) atts = {'class' : 'mainheader'} self.h1 = Header('hello there', 1) self.h2 = Header(subhead, 2) toprow = TableRow(**atts) if image_ is None: image_ = Image() self._image = image_ toprow.append(TableCell(image_, align='left', **atts)) toprow.append(TableCell(self.h1, align='center', **atts)) self.append(toprow) self.append(TableRow(TableCell(self.h2, colspan=3, align='center', **atts), **atts))
class MainHeader(Table): def __init__(self, subhead='subhead', image_=None, **args): Table.__init__(self, width='100%', class_='mainheader', colspan=0, **args) atts = {'class' : 'mainheader'} self.h1 = Header('hello there', 1) self.h2 = Header(subhead, 2) toprow = TableRow(**atts) if image_ is None: image_ = Image() self._image = image_ toprow.append(TableCell(image_, align='left', **atts)) toprow.append(TableCell(self.h1, align='center', **atts)) self.append(toprow) self.append(TableRow(TableCell(self.h2, colspan=3, align='center', **atts), **atts)) def set_h1(self, info): self.h1.set(info) def set_h2(self, info): self.h2.set(info) def set_image(self, **atts): self._image.attributes.update(atts)