예제 #1
0
 def _make_table(self, context, fields, rows, **atts):
     table = Table(bgcolor=self._bgcolor_table, **atts)
     table.context = context
     self._add_table_header(table, fields + ['command'])
     for row in rows:
         self._add_table_row(table, fields, row)
     return table
예제 #2
0
 def _make_script_table(self, scripts, **atts):
     table = Table(bgcolor=self._bgcolor_table, **atts)
     table.context = 'Scripts'
     fields = ['script', 'inherited', 'command']
     self._add_table_header(table, fields)
     for scriptname, parent in scripts:
         self._add_script_table_row(table, scriptname, parent)
     return table
예제 #3
0
 def _make_variables_table(self, rows, **atts):
     table = Table(bgcolor=self._bgcolor_table, **atts)
     table.context = 'Variables'
     fields = ['trait', 'name', 'value']
     self._add_table_header(table, fields + ['command'])
     for row in rows:
         self._add_variables_table_row(table, fields, row)
     return table
예제 #4
0
 def refresh_page(self):
     self.clear_body()
     title = SectionTitle('Kernels')
     self.body.append(title)
     kernels = self.kernels.get_kernels()
     table = Table()
     self.body.append(table)
     for kernel in kernels:
         tablerow = TableRow()
         cell = TableCell(kernel)
         tablerow.append(cell)
         del_anchor = Anchor('(delete)', href='delete||kernel||%s' % kernel)
         cell = TableCell(del_anchor)
         tablerow.append(cell)
         table.append(tablerow)
예제 #5
0
 def _make_scripts_table(self, trait):
     rows = self.trait._scripts.scripts(trait=trait)
     if rows:
         bgcolor = self.cfg.get('management_gui',
                                'traitdoc_variables_table_color')
         table = Table(bgcolor=bgcolor)
         for row in rows:
             script = row.script
             sa = Anchor(script, href='show.script.%s' % script)
             ea = Anchor('(edit)', href='edit.script.%s' % script)
             da = Anchor('(delete)', href='delete.script.%s' % script)
             trow = TableRow()
             trow.append(TableCell(sa))
             trow.append(TableCell(ea))
             trow.append(TableCell(da))
             table.append(trow)
         return table
예제 #6
0
 def set_machine(self, machine):
     self.machine.set_machine(machine)
     self.clear_body()
     title = SectionTitle('Machine:  %s' % machine)
     title['bgcolor'] = 'IndianRed'
     title['width'] = '100%'
     self.body.append(title)
     mtable = Table()
     for k, v in self.machine.current.items():
         tablerow = TableRow()
         tablerow.append(TableCell(Bold(k)))
         tablerow.append(TableCell(v))
         mtable.append(tablerow)
     self.body.append(mtable)
     newanchor = Anchor('new', href='new.machine.foo')
     editanchor = Anchor('edit', href='edit.machine.%s' % machine)
     self.body.append(Ruler())
     self.body.append(editanchor)
     self.body.append(Break())
     self.body.append(newanchor)
예제 #7
0
 def _setup_main_attributes(self):
     machine = self.machine.current_machine
     attribute_table = Table(bgcolor=self._bgcolor_table, border=1)
     headrow = TableRow(bgcolor=self._bgcolor_thead)
     for col in ['Attribute', 'Value', 'Inherited From', 'Command']:
         headrow.append(TableHeader(col))
     attribute_table.append(headrow)
     for attribute in ['kernel', 'profile', 'diskconfig']:
         errormsg = ''
         try:
             value, inherited_from = self.machine.get_attribute(attribute)
         except AttributeUnsetInAncestryError:
             errormsg = "WARNING: not set anywhere"
             value, inherited_from = errormsg, errormsg
         tablerow = TableRow()
         href = 'select.attribute||%s.%s' % (attribute, machine)
         anchor = Anchor(attribute, href=href)
         cell = TableCell(Bold(anchor, ':'))
         tablerow.append(cell)
         cell = TableCell(value)
         tablerow.append(value)
         cell = TableCell()
         if inherited_from is not None:
             if errormsg:
                 anchor = Bold(errormsg)
             else:
                 anchor = Anchor(inherited_from,
                                 href='select.machine.%s' % inherited_from)
             cell.append(anchor)
         else:
             cell.append('(set here)')
         tablerow.append(cell)
         cell = TableCell()
         anchor = Anchor('clear',
                         href='delete.attribute||%s.%s' %
                         (attribute, machine))
         if inherited_from is None:
             cell.set(anchor)
         tablerow.append(cell)
         attribute_table.append(tablerow)
     self.body.append(attribute_table)
예제 #8
0
 def set_suite(self, suite):
     self.suite = suite
     self.cursor.set_suite(suite)
     self.clear_body()
     attributes = dict(bgcolor='IndianRed', width='100%')
     title = SimpleTitleElement('Suite:  %s' % suite, **attributes)
     title.cell.attributes['align'] = 'center'
     self.body.append(title)
     apt_rows = self.cursor.get_apt_rows()
     if len(apt_rows):
         aptsrc_table = Table(bgcolor='khaki')
         self.body.append(aptsrc_table)
         fields = ['apt_id', 'uri', 'dist', 'sections', 'local_path']
         headrow = TableRow()
         for field in fields:
             headrow.append(TableCell(Bold(field)))
         for row in apt_rows:
             tblrow = TableRow()
             aptsrc_table.append(tblrow)
             for field in fields:
                 tblrow.append(TableCell(row[field]))
예제 #9
0
 def _setup_parent_table(self):
     machine = self.machine.current_machine
     parent_table = Table(bgcolor=self._bgcolor_table, border=1)
     parent = self.machine.parent
     if parent is None:
         parent = '(No Parent Set)'
     headrow = TableRow(bgcolor=self._bgcolor_thead)
     for col in ['parent', 'command']:
         headrow.append(TableHeader(col))
     parent_table.append(headrow)
     mainrow = TableRow()
     parent_cell = TableCell(parent)
     mainrow.append(parent_cell)
     select_anchor = Anchor('select', href='select.parent.%s' % machine)
     delete_anchor = Anchor('delete', href='delete.parent.%s' % machine)
     command_cell = TableCell()
     command_cell.append(select_anchor)
     if self.machine.parent is not None:
         #command_cell.append(Break())
         command_cell.append('|=====|')
         command_cell.append(delete_anchor)
     mainrow.append(command_cell)
     parent_table.append(mainrow)
     self.body.append(parent_table)
예제 #10
0
 def _make_table(self, fields, rows, **atts):
     table = Table(**atts)
     self._add_table_header(table, fields)
     for row in rows:
         self._add_table_row(table, fields, row)
     return table