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


Python SpanWdg.add_class方法代码示例

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


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

示例1: get_related_wdg

# 需要导入模块: from pyasm.web import SpanWdg [as 别名]
# 或者: from pyasm.web.SpanWdg import add_class [as 别名]
    def get_related_wdg(my, aliases):
        div = DivWdg()
        div.add("<b>Related links</b>: &nbsp;&nbsp")
        div.add_style("margin-top: 5px")
        div.add_style("margin-bottom: 5px")
        div.add_style("margin-left: 10px")

        titles = [Common.get_display_title(x.replace("-"," ")) for x in aliases]
        for alias, title in zip(aliases, titles):

            link_div = SpanWdg()
            div.add(link_div)
            link_div.add_color("background", "background")
            link_div.add(title)
            link_div.add_behavior( {
                'type': 'click_up',
                'cbjs_action': '''
                spt.help.set_top();
                spt.help.load_alias("%s");
                ''' % alias
            } )
            link_div.add_class("spt_link")
            link_div.add_class("hand")

        return div
开发者ID:2gDigitalPost,项目名称:tactic_src,代码行数:27,代码来源:help_wdg.py

示例2: get_tool_bar

# 需要导入模块: from pyasm.web import SpanWdg [as 别名]
# 或者: from pyasm.web.SpanWdg import add_class [as 别名]
    def get_tool_bar(my):
        widget = Widget()
        trash_div = SpanWdg()
        # reset some global variables on load
        trash_div.add_behavior({'type':'load', 'cbjs_action':'spt.side_bar.trashed_items=[]; spt.side_bar.changed_views={}'})

        trash_div.set_id('trash_me')

        trash_div.add(IconWdg('Trash', IconWdg.TRASH))
        trash_div.add("TRASH!")
        trash_div.add_class("hand")
        trash_div.add_class("spt_side_bar_trash")
      
        trash_div.set_attr("SPT_ACCEPT_DROP", "manageSideBar")
        bvr = { "type": "click_up",\
                'cbjs_action': "alert('Drag and drop link or folder here to remove it.')"}
        trash_div.add_behavior(bvr)

        widget.add(trash_div)
        
        save_div = SpanWdg(css='med hand spt_side_bar_trash')
        save_div.add(IconWdg('Save Ordering', IconWdg.SAVE))
      
        # FIXME: is_personal???
        is_personal = 'false'
        bvr = { "type": "click_up",\
                'cbjs_action': "spt.side_bar.manage_section_action_cbk({'value':'save'},'%s',%s);" % (my.view, is_personal)} 
        save_div.add_behavior(bvr)
        widget.add(save_div)
        return widget
开发者ID:blezek,项目名称:TACTIC,代码行数:32,代码来源:view_manager_wdg.py

示例3: get_tool_bar

# 需要导入模块: from pyasm.web import SpanWdg [as 别名]
# 或者: from pyasm.web.SpanWdg import add_class [as 别名]
    def get_tool_bar(self):
        widget = Widget()
        trash_div = SpanWdg()
        trash_div.set_id('trash_me')

        trash_div.add(IconWdg('Trash', IconWdg.TRASH))
        trash_div.add("TRASH!")
        trash_div.add_class("hand")
        trash_div.add_class("spt_side_bar_trash")
      
        
        trash_div.set_attr("SPT_ACCEPT_DROP", "manageSideBar")
        bvr = { "type": "click_up",\
                'cbjs_action': "alert('Drag and drop element name here to remove it.')"}
        trash_div.add_behavior(bvr)

        widget.add(trash_div)
        
        save_div = SpanWdg(css='med hand spt_side_bar_trash')
        save_div.add(IconWdg('Save', IconWdg.SAVE))
        
        bvr = { "type": "click_up",\
                'cbjs_action': "spt.custom_project.manage_action_cbk({'value':'save'},'%s');" % self.view} 
        save_div.add_behavior(bvr)
        widget.add(save_div)
        return widget
开发者ID:mincau,项目名称:TACTIC,代码行数:28,代码来源:search_type_manager_wdg.py

