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


Python Page.link方法代码示例

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


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

示例1: Login

# 需要导入模块: from page import Page [as 别名]
# 或者: from page.Page import link [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
开发者ID:crst,项目名称:pgui,代码行数:52,代码来源:index.py

示例2: Header

# 需要导入模块: from page import Page [as 别名]
# 或者: from page.Page import link [as 别名]
def Header(params=None, title=None, css=None, js=None):
    p = Page()

    p.content('<!DOCTYPE html>')
    with p.html(close=False):
        with p.head():
            with p.title():
                p.content('pgui - %s/%s' % (cu.database, title))

            with p.meta({'charset': 'utf-8'}): pass
            with p.script({'src': 'static/lib/jquery/jquery-2.1.3.js'}): pass
            with p.script({'src': 'static/pgui.js'}): pass
            with p.link({'href': 'static/pgui.css', 'rel': 'stylesheet'}): pass
            with p.link({'href': 'static/lib/bootstrap/bootstrap-3.3.4-dist/css/bootstrap.css', 'rel': 'stylesheet'}): pass
            with p.link({'href': 'static/lib/codemirror/codemirror-5.1/lib/codemirror.css', 'rel': 'stylesheet'}): pass
            with p.link({'href': 'static/lib/codemirror/codemirror-5.1/theme/neo.css', 'rel': 'stylesheet'}): pass
            with p.link({'href': 'static/lib/codemirror/codemirror-5.1/addon/hint/show-hint.css', 'rel': 'stylesheet'}): pass
            if css:
                for c in css:
                    with p.link({'href': c, 'rel': 'stylesheet'}): pass
            with p.script({'src': 'static/lib/bootstrap/bootstrap-3.3.4-dist/js/bootstrap.js'}): pass
            with p.script({'src': 'static/lib/codemirror/codemirror-5.1/lib/codemirror.js'}): pass
            with p.script({'src': 'static/lib/codemirror/codemirror-5.1/keymap/emacs.js'}): pass
            with p.script({'src': 'static/lib/codemirror/codemirror-5.1/keymap/vim.js'}): pass
            with p.script({'src': 'static/lib/codemirror/codemirror-5.1/keymap/sublime.js'}): pass
            with p.script({'src': 'static/lib/codemirror/codemirror-5.1/mode/sql/sql.js'}): pass
            with p.script({'src': 'static/lib/codemirror/codemirror-5.1/addon/hint/show-hint.js'}): pass
            if js:
                for j in js:
                    with p.script({'src': j}): pass

        with p.body(close=False):
            config = 'PGUI.user = "%s"; PGUI.db = "%s"; PGUI.host = "%s";' % (cu.name, cu.database, cu.host)
            with p.script():
                p.content(config)

    return p
开发者ID:crst,项目名称:pgui,代码行数:39,代码来源:shared.py


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