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 _make_footer_anchors(self, name, value): newanchor = Anchor('new.%s.foo' % name, 'new') editanchor = Anchor('edit.%s.%s' % (name, value), 'edit') deleteanchor = Anchor('delete.%s.%s' % (name, value), 'delete') self.body.appendChild(HR()) self.body.appendChild(editanchor) self.body.appendChild(BR()) self.body.appendChild(deleteanchor) self.body.appendChild(BR()) self.body.appendChild(newanchor)
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_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)