示例4: get_license_info_wdg

# 需要导入模块: from pyasm.web import SpanWdg [as 别名]
# 或者: from pyasm.web.SpanWdg import add_class [as 别名]
    def get_license_info_wdg(self):
        div = DivWdg()

        license = Environment.get_security().get_license()
        if self.first_error:
            return div
        #if not license.is_licensed():
        #    return div

        msg = DivWdg()
        div.add(msg)
        msg.add("The following describes the details of the installed license:<br/><br/>")


        info_wdg = DivWdg()
        div.add(info_wdg)
        info_wdg.add_style("margin: 10px 30px")
        info_wdg.add_style("font-size: 12px")

        version = license.get_data("tactic_version")
        if version:
            info_wdg.add("TACTIC Version: ")
            if version == "ALL":
                version = "ALL (Open Source)"
            info_wdg.add(version)
            info_wdg.add(HtmlElement.br(2))


        company = license.get_data("company")
        info_wdg.add("Licensed To: ")
        if company.find("Southpaw EPL") != -1:
            company = SpanWdg("<a name='license'>Eclipse Public License v1.0</a> &nbsp;")
            icon = IconWdg("EPL v1.0", IconWdg.ZOOM)
            company.add(icon)
            company.add_class("hand")
            company.add_behavior( {
                'type': 'click_up',
                'cbjs_action': '''
                    spt.help.load_alias("license")
                '''
            } )
        info_wdg.add(company)
        info_wdg.add(HtmlElement.br(2))

        info_wdg.add("Max Users: ")
        info_wdg.add(license.get_data("max_users") )
        info_wdg.add(HtmlElement.br(2))

        info_wdg.add("Current Users: ")
        info_wdg.add(license.get_current_users() )
        info_wdg.add(HtmlElement.br(2))

        info_wdg.add("Expiry Date: ")
        expiry_date = license.get_data("expiry_date")
        if not expiry_date:
            expiry_date = "Permanent"
        info_wdg.add(expiry_date)
        info_wdg.add(HtmlElement.br(2))

        return div
开发者ID:mincau,项目名称:TACTIC,代码行数:62,代码来源:license_manager_wdg.py

示例5: get_button_wdg

# 需要导入模块: from pyasm.web import SpanWdg [as 别名]
# 或者: from pyasm.web.SpanWdg import add_class [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

示例6: get_link_wdg

# 需要导入模块: from pyasm.web import SpanWdg [as 别名]
# 或者: from pyasm.web.SpanWdg import add_class [as 别名]
    def get_link_wdg(my, section_id, target_id, title, options):
        view_link_wdg = SpanWdg(css="hand")
        view_link_wdg.add_class("SPT_DTS")
        view_link_wdg.add_style("color: #292929")
        view_link_wdg.add_event("onmouseover", "this.style.background='#696969'")
        view_link_wdg.add_event("onmouseout", "this.style.background='#949494'")

        view_link_wdg.add(title)

        path = title
        options['path'] = "/%s" % title


        if not options.get('class_name'):
            options['class_name'] = "tactic.ui.panel.ViewPanelWdg"

        behavior = {
            'type':         'click_up',
            'cbfn_action':  'spt.side_bar.display_link_cbk',
            'target_id':    target_id,
            'title':        title,
            'options':      options,
        }
        view_link_wdg.add_behavior( behavior )

        options2 = options.copy()
        options2['inline_search'] = "true"

        behavior = {
            'type':         'click_up',
            'modkeys':      'SHIFT',
            'cbfn_action':  'spt.side_bar.display_link_cbk',
            'is_popup':     'true',
            'target_id':    path,
            'title':        title,
            'options':      options2,
        }
        view_link_wdg.add_behavior( behavior )

        return view_link_wdg
开发者ID:blezek,项目名称:TACTIC,代码行数:42,代码来源:schema_section_wdg.py

示例7: SpanWdg

