本文整理汇总了Python中view.View.append_view_files方法的典型用法代码示例。如果您正苦于以下问题:Python View.append_view_files方法的具体用法?Python View.append_view_files怎么用?Python View.append_view_files使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类view.View
的用法示例。
在下文中一共展示了View.append_view_files方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: view
# 需要导入模块: from view import View [as 别名]
# 或者: from view.View import append_view_files [as 别名]
def view(self, header_names, lines, vertical_header=None, initial_sort=[], decimal_points=3):
sub_views = []
conv_lines = []
# turn lines to html
for line in lines:
conv_line, sub_sub_views = convert_to_html(line)
conv_lines.append(conv_line)
sub_views += sub_sub_views
conv_sort = []
for s in initial_sort:
dir = 0
if s[1] == 'asc':
dir = 0
elif s[1] == 'desc':
dir = 1
else:
raise Exception('Sort must either be asc or desc')
conv_sort.append('[%d,%d]' % (header_names.index(s[0]), dir))
conv_sort = ', '.join(conv_sort)
conv_sort = '[%s]' % conv_sort
data = OrderedDict()
for i in xrange(len(header_names)):
data[header_names[i]] = [l[i] for l in conv_lines]
html = render('table.html', {
'vertical_header' : vertical_header,
'data' : data,
'id' : self._get_unique_id(),
'header_names': header_names,
'lines': conv_lines,
'sort': conv_sort})
v = View(self, html, ['table.css'], ['jquery.tablesorter.js'])
for sub in sub_views:
v.append_view_files(sub)
return v
示例2: view
# 需要导入模块: from view import View [as 别名]
# 或者: from view.View import append_view_files [as 别名]
def view(self, center, left):
html = render('leftpanel.html', {
'id' : self._get_unique_id(),
'center' : center.main_html,
'left' : left.main_html})
v = View(self, html, [], [])
v.append_view_files(center)
v.append_view_files(left)
return v
示例3: view
# 需要导入模块: from view import View [as 别名]
# 或者: from view.View import append_view_files [as 别名]
def view(self, collapsed_view, expanded_view):
html = render('miniexpander.html', {
'widget_id' : self.id,
'id' : self._get_unique_id(),
'collapsed' : collapsed_view.main_html,
'expanded' : expanded_view.main_html,
'shown' : self.values.shown == 'shown'})
v = View(self, html, [], [])
v.append_view_files(collapsed_view)
v.append_view_files(expanded_view)
return v
示例4: view
# 需要导入模块: from view import View [as 别名]
# 或者: from view.View import append_view_files [as 别名]
def view(self, center, west=None, north=None, east=None, south=None):
def convert_to_html_or_none(sub_item):
if sub_item == None:
return None, []
html,views = convert_to_html([sub_item])
html = ''.join(html)
return html,views
center_html, center_views = convert_to_html_or_none(center)
west_html, west_views = convert_to_html_or_none(west)
north_html, north_views = convert_to_html_or_none(north)
east_html, east_views = convert_to_html_or_none(east)
south_html, south_views = convert_to_html_or_none(south)
html = render('layout.html', {
'id' : self._get_unique_id(),
'center_html' : center_html,
'west_html' : west_html,
'north_html' : north_html,
'east_html' : east_html,
'south_html' : south_html})
v = View(self, html, ['layout-default-latest.css'], ['jquery.layout-latest.js'])
for sub in sum([center_views, west_views, north_views, east_views, south_views], []):
v.append_view_files(sub)
return v