def __init__(self, clientid): atts = dict(border='0', cellpadding='5', bgcolor='cornsilk4', width='100%') SimpleTitleElement.__init__(self, 'Extra Information',**atts) td = self.row.firstChild.firstChild td.appendChild(Anchor('edit.tags.%d' % clientid, 'edit')) self.set_font(color='gold')
def __init__(self, title): atts = dict(border='0', cellpadding='5', bgcolor='cornsilk4', width='100%') SimpleTitleElement.__init__(self, title, **atts) td = self.row.firstChild.firstChild td.appendChild(Anchor('edit.client.%s' % title, 'edit')) self.set_font(color='gold')
def _setup_section(self, name, fields, rows): title = SimpleTitleElement(name) title.set_font(color='DarkViolet') td = TD() anchor = Anchor('new.%s.mtype' % name, 'new') td.appendChild(anchor) title.row.appendChild(td) self.body.appendChild(title) if len(rows): table = self._make_table(name, fields, rows, border=1, cellspacing=1) color_header(table, 'MediumOrchid2') self.body.appendChild(table)
def set_profile(self, profile): self.clear_body() self.profile.set_profile(profile) title = SimpleTitleElement('Profile: %s' % profile, bgcolor='IndianRed', width='100%') self.body.appendChild(title) rows = self.profile.get_trait_rows() ptitle = Anchor('edit.traits.%s' % self.profile.current.profile, 'Traits') self.body.appendChild(SectionTitle(ptitle)) #self.body.appendChild(SectionTitle('Traits')) if len(rows): self.body.appendChild(TraitTable(rows, bgcolor='IndianRed1')) vtitle = Anchor('edit.variables.%s' % self.profile.current.profile, 'Variables') self.body.appendChild(SectionTitle(vtitle)) erows = self.profile._env.get_rows() if len(erows): self.body.appendChild(PVarTable(erows, bgcolor='MistyRose2')) etitle = Anchor('edit.families.%s' % self.profile.current.profile, 'Families') self.body.appendChild(SectionTitle(etitle)) families = self.profile.get_families() flist = UnorderedList() for f in families: flist.appendChild(ListItem(f)) self.body.appendChild(flist)
def set_machine_type(self, machine_type): clause = Eq('machine_type', machine_type) self.clear_body() self.mtype.set_machine_type(machine_type) title = SimpleTitleElement('MachineType: %s' % machine_type, bgcolor='IndianRed', width='100%') self.body.appendChild(title) rows = self.cursor.select(table='machine_disks', clause=clause) self._setup_section('Disks', ['diskname', 'device'], rows) modrows = self.cursor.select(table='machine_modules', clause=clause, order=['ord']) self._setup_section('Modules', ['module', 'ord'], modrows) famrows = self.cursor.select(table='machine_type_family', clause=clause, order='family') self._setup_section('Families', ['family'], famrows) scripts = self.cursor.select(table='machine_type_scripts', clause=clause, order='script') self._setup_section('Scripts', ['script'], scripts) vars_ = self.cursor.select(table='machine_type_variables', clause=clause, order=['trait', 'name']) self._setup_section('Variables', ['trait', 'name', 'value'], vars_) self._make_footer_anchors('machine_type', machine_type)
def set_clause(self, clause): print 'clause---->', clause, type(clause) self.cursor.clause = clause self.clear_body() title = SimpleTitleElement('%s Packages' % self.suite, bgcolor='IndianRed', width='100%') self.body.appendChild(title) for row in self.cursor.select(clause=clause): self.body.appendChild(PackageFieldTable(row, bgcolor='MistyRose2')) self.body.appendChild(HR())
def set_clause(self, clause): print 'clause---->', clause, type(clause) #self.machine.cursor.clause = clause self.clear_body() title = SimpleTitleElement('Machines', bgcolor='IndianRed', width='100%') self.body.appendChild(title) for row in self.machine.cursor.select(clause=clause): self.body.appendChild(MachineFieldTable(row, bgcolor='MistyRose3')) self.body.appendChild(HR())
def set_trait(self, trait): self.clear_body() self.trait.set_trait(trait) title = SimpleTitleElement('Trait: %s' % trait, bgcolor='IndianRed', width='100%') self.body.appendChild(title) self.body.appendChild(HR()) plist = UnorderedList() parents = self.trait.parents(trait=trait) parent_section = SectionTitle('Parents') parent_section.create_rightside_table() parent_section.append_rightside_anchor( Anchor('hello.there.dude', 'edit')) parent_section.append_rightside_anchor( Anchor('hello.there.dudee', 'edit2')) self.body.appendChild(parent_section) for parent in parents: pp = Anchor('show.parent.%s' % parent, parent) plist.appendChild(ListItem(pp)) self.body.appendChild(plist) #ptitle_anchor = Anchor('edit.packages.%s' % trait, 'Packages') ptitle = SectionTitle('Packages') ptitle_anchor = Anchor('new.package.%s' % trait, '(new)') td = TD() td.appendChild(ptitle_anchor) ptitle.row.appendChild(td) self.body.appendChild(ptitle) rows = self.trait.packages(trait=trait, action=True) self.body.appendChild(PackageTable(rows, bgcolor='SkyBlue3')) ttitle = Anchor('edit.templates.%s' % trait, 'Templates') self.body.appendChild(SectionTitle(ttitle)) rows = self.trait.templates( trait=trait, fields=['package', 'template', 'templatefile']) if len(rows): self.body.appendChild(TemplateTable(rows, bgcolor='DarkSeaGreen3')) self.body.appendChild(SectionTitle('Variables', href='foo.var.ick')) if len(self.trait.environ.keys()): env = TraitEnvTable(trait, self.trait.environ, bgcolor='MistyRose3') self.body.appendChild(env) self.body.appendChild(SectionTitle('Scripts')) slist = UnorderedList() for row in self.trait._scripts.scripts(trait=trait): script = row.script sa = Anchor('show.script.%s' % script, script) slist.appendChild(ListItem(sa)) self.body.appendChild(slist)
def set_filesystem(self, filesystem): clause = Eq('filesystem', filesystem) self.clear_body() title = SimpleTitleElement('Filesystem: %s' % filesystem, bgcolor='IndianRed', width='100%') self.body.appendChild(title) self.body.appendChild(TextElement('h2', 'Filesystem Mounts')) rows = self.cursor.select(table='filesystem_mounts', clause=clause, order=['ord']) fields = ['mnt_name', 'partition', 'ord'] mounttable = self._make_table(fields, rows, bgcolor='DarkSeaGreen') self.body.appendChild(mounttable) self._make_footer_anchors('filesystem', filesystem)
def set_family(self, family): self.family.set_family(family) parents = self.family.parents() erows = self.family.environment_rows() self.clear_body() title = SimpleTitleElement('Family: %s' % family, bgcolor='IndianRed', width='100%') self.body.appendChild(title) self.body.appendChild(SectionTitle('Parents')) if len(parents): plist = UnorderedList() for p in parents: plist.appendChild(ListItem(p)) self.body.appendChild(plist) self.body.appendChild(SectionTitle('Variables')) if len(erows): self.body.appendChild(PVarTable(erows, bgcolor='MistyRose2'))
def set_machine(self, machine): self.machine.set_machine(machine) self.clear_body() title = SimpleTitleElement('Machine: %s' % machine, bgcolor='IndianRed', width='100%') self.body.appendChild(title) mtable = BaseElement('table') for k,v in self.machine.current.items(): trow = TR() trow.appendChild(TxtTD(Bold(k))) trow.appendChild(TxtTD(v)) mtable.appendChild(trow) self.body.appendChild(mtable) self.body.appendChild(SectionTitle('Machine Type')) self.body.appendChild(SectionTitle('Kernel')) self.body.appendChild(SectionTitle('Profile')) self.body.appendChild(SectionTitle('Filesystem'))
def set_machine(self, machine): self.machine.set_machine(machine) self.clear_body() title = SimpleTitleElement('Machine: %s' % machine, bgcolor='IndianRed', width='100%') self.body.appendChild(title) mtable = BaseElement('table') for k, v in self.machine.current.items(): trow = TR() trow.appendChild(TxtTD(Bold(k))) trow.appendChild(TxtTD(v)) mtable.appendChild(trow) self.body.appendChild(mtable) newanchor = Anchor('new.machine.foo', 'new') editanchor = Anchor('edit.machine.%s' % machine, 'edit') self.body.appendChild(HR()) self.body.appendChild(editanchor) self.body.appendChild(BR()) self.body.appendChild(newanchor)
def set_machine_type(self, machine_type): clause = Eq('machine_type', machine_type) self.clear_body() title = SimpleTitleElement('MachineType: %s' % machine_type, bgcolor='IndianRed', width='100%') self.body.appendChild(title) self.body.appendChild(TextElement('h1', 'Machine Disks')) rows = self.cursor.select(table='machine_disks', clause=clause) fields = ['diskname', 'device'] disktable = self._make_table(fields, rows) disktable.header.firstChild.setAttribute('bgcolor', 'cornsilk3') self.body.appendChild(disktable) modrows = self.cursor.select(table='machine_modules', clause=clause, order=['ord']) if len(modrows): self.body.appendChild(TextElement('h1', 'Machine Modules')) modtable = self._make_table(['module', 'ord'], modrows) modtable.header.firstChild.setAttribute('bgcolor', 'cornsilk3') self.body.appendChild(modtable) self._make_footer_anchors('machine_type', machine_type)
def __init__(self, text, **atts): atts["width"] = "75%" atts["bgcolor"] = "IndianRed" SimpleTitleElement.__init__(self, text, **atts)
def __init__(self, **attributes): SimpleTitleElement.__init__(self, 'Locations', **attributes) self.set_font(color='plum')
def __init__(self, text, **atts): atts['width'] = '75%' atts['bgcolor'] = 'IndianRed' SimpleTitleElement.__init__(self, text, **atts)