class SimpleTitleElement(Table): def __init__(self, title, **attributes): Table.__init__(self, **attributes) self.row = TableRow() self.cell = TableCell() self.set(self.row) self.row.set(self.cell) self.h1 = Header(level=1) self._font = Font(color='gold') self.cell.set(self.h1) self.h1.set(self._font) self.set_title(title) def set_font(self, **attributes): self._font.attributes.clear() self._font.attributes.update(attributes) def set_title(self, title): self._title = title self._font.set(self._title) # use this to make action links to the right of the title def create_rightside_table(self): self._rstable = Table(border=0) self.row.append(TableCell(self._rstable, align='right')) def append_rightside_anchor(self, anchor): row = TableRow() self._rstable.append(row) cell = TableCell(align='right', rowspan=1) row.set(cell) font = Font(color='gold') cell.set(font) font.set(anchor)
def set_filesystem(self, filesystem): clause = Eq('filesystem', filesystem) self.clear_body() title = SectionTitle('Filesystem: %s' % filesystem) attributes = dict(bgcolor='IndianRed', width='100%') title.attributes.update(attributes) self.body.append(title) self.body.append(Header('Filesystem Mounts', level=2)) rows = self.cursor.select(table='filesystem_mounts', clause=clause, order=['ord']) fields = ['mnt_name', 'partition', 'ord', 'size'] mounttable = self._make_table(fields, rows, bgcolor='DarkSeaGreen') self.body.append(mounttable) self.body.append(Ruler()) self.body.append(Header('Fstab for %s' % filesystem, level=2)) fstab = self.mtype.make_fstab(filesystem) self.body.append(Pre(fstab)) self._make_footer_anchors('filesystem', filesystem)
def __init__(self, title, **attributes): Table.__init__(self, **attributes) self.row = TableRow() self.cell = TableCell() self.set(self.row) self.row.set(self.cell) self.h1 = Header(level=1) self._font = Font(color='gold') self.cell.set(self.h1) self.h1.set(self._font) self.set_title(title)
def set_disk(self, diskname): clause = Eq('diskname', diskname) self.clear_body() title = SectionTitle('Disk: %s' % diskname) attributes = dict(bgcolor='IndianRed', width='100%') title.attributes.update(attributes) self.body.append(title) self.body.append(Header('Partitions', level=2)) rows = self.cursor.select(table='partitions', clause=clause, order='partition') fields = ['partition', 'start', 'size', 'Id'] ptable = self._make_table(fields, rows, bgcolor='DarkSeaGreen') self.body.append(ptable) self._make_footer_anchors('disk', diskname)
def set_mount(self, mount): clause = Eq('mnt_name', mount) self.clear_body() title = SectionTitle('Mount: %s' % mount) attributes = dict(bgcolor='IndianRed', width='100%') title.attributes.update(attributes) self.body.append(title) self.body.append(Header('Mounts', level=2)) rows = self.cursor.select(table='mounts', clause=clause) fields = [ 'mnt_name', 'mnt_point', 'fstype', 'mnt_opts', 'dump', 'pass' ] mtable = self._make_table(fields, rows, bgcolor='DarkSeaGreen') self.body.append(mtable) self._make_footer_anchors('mount', mount)