Example #1
0
class OneCellTable(Table):
    def __init__(self, cell='One Cell', **args):
        Table.__init__(self, **args)
        self.mainrow = TableRow()
        self.cell = TableCell(cell)
        self.mainrow.set(self.cell)
        self.set(self.mainrow)

    def set_celldata(self, data):
        self.cell.set(data)
Example #2
0
class MainFooter(Table):
    def __init__(self, subhead='subhead', **args):
        Table.__init__(self, width='100%', _class='mainfooter', **args)
        self.anchors = []
    
        home = Anchor('Home', href='/')
        up = Anchor('Up', href='index')
        rel = Anchor('Reload', href='javascript:document.location.reload()')
        row = TableRow()
        row.extend(map(TableCell, [home, rel, up]))
        self._subhead = TableCell(subhead, colspan=3)
        head = TableRow(self._subhead)
        self.extend([head, row])

    def set_subhead(self, subhead):
        self._subhead.set(subhead)
Example #3
0
class MainFooterNew(Table):
    def __init__(self, subhead='subhead', **args):
        Table.__init__(self, width='100%', _class='mainfooter', **args)
        self.a_home = Anchor('Home', href='/')
        self.a_up = Anchor('Up', href='index')
        self.a_reload = Anchor('Reload', href='javascript:document.location.reload()')
        self.mainrow = TableRow()
        self.cell_subhead = TableCell(subhead)
        self.headrow = TableRow(self.cell_subhead)
        self.extend([self.headrow, self.mainrow])
        self.reset_nav_anchors()
        
    def reset_nav_anchors(self):
        anchors = [self.a_home, self.a_reload, self.a_up]
        self.mainrow.clear()
        self.mainrow.extend(anchors)
        
    def set_subhead(self, subhead):
        self.cell_subhead.set(subhead)
Example #4
0
class MainTable(Table):
    def __init__(self, page, **args):
        class_atts = dict(class_='maintable')
        headfoot_atts = dict(colspan=2)
        headfoot_atts.update(class_atts)
        Table.__init__(self, width='100%', **class_atts)
        self._header = MainHeader('hello')
        self._footer = MainFooter('hello')
        self._headcell = TableCell(self._header, **headfoot_atts)
        self._footcell = TableCell(self._footer, **headfoot_atts)
        headrow = TableRow(self._headcell, **class_atts)
        self.append(headrow)
        self._mainrow = TableRow(**class_atts)
        self._mainmenu = MainMenu(width='100%')
        self._mainmenu_cell = TableCell(self._mainmenu, rowspan=1,
                                        colspan=1, valign='top', **class_atts)
        self._mainrow.append(self._mainmenu_cell)
        self._mainpage = TableCell(page, width='75%', align='center', **class_atts)
        self._mainrow.append(self._mainpage)
        self.append(self._mainrow)
        footrow = TableRow(self._footcell, **class_atts)
        self.append(footrow)

    def update_mainpage_attributes(self, **atts):
        self._mainpage.attributes.update(atts)
        
    def set_page_data(self, page):
        self._mainpage.set(page)

    def append_page_data(self, item):
        self._mainpage.append(item)

    def clear_page_data(self):
        self._mainpage.clear()
        
    def set_header(self, data):
        self._header.set_h1(data)

    def set_header_image(self, **atts):
        self._header.set_image(**atts)
        
    def set_subhead(self, data):
        self._header.set_h2(data)
        
    def set_footer(self, data):
        self._footer.set_subhead(data)

    def set_mainrow(self, data, tablecell=False):
        if not tablecell:
            self._mainrow.set(data)
        else:
            raise IndexError, "not an index error, passing tablecell is unimplemented now"

    def reset_mainrow(self):
        self._mainrow.set(self._mainmenu_cell)
        self._mainrow.append(self._mainpage)

    def set_menu_entries(self, entries, header=None):
        self._mainmenu.set_new_entries(entries, header)

    def reset_menu_entries(self):
        self._mainmenu.reset_entries()