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


Python HtmlElement.add方法代码示例

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


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

示例1: init

# 需要导入模块: from pyasm.web import HtmlElement [as 别名]
# 或者: from pyasm.web.HtmlElement import add [as 别名]
    def init(self):
        #print "DEPRECATED"
        #raise TacticException("Use of GeneralAppletWdg is Deprecated")

        # it's generated thru JS in IE
        if WebContainer.get_web().is_IE():
            return
        
        context_url = WebContainer.get_web().get_context_url()
        
        print "-"*20
        print self.APPLET_CLASS


        # create applet
        applet = HtmlElement("applet")
        applet.set_attr("code", self.APPLET_CLASS)
        applet.set_attr("codebase", "%s/java" % context_url.get_url() )
        applet.set_attr("archive", self.APPLET_JAR)
        applet.set_attr("width", "1")
        applet.set_attr("height", "1")
        applet.set_attr("id", self.APPLET_ID)
    
        # create param for applet
        param = HtmlElement("param")
        param.set_attr("name","scriptable")
        param.set_attr("value","true")

        applet.add(param)
        
        self.add(applet)
开发者ID:mincau,项目名称:TACTIC,代码行数:33,代码来源:applet.py

示例2: init

# 需要导入模块: from pyasm.web import HtmlElement [as 别名]
# 或者: from pyasm.web.HtmlElement import add [as 别名]
    def init(my):
        div_main = DivWdg(css='module')
        if my.width != None:
            widthstr="width: %sem" % (my.width)
            div_main.add_style(widthstr)
            
        # reset my.name,  create the content widget
        if not my.shad_name:
            my.shad_name = "ShadowBox%s" % (my.generate_unique_id())
        div_main.set_id(my.shad_name)

        
        div_main.center()
              
        div_head = DivWdg(css='boxhead')

        # HACK to compensate for IE weird handling of CSS
        if WebContainer.get_web().is_IE() and 'password' in my.shad_name:
            div_head.add_style('left','-242px')

        div_head.add_style('padding-bottom: 2px')
        empty_header = Widget(name=my.HEADER)
        
        div_head.add(empty_header, empty_header.get_name())
        div_head.add(my.title_wdg, my.title_wdg.get_name())
        
        div_control = DivWdg(css='control')
        empty_control = Widget(name=my.CONTROL)
        
        div_control.add(empty_header, empty_control.get_name())
        
        div_container = DivWdg(css='container')
 
        ie_rect = HtmlElement('v:roundrect') 
        ie_rect.set_attr("arcsize", "1966f")
        ie_rect.set_attr("fillcolor", "white")
        ie_rect.set_attr("strokecolor", "#555")
        ie_rect.set_attr("strokeweight", "2pt")
        
        div_body = DivWdg(css='content')
        div_body.set_id("%s_cont" % my.shad_name)  
        div_body.center()
        div_body.add(div_head)
        div_body.add(div_control)
        
        my.content = div_main
        my.head = div_head
        my.control = div_control
        my.body = div_body
        
        div_container.add(ie_rect)
        ie_rect.add(div_body)

        #div_main.add(div_head)
        div_main.add(div_container)
开发者ID:0-T-0,项目名称:TACTIC,代码行数:57,代码来源:shadowbox_wdg.py

示例3: add_no_option

# 需要导入模块: from pyasm.web import HtmlElement [as 别名]
# 或者: from pyasm.web.HtmlElement import add [as 别名]
    def add_no_option(my, sel_el):
        option = HtmlElement('option')
        option.set_attr( "value", "" )
        option.add( "-- No Options Found --" )
        sel_el.add( option )

        option = HtmlElement('option')
        option.set_attr( "value", "" )
        no_value_label = "-- No Filter Value Found --"
        if my.kwargs.get('no_value_found_label'):
            no_value_label = my.kwargs.get('no_value_found_label')
        option.add( no_value_label )
        sel_el.add( option )
开发者ID:2gDigitalPost,项目名称:tactic_src,代码行数:15,代码来源:smart_select_wdg.py

示例4: get_display

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

        web = WebContainer.get_web()

        widget = Widget()
        html = HtmlElement("html")
        html.add_attr("xmlns:v", 'urn:schemas-microsoft-com:vml')

        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
        try:
            project = Project.get()
        except Exception, e:
            print "ERROR: ", e
            # if the project doesn't exist, then use the admin project
            project = Project.get_by_code("admin")
开发者ID:asmboom,项目名称:TACTIC,代码行数:47,代码来源:top_wdg.py

