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


Python Xml.get_node_value方法代码示例

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


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

示例1: init

# 需要导入模块: from pyasm.common import Xml [as 别名]
# 或者: from pyasm.common.Xml import get_node_value [as 别名]
    def init(my):
        my.widget_class = my.xml.get_value("widget/display/@class")
        my.draw = my.xml.get_value("widget/display/@draw")
        my.title = my.xml.get_value("widget/@name")
        my.name = my.title


        # convert the widget data
        options = {}
        nodes = my.xml.get_nodes("widget/display/*")
        for node in nodes:
            name = node.nodeName
            value = Xml.get_node_value(node)

            if options.has_key(name):
                # turn this into an array
                array = []
                array.append(options.get(name))
                array.append(value)
                options[name] = array
            else:
                options[name] = value

        my.options = options
        my.widget = Common.create_from_class_path(my.widget_class, [my.title])
开发者ID:0-T-0,项目名称:TACTIC,代码行数:27,代码来源:tab_wdg.py

示例2: get_action_options

# 需要导入模块: from pyasm.common import Xml [as 别名]
# 或者: from pyasm.common.Xml import get_node_value [as 别名]
    def get_action_options(my, event_name, scope="dependent"):
        options = {}
        action_node = my.get_action_node(event_name, scope=scope)
        if action_node is None:
            return options

        nodes = Xml.get_children(action_node)
        for node in nodes:
            name = Xml.get_node_name(node)
            if name == "#text":
                continue
            value = Xml.get_node_value(node)
            options[name] = value

        return options
开发者ID:0-T-0,项目名称:TACTIC,代码行数:17,代码来源:pipeline.py

示例3: add_behaviors

# 需要导入模块: from pyasm.common import Xml [as 别名]
# 或者: from pyasm.common.Xml import get_node_value [as 别名]
    def add_behaviors(my, widget, xml):

        behavior_nodes = xml.get_nodes("config/%s/behavior" % my.view)

        if behavior_nodes:
            hidden_div = DivWdg()
            hidden_div.add_styles("display: none");
            hidden_div.add_class("spt_customlayoutwdg_handoffs")
            widget.add( hidden_div )

            widget.add_behavior({
                'type': 'load',
                'cbjs_action': '''
                    // handle embedded load behaviors!
                    var el_load_list = bvr.src_el.getElements(".SPT_BVR_LOAD_PENDING");
                    spt.behavior.process_load_behaviors( el_load_list );
                '''
            })

            for behavior_node in behavior_nodes:

                bvr_div = DivWdg()
                hidden_div.add( bvr_div )

                css_class = Xml.get_attribute(behavior_node, 'class')
                behavior_str = Xml.get_node_value(behavior_node)
                behavior_str = behavior_str.strip()

                # if the event is specified in the xml, then use that
                event = Xml.get_attribute(behavior_node, 'event')

                modkeys = Xml.get_attribute(behavior_node, 'modkeys')

                relay_class = Xml.get_attribute(behavior_node, 'relay_class')

                if not behavior_str:
                    continue

                try:
                    try:
                        bvr = eval(behavior_str)
                    except:
                        # try it as a string
                        bvr_str = eval("'''\n%s\n'''" % behavior_str)

                        if bvr_str:
                            bvr = {}
                            bvr['cbjs_action'] = bvr_str

                    if event:
                        bvr['type'] = event

                    if modkeys:
                        bvr['modkeys'] = modkeys



                    # add the kwargs to this so behaviors have access
                    bvr['kwargs'] = my.kwargs
                    bvr['class_name'] = Common.get_full_class_name(my)

                    if relay_class:
                        bvr['bvr_match_class'] = relay_class
                        if not bvr.get("type"):
                            bvr['type'] = 'mouseup'
                        my.content.add_relay_behavior( bvr )

                    elif bvr.get("type") == "smart_drag":
                        bvr['bvr_match_class'] = css_class
                        my.content.add_behavior(bvr)
                    else:
                        bvr['_handoff_'] = '@.getParent(".spt_custom_content").getElements(".%s")' % css_class
                        if not bvr.get("type"):
                            bvr['type'] = 'click_up'
                        bvr_div.add_behavior( bvr )



                except Exception, e:
                    print "Error: ", e
                    raise TacticException("Error parsing behavior [%s]" % behavior_str)
开发者ID:southpawtech,项目名称:TACTIC-DEV,代码行数:83,代码来源:custom_layout_wdg.py

示例4: get_display

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

        my.kwargs['search_key'] = 'prod/asset?project=sample3d&code=chr001'



        custom = """<?xml version='1.0' encoding='UTF-8'?>
        <custom>

        <html>
        <div>
            This is html
            <textarea class='spt_test spt_input' name='description'>
</textarea>
            <input class='spt_input' type='text' name='title'/>
            <br/>
            <input class='spt_button1' type='button' value='Press Me'/>
            <input class='spt_button2' type='button' value='Press Me2'/>
            <input class='spt_button3' type='button' value='Calendar'/>
            <input class='spt_refresh' type='button' value='Refresh'/>


            <element>
              <display class='tactic.ui.widget.CalendarWdg'/>
            </element>
            Much simpler!!!
            <elemeent class='CalendarWdg' blah='adasf'/>

        </div>
        </html>
        <behavior class='spt_button1'>{
            "type": "click_up",
            "cbjs_action": '''
            app.mel('sphere');
            //var top = bvr.src_el.getParent(".spt_panel");
            //var values = spt.api.Utility.get_input_values(top);
            //console.log(values);
            '''
        }</behavior>
        <behavior class='spt_button2'>{
            "type": "click_up",
            "cbjs_action": "alert(bvr.kwargs.search_key);"
        }</behavior>
        <behavior class='spt_button3'>{
            "type": "click_up",
            "cbjs_action": '''
            spt.panel.load('main_body', bvr.class_name, bvr.kwargs);
            //spt.panel.load('main_body', 'tactic.ui.widget.CalendarWdg', bvr.kwargs);
            '''
        }</behavior>
        <behavior class='spt_refresh'>{
            "type": "click_up",
            "cbjs_action": '''
            var top = bvr.src_el.getParent(".spt_panel");
            spt.panel.refresh(top);
            '''

        }</behavior>

        </custom>

        """

        xml = Xml()
        xml.read_string(custom)

        top = DivWdg()
        my.set_as_panel(top)
        top.add_class("spt_panel")

        inner = DivWdg()
        top.add(inner)

        html_node = xml.get_node("custom/html")
        html = xml.to_string(html_node)
        inner.add(html)

        behaviors = xml.get_nodes("custom/behavior")
        for behavior in behaviors:
            css_class = Xml.get_attribute(behavior, 'class')
            value = Xml.get_node_value(behavior)
            value = eval(value)

            # add the kwargs to this so behaviors have access
            value['kwargs'] = my.kwargs
            value['class_name'] = Common.get_full_class_name(my)

            inner.add_behavior({
                'type': 'load',
                'value': value,
                'css_class': css_class,
                'cbjs_action': '''
                var el = bvr.src_el.getElement("."+bvr.css_class);
                if (!el) {
                    alert("WARNING: element ["+bvr.css_clsss+"] does not exist");
                }
                spt.behavior.add( el, bvr.value);
                '''
            })
#.........这里部分代码省略.........
开发者ID:0-T-0,项目名称:TACTIC,代码行数:103,代码来源:test_custom_wdg.py


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