本文整理汇总了Python中page.Page.input方法的典型用法代码示例。如果您正苦于以下问题:Python Page.input方法的具体用法?Python Page.input怎么用?Python Page.input使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类page.Page
的用法示例。
在下文中一共展示了Page.input方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Storage
# 需要导入模块: from page import Page [as 别名]
# 或者: from page.Page import input [as 别名]
def Storage(params=None):
handle_params(params)
data = []
with pg_connection(*current_user.get_config()) as (con, cur, err):
with pg_log_err('list storage query'):
cur.execute(query('list-storage'))
data = cur.fetchall()
display_schemas = params.getlist('schema')
schemas = set()
treemap_data = {'name': 'root', 'children': []}
for (schema_name, table_name, t_size, t_tuples) in data:
schemas.add(schema_name)
if schema_name in display_schemas or len(display_schemas) == 0:
treemap_data['children'].append({'schema_name': schema_name, 'name': table_name,
'size': int(t_size), 'rows': int(t_tuples)})
p = Page()
# Header
p.add_page(Header(title='Storage',
js=['static/pages/storage.js',
'static/lib/d3/d3.js',
'static/lib/d3/lib/colorbrewer/colorbrewer.js'],
css=['static/pages/storage.css']))
p.add_page(Navigation(page='storage'))
with p.div({'class': 'container-fluid'}):
with p.div({'class': 'row form-row'}):
with p.div({'class': 'col-md-10'}):
with p.form({'id': 'schema-form', 'class': 'form-inline'}):
for schema in schemas:
with p.label({'class': 'checkbox-inline'}):
checked = (schema in display_schemas or len(display_schemas) == 0) and 'checked' or ''
with p.input({'type': 'checkbox', 'name': 'schema', 'value': '%s' % schema}, args=[checked]):
p.content(schema)
with p.div({'class': 'col-md-2'}):
with p.form({'id': 'mode-form', 'class': 'form-inline'}):
with p.label({'class': 'radio-inline'}):
with p.input({'type': 'radio', 'name': 'mode', 'value': 'size'}, args=['checked']):
p.content('Size')
with p.label({'class': 'radio-inline'}):
with p.input({'type': 'radio', 'name': 'mode', 'value': 'rows'}):
p.content('Rows (est.)')
with p.div({'class': 'row'}):
with p.div({'class': 'col-md-12'}):
with p.div({'id': 'treemap-chart'}): pass
with p.script():
p.content('PGUI.STORAGE.mk_treemap_chart(%s);' % json.dumps(treemap_data))
p.add_page(Footer())
return p
示例2: Login
# 需要导入模块: from page import Page [as 别名]
# 或者: from page.Page import input [as 别名]
def Login(params=None, title=None):
"""
Renders the login page.
There is no separate login for the application, this is passed to
the database!
"""
p = Page()
p.content('<!DOCTYPE html>')
with p.html():
with p.head():
with p.title():
p.content('pgui - Login')
with p.link({'href': 'static/lib/bootstrap/bootstrap-3.3.4-dist/css/bootstrap.css', 'rel': 'stylesheet'}): pass
with p.link({'href': 'static/login.css', 'rel': 'stylesheet'}): pass
with p.body():
with p.div({'class': 'container'}):
with p.form({'method': 'POST', 'class': 'login'}):
with p.h2({'class': 'login-header'}):
p.content('Connect to a postgres database server')
with p.label({'for': 'name', 'class': 'sr-only'}):
p.content('User name')
with p.input({'type': 'input', 'id': 'name', 'name': 'name', 'class': 'form-control', 'placeholder': 'User name'}): pass
with p.label({'for': 'password', 'class': 'sr-only'}):
p.content('Password')
with p.input({'type': 'password', 'id': 'password', 'name': 'password', 'class': 'form-control', 'placeholder': 'Password'}): pass
with p.label({'for': 'host', 'class': 'sr-only'}):
p.control('Host')
with p.input({'type': 'input', 'id': 'host', 'name': 'host', 'class': 'form-control', 'value': 'localhost'}): pass
with p.label({'for': 'port', 'class': 'sr-only'}):
p.content('Port')
with p.input({'type': 'input', 'id': 'port', 'name': 'port', 'class': 'form-control', 'value': '5432'}): pass
with p.button({'class': 'btn btn-lg btn-success btn-block', 'type': 'submit'}, args=['autofocus']):
p.content('Connect')
with p.div({'class': 'login'}):
if 'err' in params and params['err']:
for err in params['err']:
with p.code():
p.content(err)
return p