本文整理汇总了Python中nevow.tags.table函数的典型用法代码示例。如果您正苦于以下问题:Python table函数的具体用法?Python table怎么用?Python table使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了table函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: processTable
def processTable(t):
if len(t) < 1:
return
# If list of lists
if type(t[0]) == type([]):
return T.table(cellspacing="3", cellpadding="4") [ map(lambda x: processTR(x), t) ]
else:
return T.table(cellspacing="3", cellpadding="4") [ processTR(t) ]
开发者ID:ImHimanShoe,项目名称:Quillpad-Server,代码行数:9,代码来源:primaryHelper.py
示例2: render
def render(self, data):
r = []
i = 0
notpresent = T.td(_class="notpresent")[
T.acronym(title="Unable to get IP from ARP tables")["N/A"]]
for row in data:
mac = T.td[T.span(data=row[0], render=T.directive("mac"))]
if row[1] is not None:
r.append(T.tr(_class=(i%2) and "odd" or "even")
[mac, T.td[T.invisible(data=row[1],
render=T.directive("ip"))]])
else:
r.append(T.tr(_class=(i%2) and "odd" or "even")
[mac, notpresent])
i += 1
if len(r) == 1:
return [('FDB',
[T.span(data=data[0][0], render=T.directive("mac")),
data[0][1] and [", ", T.span(data=data[0][1],
render=T.directive("ip"))] or ""],
1)]
return [('FDB',
[len(r) == 20 and "20+" or len(r),
T.span(render=T.directive("tooltip"),
data=T.table(_class="mac")[
T.thead[T.td["MAC"], T.td["IP"]], r])],
len(r) == 20 and 21 or len(r))]
开发者ID:GennadySpb,项目名称:wiremaps,代码行数:27,代码来源:ports.py
示例3: render_sessions
def render_sessions(self, ctx, data):
if len(self.pytrans.sessions) <= 0:
return "No active sessions."
ret = tags.table(border=0, width="100%", cellspacing=5, cellpadding=2)
row = tags.tr[
tags.th["User"],
tags.th["Incoming Messages"],
tags.th["Outgoing Messages"],
tags.th["Connections"]
]
ret[row]
for key in self.pytrans.sessions:
jid = self.pytrans.sessions[key].jabberID
row = tags.tr[
tags.td[jid],
tags.td(align="center")[self.pytrans.serviceplugins[
'Statistics'].sessionstats[jid]['IncomingMessages']],
tags.td(align="center")[self.pytrans.serviceplugins[
'Statistics'].sessionstats[jid]['OutgoingMessages']],
tags.td(align="center")[
self.pytrans.serviceplugins['Statistics'].sessionstats[jid]['Connections']]
]
ret[row]
return ret
开发者ID:2mf,项目名称:pyicqt,代码行数:25,代码来源:handler.py
示例4: rend
def rend(self, data):
def row(k,v):
query, n, elapsed, rowCount = v
# if k[0].startswith("(count)"):
# rowCount = "(count) %s" % rowCount
return (elapsed, T.tr[T.td["%.2f (%.4f)" % (elapsed, elapsed / n)],
T.td[n],
T.td[T.pre[reindent(stripPrefixes(query))]],
T.td[repr(k[1]) or ''],
T.td["%.1f" % (rowCount / n)],
T.td[[T.div[self.shortFilename(s)] for s in
self.original.sources.get(k,'')]],
])
rows = [row(k,v) for k,v in self.original.counts.items()]
rows.sort(reverse=True)
return T.table(class_="queryProfile")[
T.tr[T.th["total secs (per)"],
T.th["count"],
T.th["query (with sample initBindings; prefixes hidden)"],
T.th["bound"],
T.th["avg rows"],
T.th["sources"]],
[r[1] for r in rows]]
开发者ID:drewp,项目名称:sparqlhttp,代码行数:25,代码来源:stats.py
示例5: render_settings
def render_settings(self, ctx, data):
settings = self.obj.settings[:]
if self.bse != 'Room':
settings.append('room')
if self.bse == 'Exit':
settings.append('destination')
lines = []
for setting in settings:
error = self.args.get('_%s__error' % setting, False)
if error:
cls = 'textlabel_error'
else:
cls = 'textlabel'
label = T.td(_class=cls)[setting]
val = self.obj.setting(setting)
if val is None:
val = getattr(self.obj, setting, None)
inpt = T.td[self.get_setting_widget(setting, val)]
lines.append(T.tr[label, inpt])
if self.bse != 'Room' and self.obj.container != self.obj.room:
label = T.td(_class="textlabel")['container']
inpt = T.td[self.container_widget(self.obj)]
lines.append(T.tr[label, inpt])
empty = T.td(_class='empty')['']
lines.append(T.tr[empty, empty])
submit = T.input(_type="submit", value=" Change ")
lines.append(T.tr[empty, T.td[submit]])
tbl = T.table(_class="center")[lines]
return T.form(action=".", method="POST")[tbl]
开发者ID:cryptixman,项目名称:tzmud,代码行数:34,代码来源:pages_edit.py
示例6: render_exits
def render_exits(self, ctx, data):
if self.bse != 'Room':
return ''
xs = self.obj.exits()
xs.sort(key=attrgetter('name'))
if xs:
lines = [T.h2(_class="section")['Exits:']]
rows = []
for x in xs:
tzid = x.tzid
destf = 'dest_%s' % tzid
namef = 'name_%s' % tzid
dest = x.destination
rows.append(T.tr[
T.td[self.deletelink_widget(x)],
T.td[self.editlink_widget(x)],
T.td[self.str_widget(namef, x.name, 20)],
T.td['-->'],
T.td[self.rooms_widget(destf, dest)],
T.td[self.editlink_widget(dest)],
T.td[T.input(_type="submit", value="update")]])
tbl = T.table(_class="center")[rows]
lines.append(tbl)
return T.form(action="/exits/update/", method="POST")[lines]
else:
return T.h2(_class="warn")['No exits']
开发者ID:cryptixman,项目名称:tzmud,代码行数:29,代码来源:pages_edit.py
示例7: render_pics
def render_pics(self, ctx, data):
rows = []
d = URIRef(ctx.arg('dir'))
for i, (pic, filename) in enumerate(sorted(picsInDirectory(self.graph, d))[:]):
img = T.img(src=[localSite(pic), '?size=thumb'],
# look these up in the graph
width=75, height=56,
onclick='javascript:photo.showLarge("%s")' %
(localSite(pic) + "?size=large"))
tableRow = T.table(class_="picRow")[T.tr[
T.td[T.a(href=localSite(pic))[filename]],
T.td[img],
T.td[
T.div["Depicts: ", T.input(type="text", class_="tags")],
T.div["Comment: ", T.input(type="text")],
],
]]
toCopy = "protoSectionSplitter"
if i ==0:
toCopy = "protoSectionBreak"
rows.append([T.raw('<script type="text/javascript">document.write(document.getElementById("%s").innerHTML);</script>' % toCopy),
tableRow])
return rows
开发者ID:drewp,项目名称:photo,代码行数:29,代码来源:edit.py
示例8: __init__
def __init__(self, other=None):
super().__init__()
self.other = other
self.header = tags.thead()
self.body = tags.tbody(border='1px solid black')
self.tag = tags.table(border='1 px solid black')[self.header, self.body]
self.functions = [self.setStyle]
开发者ID:UnionGospelMission,项目名称:TimeClock,代码行数:7,代码来源:Widget.py
示例9: render_menu
def render_menu(self, ctx, data):
request = inevow.IRequest(ctx)
username = request.getUser()
ret = tags.table(border=0, cellspacing=3, cellpadding=3)
row = tags.tr(valign="middle")
row[tags.td(_class="menuentry", width="150", align="center",
onclick="self.location='/account/'",
onmouseover="this.className='menuentrypressed';",
onmouseout="this.className='menuentry';")
[tags.a(_class="menuentry", href="/account/")["Account"]]]
if config.admins.count(username) > 0:
row[tags.td(_class="menuentry", width="150", align="center",
onclick="self.location='/status/'",
onmouseover="this.className='menuentrypressed';",
onmouseout="this.className='menuentry';")
[tags.a(_class="menuentry", href="/status/")["Status"]]]
row[tags.td(_class="menuentry", width="150", align="center",
onclick="self.location='/config/'",
onmouseover="this.className='menuentrypressed';",
onmouseout="this.className='menuentry';")
[tags.a(_class="menuentry", href="/config/")["Configuration"]]]
row[tags.td(_class="menuentry", width="150", align="center",
onclick="self.location='/controls/'",
onmouseover="this.className='menuentrypressed';",
onmouseout="this.className='menuentry';")
[tags.a(_class="menuentry", href="/controls/")["Controls"]]]
return ret
开发者ID:2mf,项目名称:pyicqt,代码行数:30,代码来源:handler.py
示例10: varTable
def varTable(usedVars):
return t.table(_class="variables")[[
t.tr(_class="varRow")[
t.td(_class="varName")[ key ],
t.td(_class="varValue")[ htmlrepr(value) ]
]
for (key, value) in usedVars
]]
开发者ID:StetHD,项目名称:nevow,代码行数:8,代码来源:failure.py
示例11: render_roster
def render_roster(self, ctx, data):
request = inevow.IRequest(ctx)
username = request.getUser()
ret = tags.table(border=0, cellspacing=5, cellpadding=2)
row = tags.tr(height=25)[
tags.th["UIN/Screen Name"],
tags.th["Nickname"],
tags.th["Network"],
tags.th["Avatar"],
tags.th["Status"]
]
ret[row]
roster = self.pytrans.xdb.getList("roster", username)
if not roster:
return ret
for item in roster:
if item[0][0].isdigit():
network = "ICQ"
else:
network = "AIM"
avatar = "-"
if not config.disableAvatars and item[1].has_key("shahash"):
avatar = tags.a(href=("/avatars/%s" % item[1]["shahash"]))[
tags.img(
border=0, height=25, src=("/avatars/%s" % item[1]["shahash"]))
]
nickname = "-"
if "nickname" in item[1]:
nickname = item[1]["nickname"]
else:
if username in self.pytrans.sessions and \
self.pytrans.sessions[username].ready:
c = self.pytrans.sessions[username].contactList.getContact(
"%[email protected]%s" % (item[0], config.jid))
if c.nickname and c.nickname != "":
nickname = c.nickname
status = "-"
if username in self.pytrans.sessions and \
self.pytrans.sessions[username].ready:
c = self.pytrans.sessions[username].contactList.getContact(
"%[email protected]%s" % (item[0], config.jid))
status = c.ptype
if not status:
status = c.show
if not status:
status = "available"
row = tags.tr(height=25)[
tags.td(height=25, align="middle")[item[0]],
tags.td(height=25, align="middle")[nickname],
tags.td(height=25, align="middle")[network],
tags.td(height=25, align="middle")[avatar],
tags.td(height=25, align="middle")[status]
]
ret[row]
return ret
开发者ID:2mf,项目名称:pyicqt,代码行数:56,代码来源:handler.py
示例12: render_webconsole_environments
def render_webconsole_environments(self):
return [
tags.h3()['Web console Environments'],
tags.table()[
tags.tr()[
tags.th()['Port'],
tags.td()[lumen.config['webport']],
],
],
]
开发者ID:unsouled,项目名称:lumen,代码行数:11,代码来源:webconsole.py
示例13: makeComplex
def makeComplex(self):
return tags.html[
tags.body[
tags.table(data=5)[
tags.tr[
tags.td[
tags.span(render=str)
],
]
]
]
]
开发者ID:perkinslr,项目名称:nevow-py3,代码行数:12,代码来源:test_flatstan.py
示例14: render_config
def render_config(self, ctx, data):
table = tags.table(border=0)
for key in config.__dict__.keys():
if key[0] == "_":
continue
if key.find("secret") >= 0:
setting = "**hidden**"
else:
setting = config.__dict__[key]
row = tags.tr[tags.td[key], tags.td["="], tags.td[setting]]
table[row]
return table
开发者ID:2mf,项目名称:pyicqt,代码行数:12,代码来源:handler.py
示例15: render_statistics
def render_statistics(self, ctx, data):
ret = tags.table(border=0, width="100%", cellspacing=5, cellpadding=2)
for key in self.pytrans.serviceplugins['Statistics'].stats:
label = lang.get("statistics_%s" % key, config.lang)
description = lang.get("statistics_%s_Desc" % key, config.lang)
row = tags.tr[
tags.th(align="right")[label + ":"],
tags.td[self.pytrans.serviceplugins['Statistics'].stats[key]],
tags.td[description]
]
ret[row]
return ret
开发者ID:2mf,项目名称:pyicqt,代码行数:13,代码来源:handler.py
示例16: htmlDict
def htmlDict(d):
return t.div(_class="dict")[
t.span(_class="heading")[
"Dictionary instance @ 0x%x" % id(d)
],
t.table(_class="dict")[[
t.tr[
t.td(_class="dictKey")[ k == '__builtins__' and 'builtin dictionary' or htmlrepr(k) ],
t.td(_class="dictValue")[ htmlrepr(v) ]
]
for k, v in d.items()
]]
]
开发者ID:StetHD,项目名称:nevow,代码行数:13,代码来源:failure.py
示例17: test_slots
def test_slots(self):
tag = tags.html[
tags.body[
tags.table(data={'one': 1, 'two': 2}, render=rend.mapping)[
tags.tr[tags.td["Header one."], tags.td["Header two."]],
tags.tr[
tags.td["One: ", tags.slot("one")],
tags.td["Two: ", tags.slot("two")]
]
]
]
]
self.assertEqual(self.render(tag), "<html><body><table><tr><td>Header one.</td><td>Header two.</td></tr><tr><td>One: 1</td><td>Two: 2</td></tr></table></body></html>")
开发者ID:perkinslr,项目名称:nevow-py3,代码行数:13,代码来源:test_flatstan.py
示例18: render_bayeux_environments
def render_bayeux_environments(self):
return [
tags.h3()['Bayeux Environmerts'],
tags.table()[
tags.tr()[
tags.th()['Port'],
tags.td()[lumen.config['port']],
],
tags.tr()[
tags.th()['Engine'],
tags.td()[lumen.config['engine']],
]
],
]
开发者ID:unsouled,项目名称:lumen,代码行数:14,代码来源:webconsole.py
示例19: test_nestedpatterns
def test_nestedpatterns(self):
def data_table(context, data): return [[1,2,3],[4,5,6]]
def data_header(context, data): return ['col1', 'col2', 'col3']
tag = tags.html[
tags.body[
tags.table(data=data_table, render=rend.sequence)[
tags.tr(pattern='header', data=data_header, render=rend.sequence)[
tags.td(pattern='item')[str]
],
tags.tr(pattern='item', render=rend.sequence)[
tags.td(pattern='item')[str]
]
]
]
]
self.assertEqual(self.render(tag), "<html><body><table><tr><td>col1</td><td>col2</td><td>col3</td></tr><tr><td>1</td><td>2</td><td>3</td></tr><tr><td>4</td><td>5</td><td>6</td></tr></table></body></html>")
开发者ID:perkinslr,项目名称:nevow-py3,代码行数:16,代码来源:test_flatstan.py
示例20: render_channels_list
def render_channels_list(self):
result = tags.table()
result.children.append(
tags.tr()[
tags.th()['id'],
tags.th()['subscribers'],
]
)
for clientId, c in channel.channels.items():
result.children.append(
tags.tr()[
tags.td()[c.id],
tags.td()[len(c.subscribers)],
]
)
return result
开发者ID:unsouled,项目名称:lumen,代码行数:16,代码来源:webconsole.py
注:本文中的nevow.tags.table函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论