本文整理汇总了Python中useless.xmlgen.base.BaseElement类的典型用法代码示例。如果您正苦于以下问题:Python BaseElement类的具体用法?Python BaseElement怎么用?Python BaseElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BaseElement类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _make_table
def _make_table(self, context, fields, rows, **atts):
table = BaseElement("table", bgcolor="MediumOrchid3", **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: __init__
def __init__(self, troubleid, info):
BaseElement.__init__(self, 'p')
self.created = TextElement('h4', 'Created: %s' % info['posted'])
self.appendChild(self.created)
p = BaseElement('p')
refresh = Anchor('refresh.page.%d' % troubleid, 'refresh')
p.appendChild(refresh)
self.appendChild(p)
示例3: _add_table_header
def _add_table_header(self, table, fields, **atts):
th = BaseElement('th', **atts)
trow = TR()
th.appendChild(trow)
for field in fields:
trow.appendChild(TxtTD(Bold(field)))
table.appendChild(th)
table.header = th
示例4: __init__
def __init__(self, rows, **atts):
BaseElement.__init__(self, 'table', **atts)
for row in rows:
trow = TR()
p = TxtTD(row.package)
trow.appendChild(p)
a = TxtTD(row.action)
trow.appendChild(a)
self.appendChild(trow)
示例5: __init__
def __init__(self, rows, **atts):
BaseElement.__init__(self, "table", **atts)
hrow = TR()
hrow.appendChild(TxtTD(Bold("Trait")))
hrow.appendChild(TxtTD(Bold("Order")))
self.appendChild(hrow)
for row in rows:
trow = TR()
trow.appendChild(TxtTD(row.trait))
trow.appendChild(TxtTD(row.ord))
self.appendChild(trow)
示例6: append_row
def append_row(self, name, value):
tr = BaseElement('tr')
self.appendChild(tr)
ttd = BaseElement('td')
vtd = BaseElement('td')
ttd.appendChild(Bold(name))
vtd.appendChild(TextElement('p', value))
tr.appendChild(ttd)
tr.appendChild(vtd)
row = self.firstChild
row.setAttribute('bgcolor', 'cornsilk')
示例7: __init__
def __init__(self, clientid, section, text):
BaseElement.__init__(self, 'h4')
node = Text()
node.data = text
self.appendChild(node)
p = BaseElement('p')
self.new = Anchor('new.%s.%s' % (section, clientid), 'new')
self.edit = Anchor('edit.%s.%s' % (section, clientid), 'edit')
p.appendChild(self.new)
p.appendChild(BaseElement('br'))
p.appendChild(self.edit)
self.appendChild(p)
示例8: set_machine
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'))
示例9: set_machine
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)
示例10: set_machine
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)
示例11: setID
def setID(self, clientid):
cdata = self.manager.getClientInfo(clientid)
cdata['addresses'].set_refobject('address', AddressRecord)
self.current = clientid
self.clear_body()
#make header
#self.header = ClientHeaderElement(cdata['client'])
self.header = ClientTitleElement(cdata['client'])
self.body.appendChild(self.header)
#make main table
self.mtable = BaseElement('table')
self.mtable.appendChild(BaseElement('tr'))
self.body.appendChild(self.mtable)
#append contacts header
conheader = ClientSectionHeader(self.current, 'contact', 'Contacts:')
self.mtable.firstChild.appendChild(TextElement('td', conheader))
self.contacts = ContactDoc(self.app)
self.mtable.firstChild.appendChild(TextElement('td', self.contacts))
#append locations header
row = BaseElement('tr')
locheader = ClientSectionHeader(self.current, 'location', 'Locations:')
row.appendChild(TextElement('td', locheader))
self.locations = LocationDoc(self.app)
self.mtable.appendChild(row)
row.appendChild(TextElement('td', self.locations))
#insert the contacts, locations and tickets
self.contacts.set_records(cdata['contacts'], action=None)
self.locations.set_records(cdata['locations'], action=None)
for node in self.contacts.records.values():
node.setAttribute('bgcolor', 'DarkSeaGreen3')
for node in self.locations.records.values():
node.setAttribute('bgcolor', 'DarkSeaGreen3')
self.records = cdata
#append tag data
#check for tag data
tags = self.manager.getTags(clientid)
row = BaseElement('tr')
tagdoc = ClientTagTableElement(clientid, tags)
row.appendChild(tagdoc)
self.mtable.appendChild(row)
newtrouble = Anchor('new.trouble.%s' % clientid, 'new trouble')
self.body.appendChild(newtrouble)
示例12: __init__
def __init__(self, record, **atts):
BaseElement.__init__(self, 'p', **atts)
node = Text()
node.data = self.makeParagraph(record)
self.appendChild(node)
示例13: _subjectdata
def _subjectdata(self, subject, action):
td = BaseElement("td")
font = BaseElement("font")
font.setAttribute("color", "gold")
element = TextElement("b", subject)
font.appendChild(element)
td.appendChild(font)
font = BaseElement("font")
font.setAttribute("color", "yellow")
element = Text()
font.appendChild(element)
element.data = "(%s)" % action
td.appendChild(font)
return td