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


Python HtmlElement.script方法代码示例

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


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

示例1: get_display

# 需要导入模块: from pyasm.web import HtmlElement [as 别名]
# 或者: from pyasm.web.HtmlElement import script [as 别名]
    def get_display(self):

        if len(self.widgets) == 0:
            return ""

        script = HtmlElement.script()

        script.add( 'SET_DHTML( ' )
        args = []
        for widget in self.widgets:
            args.append('"%s"' % widget.get_id() )

        script.add( ", ".join(args) )
        script.add( ' )\n' )

        return script.get_display()
开发者ID:mincau,项目名称:TACTIC,代码行数:18,代码来源:web_tools.py

示例2: get_display

# 需要导入模块: from pyasm.web import HtmlElement [as 别名]
# 或者: from pyasm.web.HtmlElement import script [as 别名]
    def get_display(my):

        box = DivWdg(css="login")

        box.add_style("margin-top: auto")
        box.add_style("margin-bottom: auto")
        box.add_style("text-align: center")

        script = HtmlElement.script(
            """function login(e) {
                if (!e) var e = window.event;
                if (e.keyCode == 13) {
                submit_icon_button('Submit');
                }}
                """
        )

        div = DivWdg()
        div.add_style("margin: 0px 0px")
        div.add_class("centered")

        div.add(HtmlElement.br(6))
        sthpw = SpanWdg("SOUTHPAW TECHNOLOGY INC", css="login_sthpw")
        sthpw.add_style("color: #333")
        div.add(sthpw)
        div.add(HtmlElement.br(2))

        div.add(my.get_error_wdg())
        box.add(div)

        widget = Widget()
        # widget.add( HtmlElement.br(3) )
        table = Table()
        table.add_style("width: 100%")
        table.add_style("height: 85%")
        table.add_row()
        td = table.add_cell()
        td.add_style("vertical-align: middle")
        td.add_style("text-align: center")
        td.add_style("background: transparent")
        td.add(box)
        widget.add(table)

        return widget
开发者ID:hellios78,项目名称:TACTIC,代码行数:46,代码来源:error_wdg.py

示例3: get_button_wdg

# 需要导入模块: from pyasm.web import HtmlElement [as 别名]
# 或者: from pyasm.web.HtmlElement import script [as 别名]
    def get_button_wdg(my, script_name):
        func_name = script_name

        custom_script = my.get_custom_script(script_name)


        script = HtmlElement.script('''
        %s = function() {
            %s
        }
        ''' % (func_name, custom_script) )


        button = SpanWdg()
        button.add_class("hand")
        button.add(script)
        button.add("[%s]" % script_name)
        button.add_event("onclick", "%s()" % func_name)

        return button
开发者ID:2gDigitalPost,项目名称:tactic_src,代码行数:22,代码来源:shelf_wdg.py

示例4: get_display

# 需要导入模块: from pyasm.web import HtmlElement [as 别名]
# 或者: from pyasm.web.HtmlElement import script [as 别名]
    def get_display(self):

        box = DivWdg(css='login')

        box.add_style("margin-top: auto")
        box.add_style("margin-bottom: auto")
        box.add_style("text-align: center")

        script = HtmlElement.script('''function login(e) {
                if (!e) var e = window.event;
                if (e.keyCode == 13) {
                submit_icon_button('Submit');
                }}
                ''')
        
        div = DivWdg()
        div.add_style("margin: 0px 0px")
        div.add_class("centered")

        div.add( HtmlElement.br(3) )

        div.add(self.get_error_wdg() )
        box.add(div)

        widget = Widget()
        #widget.add( HtmlElement.br(3) )
        table = Table()
        table.add_style("width: 100%")
        table.add_style("height: 85%")
        table.add_row()
        td = table.add_cell()
        td.add_style("vertical-align: middle")
        td.add_style("text-align: center")
        td.add_style("background: transparent")
        td.add(box)
        widget.add(table)
        
        return widget
开发者ID:mincau,项目名称:TACTIC,代码行数:40,代码来源:error_wdg.py

示例5: get_display

# 需要导入模块: from pyasm.web import HtmlElement [as 别名]
# 或者: from pyasm.web.HtmlElement import script [as 别名]
    def get_display(my):

        web = WebContainer.get_web()

        widget = Widget()
        html = HtmlElement("html")


        is_xhtml = False
        if is_xhtml:
            web.set_content_type("application/xhtml+xml")
            widget.add('''<?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE html 
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
            ''')
            html.add_attr("xmlns", "http://www.w3.org/1999/xhtml")
            #html.add_attr("xmlns:svg", "http://www.w3.org/2000/svg")


        # add the copyright
        widget.add( my.get_copyright_wdg() )
        widget.add(html)


        # create the header
        head = HtmlElement("head")
        html.add(head)

        head.add('<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>\n')
        head.add('<meta http-equiv="X-UA-Compatible" content="IE=edge"/>\n')

        # Add the tactic favicon
        head.add('<link rel="shortcut icon" href="/context/favicon.ico" type="image/x-icon"/>')

        # add the css styling
        head.add(my.get_css_wdg())

        # add the title in the header
        project = Project.get()
        project_code = project.get_code()
        project_title = project.get_value("title")

        if web.is_admin_page():
            is_admin = " - Admin"
        else:
            is_admin = ""

        if project_code == 'admin':
            head.add("<title>TACTIC Site Admin</title>\n" )
        else:
            head.add("<title>%s%s</title>\n" % (project_title, is_admin) )


        # add the javascript libraries
        head.add( JavascriptImportWdg() )



        # add the body
        body = my.body
        html.add( body )


        # Add a NOSCRIPT tag block here to provide a warning message on browsers where 'Enable JavaScript'
        # is not checked ... TODO: clean up and re-style to make look nicer
        body.add( """
        <NOSCRIPT>
        <div style="border: 2px solid black; background-color: #FFFF99; color: black; width: 600px; height: 70px; padding: 20px;">
        <img src="%s" style="border: none;" /> <b>Javascript is not enabled on your browser!</b>
        <p>This TACTIC powered, web-based application requires JavaScript to be enabled in order to function. In your browser's options/preferences, please make sure that the 'Enable JavaScript' option is checked on, click OK to accept the settings change, and then refresh this web page.</p>
        </div>
        </NOSCRIPT>
        """ % ( IconWdg.get_icon_path("ERROR") ) )




        # add the content
        if my.widgets:
            content_wdg = my.get_widget('content')
        else:
            content_wdg = Widget()
            my.add(content_wdg)
        body.add( content_wdg )

        body.add_event('onload', 'spt.onload_startup(this)')


        if web.is_admin_page():
            from tactic_branding_wdg import TacticCopyrightNoticeWdg
            branding = TacticCopyrightNoticeWdg(show_license_info=True)
            body.add(branding)


        # add the admin bar
        security = Environment.get_security()
        if not web.is_admin_page() and security.check_access("builtin", "view_site_admin", "allow"):

            div = DivWdg()
#.........这里部分代码省略.........
开发者ID:blezek,项目名称:TACTIC,代码行数:103,代码来源:top_wdg.py


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