# 需要导入模块: from pyasm.web import SpanWdg [as 别名]
# 或者: from pyasm.web.SpanWdg import add_class [as 别名]
                link_rel_path = "%s/%s" % (dirname, href)
            else:
                link_rel_path = "%s" % (href)
 
            target = xml.get_attribute(node, "target")
            if target:
                target = xml.set_attribute(node, "href", "/doc/%s" % link_rel_path)
                continue

            # get a unique id for the node
            unique_id = my.top.generate_unique_id(base='replace')
            xml.set_attribute(node, "id", unique_id)

            div = SpanWdg()
            elements.append(div)
            div.add_class("spt_replace_element")
            div.add_attr("spt_replace_id", unique_id)
            div.add_class("hand")
            div.add_class("spt_link")
            div.add_color("background", "background")

            text = xml.get_node_value(node)
            div.add(text)
            div.add_behavior( {
                'type': 'click_up',
                'rel_path': link_rel_path,
                'cbjs_action': '''
                spt.help.set_top();
                spt.help.load_rel_path( bvr.rel_path );
                '''
            } )
开发者ID:2gDigitalPost,项目名称:tactic_src,代码行数:33,代码来源:help_wdg.py

示例8: get_tool_bar

# 需要导入模块: from pyasm.web import SpanWdg [as 别名]
# 或者: from pyasm.web.SpanWdg import add_class [as 别名]
    def get_tool_bar(my):
        widget = DivWdg()
        widget.add_style("width: 250px")

        refresh = IconButtonWdg("Refresh", IconWdg.REFRESH)
        refresh.add_behavior(
            {
                "type": "click_up",
                "cbjs_action": """
            var top = bvr.src_el.getParent(".spt_panel");
            spt.panel.refresh(top);
            """,
            }
        )

        widget.add(refresh)
        widget.add("&nbsp;&nbsp;&nbsp;")

        trash_div = SpanWdg()
        # reset some global variables on load
        trash_div.add_behavior(
            {"type": "load", "cbjs_action": "spt.side_bar.trashed_items=[]; spt.side_bar.changed_views={}"}
        )

        trash_div.set_id("trash_me")

        trash_div.add(IconWdg("Trash", IconWdg.TRASH))
        trash_div.add_class("hand")
        trash_div.add_class("spt_side_bar_trash")

        trash_div.set_attr("SPT_ACCEPT_DROP", "manageSideBar")
        bvr = {"type": "click_up", "cbjs_action": "alert('Drag and drop link or folder here to remove it.')"}
        trash_div.add_behavior(bvr)

        widget.add(trash_div)

        save_div = SpanWdg(css="med hand spt_side_bar_trash")
        save_div.add(IconWdg("Save Ordering", IconWdg.SAVE))

        bvr = {
            "type": "click_up",
            "search_type": my.search_type,
            "view": my.view,
            "cbjs_action": """
            if (confirm("Save ordering of this view [" + bvr.view + "] ?") ) {

                var top = bvr.src_el.getParent(".spt_view_manager_top");
                var list_top = top.getElement(".spt_menu_item_list");

                var server = TacticServerStub.get();
                server.start({"title": "Updating views"});

                var is_personal = false;
                spt.app_busy.show("Saving", "Saving view ["+bvr.view+"]");
                spt.side_bar.save_view(bvr.search_type, bvr.view, is_personal, list_top);
                server.finish();

                spt.app_busy.hide();
            }
            """,
        }

        save_div.add_behavior(bvr)
        widget.add(save_div)

        gear = my.get_gear_menu()
        gear.add_style("float: right")

        widget.add(gear)

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