示例5: get_display

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

        web = WebContainer.get_web()

        widget = Widget()
        html = HtmlElement("html")
        html.add_attr("xmlns:v", 'urn:schemas-microsoft-com:vml')

        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 project_code == 'admin':
            head.add("<title>TACTIC</title>\n" )
        else:
            head.add("<title>%s</title>\n" % project_title )

        # 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 javascript libraries
        #head.add( JavascriptImportWdg() )

        body.add("<form id='form' name='form' method='post' enctype='multipart/form-data'>\n")

        for content in my.widgets:
            body.add(content)

        body.add("</form>\n")

        from tactic_branding_wdg import TacticCopyrightNoticeWdg
        copyright = TacticCopyrightNoticeWdg()
        body.add(copyright)

        return widget
开发者ID:blezek,项目名称:TACTIC,代码行数:82,代码来源:top_wdg.py

示例6: TopWdg

# 需要导入模块: from pyasm.web import HtmlElement [as 别名]
# 或者: from pyasm.web.HtmlElement import add [as 别名]
class TopWdg(Widget):

    def __init__(self, **kwargs):
        self.kwargs = kwargs
        super(TopWdg, self).__init__()



    def init(self):
        self.body = HtmlElement("body")
        Container.put("TopWdg::body", self.body)

        self.top = DivWdg()
        self.body.add(self.top)
        self.top.add_class("spt_top")
        Container.put("TopWdg::top", self.top)


        self.body.add_attr("ondragover", "return false;")
        self.body.add_attr("ondragleave", "return false;")
        self.body.add_attr("ondrop", "return false;")

        self.body.add_behavior( {
            'type': 'load',
            'cbjs_action': '''

            var el = bvr.src_el;

            el.spt_window_active = true;

            if (document.addEventListener) {
                document.addEventListener("visibilitychange", function() {
                    el.spt_window_active = ! document.hidden;
                } );
            }
            else {
                window.onfocus = function() {
                    bvr.src_el.spt_window_active = true;
                }

                window.onblur = function() {
                    bvr.src_el.spt_window_active = false;
                }
            }

            '''
        } )

        self.add_top_behaviors()



        
        click_div = DivWdg()
        self.top.add(click_div)
        click_div.add_behavior( {
        'type': 'load',
        'cbjs_action': '''
        spt.body = {};

        spt.body.is_active = function() {
            return $(document.body).spt_window_active;
        }

        spt.body.focus_elements = [];
        spt.body.add_focus_element = function(el) {
            spt.body.focus_elements.push(el);
        }

        spt.body.remove_focus_element = function(el) {
            var index = spt.body.focus_elements.indexOf(el);
            if (index != -1) {
                spt.body.focus_elements.splice(index, 1);
            }
        }

        // find all of the registered popups and close them
        // NOTE: logic can handle more than 1 focus element should it happen ...
        spt.body.hide_focus_elements = function(evt) {
            var mouse = evt.client;
            var target = evt.target;


            
            var targets = [];
            var count = 0;
            while (target) {
                targets.push(target);
                if (spt.has_class(target, 'spt_activator')) {
                    act_el = target.dialog;
                    if (act_el) {
                        targets.push(act_el);
                        break;
                    }
                }


                // if target is an smenu, then return
                if (spt.has_class(target, 'SPT_SMENU')) {
                    return;
#.........这里部分代码省略.........
开发者ID:mincau,项目名称:TACTIC,代码行数:103,代码来源:top_wdg.py

示例7: get_display

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

        web = WebContainer.get_web()

        widget = Widget()
        html = HtmlElement("html")
        html.add_attr("xmlns:v", 'urn:schemas-microsoft-com:vml')

        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( self.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(self.get_css_wdg())

        # add the title in the header
        try:
            project = Project.get()
        except Exception as e:
            print("ERROR: ", e)
            # if the project doesn't exist, then use the admin project
            project = Project.get_by_code("admin")
        project_code = project.get_code()
        project_title = project.get_value("title")

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

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

        body.add("<form id='form' name='form' method='post' enctype='multipart/form-data'>\n")

        for content in self.widgets:
            body.add(content)

        body.add("</form>\n")

        if web.is_admin_page():
            from tactic_branding_wdg import TacticCopyrightNoticeWdg
            copyright = TacticCopyrightNoticeWdg()
            body.add(copyright)

        return widget
开发者ID:mincau,项目名称:TACTIC,代码行数:72,代码来源:top_wdg.py


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