当前位置: 首页>>代码示例>>Python>>正文


Python BaseElement.appendChild方法代码示例

本文整理汇总了Python中useless.xmlgen.base.BaseElement.appendChild方法的典型用法代码示例。如果您正苦于以下问题:Python BaseElement.appendChild方法的具体用法?Python BaseElement.appendChild怎么用?Python BaseElement.appendChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在useless.xmlgen.base.BaseElement的用法示例。


在下文中一共展示了BaseElement.appendChild方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from useless.xmlgen.base import BaseElement [as 别名]
# 或者: from useless.xmlgen.base.BaseElement import appendChild [as 别名]
 def __init__(self, fields, idcol, action, record, **atts):
     BaseElement.__init__(self, 'table', **atts)
     self.record = record
     refdata = None
     if hasattr(record, '_refdata'):
         refdata = record._refdata
     for field in fields:
         row = BaseElement('tr')
         key = TD(bgcolor='DarkSeaGreen')
         key.appendChild(Bold(field))
         row.appendChild(key)
         val = TD()
         if refdata is not None and field in refdata.cols:
             ridcol = refdata.cols[field]
             refrec =  refdata.data[field][record[ridcol]]
             node = refdata.object[field](refrec)
             if action:
                 url = '.'.join(map(str, [action, field, record[idcol]]))
                 val.appendChild(Anchor(url, node))
             else:
                 val.appendChild(node)
         elif action:
             url = '.'.join(map(str, [action, field, record[idcol]]))
             val.appendChild(Anchor(url, record[field]))
         else:
             node = Text()
             node.data = record[field]
             val.appendChild(node)
         row.appendChild(val)
         self.val = val
         self.key = key
         self.appendChild(row)
开发者ID:BackupTheBerlios,项目名称:paella-svn,代码行数:34,代码来源:xmlgen.py

示例2: __init__

# 需要导入模块: from useless.xmlgen.base import BaseElement [as 别名]
# 或者: from useless.xmlgen.base.BaseElement import appendChild [as 别名]
 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)
开发者ID:BackupTheBerlios,项目名称:konsultant-svn,代码行数:10,代码来源:xmlgen.py

示例3: _add_table_header

# 需要导入模块: from useless.xmlgen.base import BaseElement [as 别名]
# 或者: from useless.xmlgen.base.BaseElement import appendChild [as 别名]
 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
开发者ID:BackupTheBerlios,项目名称:paella-svn,代码行数:10,代码来源:xmlgen.py

示例4: set_machine

# 需要导入模块: from useless.xmlgen.base import BaseElement [as 别名]
# 或者: from useless.xmlgen.base.BaseElement import appendChild [as 别名]
 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'))
开发者ID:BackupTheBerlios,项目名称:paella-svn,代码行数:19,代码来源:xmlgen.py

示例5: __init__

# 需要导入模块: from useless.xmlgen.base import BaseElement [as 别名]
# 或者: from useless.xmlgen.base.BaseElement import appendChild [as 别名]
    def __init__(self, subject, action, author, posted):
        BaseElement.__init__(self, "table")
        # self.app  = app
        self.setAttribute("border", "0")
        self.setAttribute("width", "100%")
        self.setAttribute("cellpadding", "2")
        self.setAttribute("cellspacing", "0")
        self.setAttribute("bgcolor", "cornsilk4")
        row = BaseElement("tr")
        self.appendChild(row)
        td = self._subjectdata(subject, action)
        row.appendChild(td)

        row = BaseElement("tr")
        self.appendChild(row)
        row.setAttribute("bgcolor", "bisque4")
        td = self._subjectdata(author, posted)
        row.appendChild(td)
开发者ID:BackupTheBerlios,项目名称:konsultant-svn,代码行数:20,代码来源:xmlgen.py

示例6: set_machine

# 需要导入模块: from useless.xmlgen.base import BaseElement [as 别名]
# 或者: from useless.xmlgen.base.BaseElement import appendChild [as 别名]
 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)
开发者ID:BackupTheBerlios,项目名称:paella-svn,代码行数:20,代码来源:main.py

示例7: set_machine

# 需要导入模块: from useless.xmlgen.base import BaseElement [as 别名]
# 或者: from useless.xmlgen.base.BaseElement import appendChild [as 别名]
 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)
开发者ID:BackupTheBerlios,项目名称:paella-svn,代码行数:21,代码来源:xmlgen.py

示例8: _subjectdata

# 需要导入模块: from useless.xmlgen.base import BaseElement [as 别名]
# 或者: from useless.xmlgen.base.BaseElement import appendChild [as 别名]
    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
开发者ID:BackupTheBerlios,项目名称:konsultant-svn,代码行数:18,代码来源:xmlgen.py

示例9: append_row

# 需要导入模块: from useless.xmlgen.base import BaseElement [as 别名]
# 或者: from useless.xmlgen.base.BaseElement import appendChild [as 别名]
 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')
开发者ID:BackupTheBerlios,项目名称:konsultant-svn,代码行数:13,代码来源:xmlgen.py

示例10: ClientInfoDoc

# 需要导入模块: from useless.xmlgen.base import BaseElement [as 别名]
# 或者: from useless.xmlgen.base.BaseElement import appendChild [as 别名]
class ClientInfoDoc(BaseDocument):
    def __init__(self, app):
        BaseDocument.__init__(self, app)
        self.manager = ClientManager(self.app)
        self.body.setAttribute('text', '#000000')
        self.body.setAttribute('background', 'Time-For-Lunch-2.jpg')

    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)
开发者ID:BackupTheBerlios,项目名称:konsultant-svn,代码行数:52,代码来源:xmlgen.py


注:本文中的useless.xmlgen.base.BaseElement.appendChild方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。