示例9: get_display

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

        my.collection_key = my.kwargs.get("collection_key")

        collection = Search.get_by_search_key(my.collection_key)

        top = my.top

        my.kwargs["scale"] = 75;
        my.kwargs["show_scale"] = False;
        my.kwargs["expand_mode"] = "plain"
        from tile_layout_wdg import TileLayoutWdg
        tile = TileLayoutWdg(
            **my.kwargs
        )
        parent_dict = my.kwargs.get("parent_dict")
        has_parent=False
        if parent_dict:
            has_parent = True

        path = my.kwargs.get("path")
        if collection and path:
            title_div = DivWdg()
            top.add(title_div)
            title_div.add_style("float: left")
            title_div.add_style("margin: 15px 0px 15px 30px")

            asset_lib_span_div = SpanWdg()
            title_div.add(asset_lib_span_div)

            icon = IconWdg(name="Asset Library", icon="BS_FOLDER_OPEN")
            
            asset_lib_span_div.add(icon)

            asset_lib_span_div.add(" <a><b>Asset Library</b></a> ")
            
            path = path.strip("/")
            parts = path.split("/")

            for idx, part in enumerate(parts):
                title_div.add(" / ")
                # the last spt_collection_link does not need a search_key
                if has_parent and (idx is not len(parts) - 1):
                    search_key = parent_dict.get(part)
                    title_div.add(" <a class='spt_collection_link' search_key=%s><b>%s</b></a> " % (search_key, part))
                else:
                    title_div.add(" <a class='spt_collection_link'><b>%s</b></a> " % part)
                title_div.add_style("margin-top: 10px")


            # Adding behavior to collections link

            parts = my.kwargs.get("search_type").split("/")
            collection_type = "%s/%s_in_%s" % (parts[0], parts[1], parts[1])
            
            exists = SearchType.get(collection_type, no_exception=True)
            if not exists:
                title_div.add("SearchType %s is not registered." % collection_type)
                return top

            # These behaviors are only activated if the view is within collection layout,
            # "is_new_tab" is a kwargs set to true, if opening a new tab
            if not my.kwargs.get("is_new_tab"):
                icon.add_class("hand")
                icon.add_behavior( {
                    'type': 'mouseover',
                    'cbjs_action': '''
                    bvr.src_el.setStyle('opacity', 1.0);
                    '''
                } )
                icon.add_behavior( {
                    'type': 'mouseout',
                    'cbjs_action': '''
                    bvr.src_el.setStyle('opacity', 0.6);
                    '''
                } )
                # make icon and All Assets title clickable to return to view all assets
                asset_lib_span_div.add_class("hand")
                asset_lib_span_div.add_behavior( {
                    'type': 'click_up',
                    'cbjs_action': '''
                    var top = bvr.src_el.getParent(".spt_collection_top");
                    var content = top.getElements(".spt_collection_content");

                    spt.panel.refresh(top);
                    '''
                } )

                title_div.add_class("hand")
                title_div.add_relay_behavior( {
                    'type': 'mouseup',
                    'search_type': my.kwargs.get("search_type"),
                    'collection_type': collection_type,
                    'bvr_match_class': 'spt_collection_link',
                    'cbjs_action': '''

                    var top = bvr.src_el.getParent(".spt_collection_top");
                    var content = top.getElement(".spt_collection_content");

                    var collection_key = bvr.src_el.getAttribute("search_key");
#.........这里部分代码省略.........
开发者ID:asmboom,项目名称:TACTIC,代码行数:103,代码来源:collection_wdg.py

示例10: get_display

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

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

        # draw the proceses
        top = DivWdg()


        action = DivWdg()
        action.add_style("float: right")

        top.add(action)



        table = Table()
        table.add_style("font-size: 11px")
        top.add(table)

        #if my.max_count:
        #    percent_width = float(len(processes)) / float(my.max_count+1) * 100
        #else:
        #    percent_width = 100

        # we want them more squeezed together when in abbr mode
        if my.label_select_value != 'abbr':
            percent_width = 100
            table.add_style("width: %d%%" % percent_width)
        tr = table.add_row()
        
        for process in processes:
            completion_wdg = my.get_completion(sobject, process,\
                len(processes))
            if not completion_wdg:
                continue
            td = table.add_cell( completion_wdg )
            td.add_style('border-width: 0px')


        
        tr = table.add_row(css='underline')
        tr.add_color("color", "color")
        
        label_format = my.get_option("label_format")
        if not label_format:
            label_format =  my.label_select_value
       

        tup_list = my._get_labels(processes, label_format, show_sub_pipeline=my.is_ajax()) 
        style = ''
        for i, tup in enumerate(tup_list):
            name, process = tup
            span = SpanWdg()    
            child_pipeline = process.get_child_pipeline()
            if child_pipeline:
                
                title = SpanWdg()
                title.add("[%s]" % name)
                title.add_style("margin-left: -5px")

                swap = SwapDisplayWdg.get_triangle_wdg()
                content_id =  '%s_%s' %(sobject.get_search_key(), child_pipeline.get_id())
                content_id = my.generate_unique_id(content_id)
                content = DivWdg(id=content_id)

                SwapDisplayWdg.create_swap_title(title, swap, content)

                dyn_load = AjaxLoader(display_id=content_id)

                args_dict = {'search_type': sobject.get_search_type()}
                args_dict['search_id'] = sobject.get_id()
                args_dict['pipeline_skey'] = child_pipeline.get_search_key()
                dyn_load.set_load_method('_get_child_wdg')
                dyn_load.set_load_class('pyasm.widget.ParallelStatusWdg', load_args=args_dict)
                dyn_load.add_element_name('cal_sub_task')
                on_script = dyn_load.get_on_script(load_once=True)

                swap.add_action_script(on_script, "set_display_off('%s')" %content_id)

                script = "if ($(%s).getStyle('display')=='none') {%s}" \
                    %(swap.swap1_id, on_script)
                title.add_event('onclick', script)
                

                span.add(swap)
                span.add(title)
                span.add(HtmlElement.br())
                span.add(HtmlElement.br())
              
                span.add(content)

            else:
                span.add(name)
                if my.task_per_process_dict.get(process) == 0:
                    span.add_class('unused')

            if label_format == 'small' or label_format == 'abbr':
                span.add_class('smaller')
            if not label_format == "none":
                table.add_cell(span)


        return top
开发者ID:0-T-0,项目名称:TACTIC,代码行数:104,代码来源:parallel_status.py

示例11: get_link_wdg

# 需要导入模块: from pyasm.web import SpanWdg [as 别名]
# 或者: from pyasm.web.SpanWdg import add_class [as 别名]
    def get_link_wdg(my, element_name, config, options):
        attributes = config.get_element_attributes(element_name)
        title = my._get_title(config, element_name)

        default_access = "view"
        path = options.get('path')
        security = Environment.get_security()
        if not security.check_access("side_bar", element_name, "view", default=default_access):
            return

        # backwards compatibility??
        #if not security.check_access("url", path, "view"):
        #    return


        link_wdg = DivWdg(css="hand")
        link_wdg.add_style( "padding-top: 4px" )

        link_wdg.add_attr("spt_title", title)
        link_wdg.add_attr("spt_icon", attributes.get("icon"))
        link_wdg.add_class("spt_side_bar_link")
        link_wdg.add_attr("spt_view", config.get_view() )
        link_wdg.add_attr("spt_element_name", element_name)
        link_wdg.add_attr("spt_path", options['path'])
       

        # add the mouseover color change
        link_wdg.add_style("color: #292929")
        link_wdg.add_class("SPT_DTS")
        hover = link_wdg.get_color("background3", -10)
        link_wdg.add_event("onmouseover", "this.style.background='%s'" % hover)
        link_wdg.add_event("onmouseout", "this.style.background=''")
        link_wdg.add_class("spt_side_bar_element")

        link_wdg.add_looks("fnt_text")

        link_wdg.add_attr("spt_view", config.get_view() )



        # add an invisible drop widget
        drop_wdg = my.get_drop_wdg()
        drop_wdg.add_style("margin-top: -3px")
        link_wdg.add(drop_wdg)

        span = SpanWdg()
        span.add_class("spt_side_bar_title")

        # add an icon
        icon = attributes.get("icon")
        if icon:
            icon = icon.upper()
            from pyasm.widget import IconWdg
            try:
                span.add( IconWdg(title, eval("IconWdg.%s" % icon) ) )
            except:
                pass


        span.add(title)
        link_wdg.add(span)


        return link_wdg
开发者ID:0-T-0,项目名称:TACTIC,代码行数:66,代码来源:base_section_wdg.py


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