예제 #1
0
 def set_options(self, items):
     hrow = TableRow()
     self.set(hrow)
     hrow.append(TableHeader('Option'))
     hrow.append(TableHeader('Value'))
     for k, v in items:
         row = TableRow()
         self.append(row)
         row.append(TableCell(k))
         row.append(TableCell(str(v)))
예제 #2
0
 def _add_table_header(self, table, fields, **atts):
     if atts:
         print 'Warning, use of atts here is questionable', atts
         print 'in _MachineBaseDocument._add_table_header'
     tablerow = TableRow(**atts)
     table.append(tablerow)
     for field in fields:
         tablerow.append(TableHeader(Bold(field)))
     # we should check if we need the header attribute here
     table.header = tablerow
예제 #3
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)
예제 #4
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)