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


Python HtmlElement.add_color方法代码示例

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


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

示例1: TopWdg

# 需要导入模块: from pyasm.web import HtmlElement [as 别名]
# 或者: from pyasm.web.HtmlElement import add_color [as 别名]

#.........这里部分代码省略.........

                for (var j = 0; j < targets.length; j++) {
                    var target = targets[j];
                    if (target == el) {
                         hit = true;
                         break;
                         
                    }
                }
        
                if (hit)
                    break;
                else {
                    if ( el.isVisible() && el.on_complete ) {
                        el.on_complete();
                    }
                    else {
                        spt.hide(el);
                    }
      
                }
            }
            if (!hit)
                spt.body.focus_elements = [];

        }
        //bvr.src_el.addEvent("mousedown", spt.body.hide_focus_elements);
        document.body.addEvent("mousedown", spt.body.hide_focus_elements);

        '''
        } )

        web = WebContainer.get_web()
        self.body.add_color("color", "color")

        #if web.is_title_page():
        #    self.body.add_gradient("background", "background", 0, -20)
        #else:
        #    self.body.add_gradient("background", "background", 0, -15)
        self.body.add_color("background", "background")

        self.body.add_style("background-attachment: fixed !important")
        self.body.add_style("margin: 0px")
        self.body.add_style("padding: 0px")


        # ensure that any elements that force the default menu over any TACTIC right-click context menus has the
        # 'force_default_context_menu' flag reset for the next right click that occurs ...
        #
        self.body.add_event( "oncontextmenu", "spt.force_default_context_menu = false;" )




    def add_top_behaviors(self):
        self.body.add_relay_behavior( {
            'type': 'click',
            'bvr_match_class': 'tactic_popup',
            'cbjs_action': '''
            var view = bvr.src_el.getAttribute("view");
            if (!view) {
                spt.alert("No view found");
            }

            var target = bvr.src_el.getAttribute("target");
            var title = bvr.src_el.getAttribute("title");
开发者ID:mincau,项目名称:TACTIC,代码行数:70,代码来源:top_wdg.py

示例2: TitleTopWdg

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

    '''Top used in title page for logins.  This does not include any of the
    js libraries or other common TACTIC functionaity'''
    
    def init(self):
        self.body = HtmlElement("body")

        web = WebContainer.get_web()
        self.body.add_color("color", "color")


        #if web.is_title_page():
        #    self.body.add_gradient("background", "background", 0, -20)
        #else:
        #    self.body.add_gradient("background", "background", 0, -15)
        self.body.add_color("background", "background")

        self.body.add_style("background-attachment: fixed !important")
        #self.body.add_style("min-height: 1200px")
        self.body.add_style("height: 100%")
        self.body.add_style("margin: 0px")


    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,代码行数:96,代码来源:top_wdg.py


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