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


Python IconWdg.add_class方法代码示例

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


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

示例1: get_header_wdg

# 需要导入模块: from pyasm.widget import IconWdg [as 别名]
# 或者: from pyasm.widget.IconWdg import add_class [as 别名]
    def get_header_wdg(my):
        div = DivWdg()

        div.add("<hr/>")

        dots_div = DivWdg()
        dots_div.add_style("margin-top: -12px")
        div.add(dots_div)

        left = 50
        width = 60
        for i, widget in enumerate(my.widgets):
            on_dot = IconWdg("", IconWdg.DOT_GREEN)
            on_dot.add_class("spt_wizard_on_dot")
            off_dot = IconWdg("", IconWdg.DOT_GREY)
            off_dot.add_class("spt_wizard_off_dot")
            if i == 0:
                off_dot.add_style("display: none")
            else:
                on_dot.add_style("display: none")

            dot_div = DivWdg()
            dots_div.add(dot_div)
            dot_div.add(on_dot)
            dot_div.add(off_dot)
            dot_div.add_style("width: %spx" % width)
            dot_div.add_style("float: left")
            dot_div.add_style("margin-left: %spx" % left)
            dot_div.add_style("text-align: center")

            if (i+1) < len(my.widgets):
                arrow_div = DivWdg()
                dots_div.add(arrow_div)
                arrow_div.add_style("float: left")
                arrow_div.add_style("position: absolute")
                arrow_div.add_style("margin-left: %spx" % ((width+left)*(i+1.2)))
                arrow_div.add_style("margin-top: -3px")
                arrow_div.add_style("text-align: center")
                icon = IconWdg("", IconWdg.ARROWHEAD_DARK_RIGHT)
                arrow_div.add(icon)



        dots_div.add("<br clear='all'/>")


        for widget in my.widgets:
            name_div = DivWdg()
            div.add(name_div)
            name_div.add_style("float: left")
            name_div.add_style("margin-left: %spx" % left)
            name = widget.get_name()
            name_div.add(name)
            name_div.add_style("width: %spx" % width)
            name_div.add_style("text-align: center")

        div.add("<br clear='all'/>")
        return div
开发者ID:blezek,项目名称:TACTIC,代码行数:60,代码来源:wizard_wdg.py

示例2: get_displayxx

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

        show_menu = my.kwargs.get("show_menu")
        is_disabled = my.kwargs.get("is_disabled")

        show_title = my.kwargs.get("show_title")
        show_title = show_title in ['True', True]

        width = 35 
        if show_title:
            height = 26
        else:
            height = 20
        height = 30

        top = my.top
        top.add_class("spt_button_top")
        top.add_style("overflow: hidden")


        #border = top.get_color("border")
        #top.add_border(-20)
        top.add_gradient("background", "background", 20, -35)
        top.add_style("border-width: 1px 0 1px 0")
        top.add_style("border-style: solid")
        top.add_style("border-color: %s" % top.get_color('border'))
        #top.add_style("margin-left: -1px")

        inner = my.inner
        top.add(inner)
        inner.add_color("color", "color3")
        inner.add_style("padding-top: 3px")
        inner.add_style("overflow: hidden")

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

        inner.add_class("hand")
        inner.add_style("z-index: 20")
        #inner.add_style("overflow: hidden")
        #inner.add_style("opacity: 0.5")
        inner.add_attr("title", title)

        my.button.add_style("margin-top: 5px")
        inner.add(my.button)
        icon_str = my.kwargs.get("icon")
        icon = IconWdg(title, icon_str)
        my.button.add(icon)
        icon.add_class("spt_button_icon")

        my.show_arrow = my.kwargs.get("show_arrow") in [True, 'true']
        if my.show_arrow or my.dialog:
            arrow = IconWdg(title, IconWdg.ARROW_MORE_INFO)
            inner.add(arrow)
            arrow.add_style("position: absolute")
            arrow.add_style("float: left")
            arrow.add_style("margin-left: 2px")
            arrow.add_style("margin-top: -10px")




        inner.add_style("font-size: 8px")
        inner.add_style("height: %spx" % height)
        inner.add_style("width: %spx" % width)
        inner.add_style("text-align: center")

        show_title = False
        if show_title:
            title_div = DivWdg()
            title_div.add(title)
            inner.add(title_div)



        inner.add_behavior( {
        'type': 'click',
        'width': width,
        'cbjs_action': '''
            var button = bvr.src_el;
            button.setStyle("border-style", "ridge");
            button.setStyle("width", bvr.width-2);
        '''
        } )


        inner.add_behavior( {
        'type': 'click_up',
        'width': width,
        'cbjs_action': '''
            var button = bvr.src_el;
            button.setStyle("border-style", "none");
            button.setStyle("width", bvr.width);
        '''
        } )


        inner.add_behavior( {
        'type': 'hover',
        'width': width,
        'cbjs_action_over': '''
#.........这里部分代码省略.........
开发者ID:0-T-0,项目名称:TACTIC,代码行数:103,代码来源:button_new_wdg.py

示例3: get_display

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

        top = my.top
        top.add_style("white-space: nowrap")
        #top.add_style("position: relative")

        base = "%s/%s" % (BASE, my.top.get_theme() )


        show_menu = my.kwargs.get("show_menu")
        is_disabled = my.kwargs.get("is_disabled")

        button = DivWdg()
        button.add_style("float: left")
        
        my.inner = button
        top.add(button)
        my.inner.add_class("hand")

        button.add_class("spt_button_top")
        button.add_style("position: relative")

        #img = "<img src='%s/MainButtonSlices_button.png'/>" % base
        #img_div = DivWdg(img)
        #button.add(img_div)
        #img_div.add_style("opacity", ALPHA)

        img_div = DivWdg()
        button.add(img_div)
        img_div.add_style("width: 30px")
        img_div.add_style("height: 35px")
       
       

        over_div = DivWdg()
        button.add(over_div)
        over_div.add_class("spt_button_over")
        over_img = "<img src='%s/MainButton_over.png'/>" % base
        over_div.add(over_img)
        over_div.add_style("position: absolute")
        over_div.add_style("top: 0px")
        over_div.add_style("left: 0px")
        over_div.add_style("display: none")

        click_div = DivWdg()
    
        button.add(click_div)
        click_div.add_class("spt_button_click")
        click_img = "<img src='%s/MainButton_click.png'/>" % base
        click_div.add(click_img)
        click_div.add_style("position: absolute")
        click_div.add_style("top: 0px")
        click_div.add_style("left: 0px")
        click_div.add_style("display: none")


        title = my.kwargs.get("title")
       
        tip = my.kwargs.get("tip")
        if not tip:
            tip = title

        icon_div = my.icon_div
        button.add(icon_div)
        #icon_div.add_class("spt_button_click")
        icon_str = my.kwargs.get("icon")
        icon = IconWdg(tip, icon_str, right_margin=0, width=16)
        icon.add_class("spt_button_icon")
        icon_div.add(icon)
        icon_div.add_style("position: absolute")
        #TODO: removed this top attr after we trim the top and bottom whitespace of the over image
        icon_div.add_style("top: 12px")
        icon_div.add_style("left: 6px")

        if my.is_disabled:
            icon_div.add_style("opacity: 0.5")
        

        my.icon_div = icon_div

        sub_icon = my.kwargs.get("sub_icon")
        if sub_icon:
            sub_icon = IconWdg(icon=sub_icon, size="8")
            button.add(sub_icon)
            sub_icon.add_style("position: absolute")
            sub_icon.add_style("bottom: 4px")
            sub_icon.add_style("right: 0px")
        
       

        my.show_arrow = my.kwargs.get("show_arrow") in [True, 'true']
        if my.show_arrow or my.dialog:
            arrow_div = DivWdg()
            button.add(arrow_div)
            arrow_div.add_style("position: absolute")
            arrow_div.add_style("top: 24px")
            arrow_div.add_style("left: 20px")

            arrow = IconWdg(tip, IconWdg.ARROW_MORE_INFO)
            arrow_div.add(arrow)
#.........这里部分代码省略.........
开发者ID:0-T-0,项目名称:TACTIC,代码行数:103,代码来源:button_new_wdg.py

示例4: get_display

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

        smenu_div = DivWdg()
        smenu_div.add_class( "SPT_SMENU" )
        smenu_div.add_class( "SPT_SMENU_%s" % my.menu_tag_suffix )
        smenu_div.set_box_shadow()
        smenu_div.add_border()
        smenu_div.add_color("background", "background")
        smenu_div.add_color("color", "color")

        smenu_div.add_behavior( {
            'type': 'load',
            'cbjs_action': '''
            spt.dom.load_js( ["ctx_menu.js"], function() {
                    spt.dom.load_js( ["smart_menu.js"], function() {
                } )
            } );
            '''
        } )

        if my.setup_cbfn:
            smenu_div.set_attr( "SPT_SMENU_SETUP_CBFN", my.setup_cbfn )

        smenu_div.set_z_start( 300 )
        #smenu_div.add_looks( "smenu border curs_default" )
        # smenu_div.add_styles( "padding-top: 3px; padding-bottom: 5px;" )

        m_width = my.width - 2
        smenu_div.add_style( ("width: %spx" % m_width) )

        smenu_div.add_style("overflow-x: hidden")

        icon_width = 16
        icon_col_width = 0
        if my.allow_icons:
            icon_col_width = icon_width + 2
        label_width = m_width - icon_col_width - icon_width

        menu_table = Table()
        menu_table.add_styles( "text-align: left; text-indent: 3px; border-collapse: collapse;" )
        #menu_table.add_color("background", "background")
        menu_table.add_color("color", "color")

        options = my.opt_spec_list
        opt_count = 0

        if options[0].get('type') != 'title':
            my._add_spacer_row(menu_table, 3, icon_width, icon_col_width, label_width)


        """
        menu_table.add_relay_behavior( {
            'type': 'mouseenter',
            'bvr_match_class': 'SPT_SMENU_ENTRY',
            'bgcolor': menu_table.get_color("side_bar_title", -15, default="background3"),
            'cbjs_action': '''
            bvr.src_el.setStyle("background-color", bvr.bgcolor);
            bvr.src_el.setStyle("color", bvr.bgcolor);
            spt.smenu.entry_over( evt, bvr );
            '''
        } )

        menu_table.add_relay_behavior( {
            'type': 'mouseleave',
            'bvr_match_class': 'SPT_SMENU_ENTRY',
            'cbjs_action': '''
            bvr.src_el.setStyle("background-color", "");
            spt.smenu.entry_out( evt, bvr );
            '''
        } )
        """


        for opt in options:

            # if entry is a title, then add a spacer before
            if opt.get('type') == 'title' and opt_count:
                my._add_spacer_row(menu_table, 6, icon_width, icon_col_width, label_width)

            tbody = menu_table.add_tbody()
            tbody.add_style("display","table-row-group")

            tr = menu_table.add_row()
            #tr.add_looks( "smenu" )

            tr.add_class( "SPT_SMENU_ENTRY" )
            tr.add_class( "SPT_SMENU_ENTRY_%s" % opt['type'].upper() )

            if opt.has_key('enabled_check_setup_key'):
                tr.set_attr( "SPT_ENABLED_CHECK_SETUP_KEY", opt.get('enabled_check_setup_key') )

            if opt.has_key('hide_when_disabled') and opt.get('hide_when_disabled'):
                tr.set_attr( "SPT_HIDE_WHEN_DISABLED", "true" )

            if opt['type'] in [ 'action', 'toggle' ]:

                hover_bvr = {'type':'hover', 'add_looks': 'smenu_hilite',
                             'cbjs_action_over': 'spt.smenu.entry_over( evt, bvr );',
                             'cbjs_action_out': 'spt.smenu.entry_out( evt, bvr );' }
                if opt.has_key('hover_bvr_cb'):
#.........这里部分代码省略.........
开发者ID:2gDigitalPost,项目名称:tactic_src,代码行数:103,代码来源:smart_menu_wdg.py

示例5: get_display

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

        widget = my.widget
        widget.set_box_shadow()

        widget.add_class("spt_dialog_top")
        widget.add_class("spt_popup")



        z_index = my.kwargs.get("z_index")
        if not z_index:
            z_index = "500"
        widget.add_style("z-index: %s" % z_index)


        web = WebContainer.get_web()

        widget.set_id(my.name)
        widget.add_attr("spt_dialog_id", my.name);
        if my.kwargs.get("display") not in [True, "true"]:
            widget.add_style("display: none")

        widget.add_style("position: absolute")

        widget.add_behavior( {
        'type': 'listen',
        'event_name': '%s|dialog_close' % my.name,
        'cbjs_action': my.get_cancel_script()
        } )


        offset = my.kwargs.get("offset")
        if not offset:
            offset = my.offset





        show_header = True
        show_resize = False


        drag_div = DivWdg()
        if show_header:
            widget.add(drag_div)



        show_pointer = my.kwargs.get("show_pointer")
        if show_pointer not in [False, 'false']:
            from tactic.ui.container import ArrowWdg
            offset_x = 15 - offset.get('x')
            offset_y = offset.get("y")
            arrow = ArrowWdg(
                    offset_x=offset_x,
                    offset_y=offset_y,
                    color=widget.get_color("background", -10)
            )
            arrow.add_class("spt_popup_pointer")
            arrow.add_style("z-index: 10")
            widget.add(arrow)


        # create the 'close' button ...
        close_wdg = SpanWdg()
        close_wdg.add( IconWdg("Close", "BS_REMOVE") )
        close_wdg.add_style("float: right")
        close_wdg.add_class("hand")
        close_wdg.add_style("margin: 3px 1px 3px 1px")

        close_wdg.add_behavior({
            'type': 'click_up',
            'cbjs_action': my.get_cancel_script()
        })

        drag_div.add(close_wdg)


        anchor_wdg = SpanWdg()
        drag_div.add(anchor_wdg)
        anchor_wdg.add_style("margin: 5px 5px 3px 1px")
        anchor_wdg.add( IconWdg("Anchor Dialog", "BS_PUSHPIN") )
        anchor_wdg.add_style("float: right")
        anchor_wdg.add_class("hand")

        anchor_wdg.add_behavior({
            'type': 'click_up',
            'cbjs_action': '''
            var top = bvr.src_el.getParent(".spt_dialog_top");
            var position = top.getStyle("position");
            if (position == 'fixed') {
                top.setStyle("position", "absolute");
                bvr.src_el.setStyle("opacity", "1.0");
            }
            else {
                top.setStyle("position", "fixed");
                bvr.src_el.setStyle("opacity", "0.5");
            }
#.........这里部分代码省略.........
开发者ID:2gDigitalPost,项目名称:tactic_src,代码行数:103,代码来源:dialog_wdg.py

示例6: get_display

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

        self.sobject_data = {}

        top = self.top
        top.add_style
        top.add_class("spt_gallery_top")

        inner = DivWdg()
        top.add(inner)

        # make the whole Gallery unselectable
        inner.add_class('unselectable')
        inner.add_style("position: fixed")
        inner.add_style("top: 0px")
        inner.add_style("left: 0px")
        inner.add_style("width: 100%")
        #inner.add_style("height: 100%")
        inner.add_style("bottom: 0px")
        inner.add_style("padding-bottom: 40px")

        #inner.add_style("background: rgba(0,0,0,0.5)")
        inner.add_style("background: rgba(0,0,0,1)")
        inner.add_style("z-index: 2000")


        width = self.kwargs.get("width")
        height = self.kwargs.get("height")
        
        # default to top.
        align = self.kwargs.get("align")
        if not align:
            align = "top"


        if not width:
            width = 1300
        else:
            width = int(width)


        paths = self.get_paths(file_type='main')
        # icon type may be too small
        thumb_paths = self.get_paths(file_type='web')
        
        descriptions = []
        for path in paths:
            sobject = self.sobject_data.get(path)
            if not sobject:
                descriptions.append("")
            else:
                description = sobject.get("description")
                if not description:
                    description = ""
                descriptions.append(description)

        total_width = width * len(paths)
        inner.add_behavior( {
        'type': 'load',
        'width': width,
        'total_width': total_width,
        'descriptions': descriptions,
        'cbjs_action': '''
        spt.gallery = {};
        // 1250 is defined also in the css styles
        spt.gallery.portrait = window.innerWidth < 1250;
        spt.gallery.portrait = false

        
        spt.gallery.top = bvr.src_el;
        spt.gallery.content = spt.gallery.top.getElement(".spt_gallery_content");
        spt.gallery.content.setStyle('opacity','0.1')
        spt.gallery.desc_el = spt.gallery.top.getElement(".spt_gallery_description");
        
        //window.addEvent('domready', function() {
        setTimeout(function() {
		// set the img h or w directly
		var items = bvr.src_el.getElements('.spt_gallery_item img');
		// fade in
        spt.gallery.content.set('tween', {duration: 250}).fade('in');

        /*
		for (var k=0; k < items.length; k++) {
		    var sizes = items[k].getSize();
		    var item_h = sizes.y;
		    var item_w = sizes.x;
		    if (item_h >= item_w){
			    //items[k].setStyle('width', 'auto');
			    //items[k].setStyle('height', '100%');
		    }
		    else {
			    //items[k].setStyle('width','auto');
			    //items[k].setStyle('height','100%');
		    }
		    
		}
        */


        }, 50)
#.........这里部分代码省略.........
开发者ID:mincau,项目名称:TACTIC,代码行数:103,代码来源:gallery_wdg.py

示例7: get_display

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

        div = DivWdg()

        if not Container.get_dict("JSLibraries", "spt_popup"):
            div.add_style("position: fixed")
            div.add_style("top: 0px")
            div.add_style("left: 0px")
            div.add_style("opacity: 0.4")
            div.add_style("background", "#000")
            div.add_style("padding: 100px")
            div.add_style("height: 100%")
            div.add_style("width: 100%")
            div.add_class("spt_popup_background")
            div.add_style("display: none")
            div.add_behavior( {
                'type': 'click_up',
                'cbjs_action': '''
                spt.hide(bvr.src_el);
                '''
            } ) 

        Container.put("PopupWdg:background", True)



        # This is the absolute outside of a popup, including the drop shadow
        widget = DivWdg()
        div.add(widget)
        widget.add_class("spt_popup")



        if not Container.get_dict("JSLibraries", "spt_popup"):
            widget.add_behavior( {
                'type': 'load',
                'cbjs_action': my.get_onload_js()
            } )


        width = my.kwargs.get("width")
        if not width:
            width = 10

        #widget.add_behavior( {
        #    'type': 'load',
        #    'cbjs_action': 'bvr.src_el.makeResizable({handle:bvr.src_el.getElement(".spt_popup_resize")})'
        #} )


        web = WebContainer.get_web()


        widget.set_id(my.name)
        if my.kwargs.get("display") == "true":
            pass
        else:
            widget.add_style("display: none")

        widget.add_style("position: absolute")
        widget.add_style("left: 400px")
        widget.add_style("top: 100px")

        widget.add_border()
        widget.add_color("background", "background")

        #widget.set_box_shadow(color="#000")
        widget.set_box_shadow()


        table = Table()
        table.add_behavior( {
        'type': 'load',
        'width': width,
        'cbjs_action': '''
        bvr.src_el.setStyle("width", bvr.width)

        var popup = bvr.src_el.getParent(".spt_popup");
        var window_size = $(window).getSize();
        var size = bvr.src_el.getSize();
        var left = window_size.x/2 - size.x/2;
        var top = window_size.y/2 - size.y/2;
        popup.setStyle("left", left);
        //popup.setStyle("top", top);

        '''
        } )



        table.add_row()

        """
        # Qt doesn't support shadows very well
        if web.get_browser() == 'Qtx':
            # dynamically add css files

            table.add_class("css_shadow_table")
            td = table.add_cell()
            td.add_class("css_shadow_td css_shadow_top_left SPT_POPUP_SHADOW")
#.........这里部分代码省略.........
开发者ID:2gDigitalPost,项目名称:tactic_src,代码行数:103,代码来源:popup_wdg.py

示例8: get_display

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

示例9: get_display

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

        element_data_dict = {}

        config = self.get_config()
        element_names = config.get_element_names()

        content_wdg = DivWdg()
        content_wdg.add_class("spt_simple_search_top")

        onload_js = DivWdg()
        content_wdg.add(onload_js)
        onload_js.add_behavior( {
            'type': 'load',
            'cbjs_action': self.get_onload_js()
        } )




        if not element_names:
            element_names = ['keywords']

        self.set_content(content_wdg)

        
        # this is somewhat duplicated logic from alter_search, but since this is called 
        # in ViewPanelWdg, it's a diff instance and needs to retrieve again
        filter_data = FilterData.get()

        filter_view = self.kwargs.get("filter_view")
        if filter_view:
            search = Search("config/widget_config")
            search.add_filter("view", filter_view)
            search.add_filter("category", "search_filter")
            search.add_filter("search_type", self.search_type)
            filter_config = search.get_sobject()
            if filter_config:
                filter_xml = filter_config.get_xml_value("config")
                filter_value = filter_xml.get_value("config/filter/values")
                if filter_value:
                    data_list = jsonloads(filter_value)

        else:
            data_list = filter_data.get_values_by_prefix(self.prefix)



        for data in data_list:
            handler = data.get("handler")
            element_name = data.get("element_name")
            if not element_name:
                continue

            element_data_dict[element_name] = data

        elements_wdg = DivWdg()
        content_wdg.add(elements_wdg)
        elements_wdg.add_color("color", "color")
        elements_wdg.add_style("padding-top: 10px")
        elements_wdg.add_style("padding-bottom: 15px")

        #elements_wdg.add_color("background", "background3", 0)
        elements_wdg.add_color("background", "background", -3)
        elements_wdg.add_border()



        if len(element_names) == 1:
            elements_wdg.add_style("border-width: 0px 0px 0px 0px" )
            elements_wdg.add_style("padding-right: 50px" )
        else:
            elements_wdg.add_style("border-width: 0px 0px 0px 0px" )

        table = Table()
        table.add_color("color", "color")
        elements_wdg.add(table)
        table.add_class("spt_simple_search_table")
        
        columns = self.kwargs.get("columns")
        if not columns:
            columns = 2
        else:
            columns = int(columns) 
       
        num_rows = int(len(element_names)/columns)+1
        tot_rows = int(len(element_names)/columns)+1
        project_code = Project.get_project_code()
        # self.search_type could be the same as self.base_search_type
        full_search_type = SearchType.build_search_type(self.search_type, project_code)


        visible_rows = self.kwargs.get("visible_rows")
        if visible_rows:
            visible_rows = int(visible_rows)
            num_rows = visible_rows
        else:
            visible_rows = 0

        titles = config.get_element_titles() 
#.........这里部分代码省略.........
开发者ID:mincau,项目名称:TACTIC,代码行数:103,代码来源:simple_search_wdg.py

示例10: get_display

# 需要导入模块: from pyasm.widget import IconWdg [as 别名]
# 或者: from pyasm.widget.IconWdg import add_class [as 别名]
    def get_display(self):
        """
        Handles how the widget will be displayed.

        :return: a button widget
        """
        top = self.top
        top.add_style("white-space: nowrap")

        base = "{0}/{1}".format(BASE, self.top.get_theme())

        button = DivWdg()
        button.add_style("float: left")

        self.inner = button
        top.add(button)
        self.inner.add_class("hand")

        button.add_class("spt_button_top")
        button.add_style("position: relative")

        img_div = DivWdg()
        button.add(img_div)
        img_div.add_style("width: 20px")
        img_div.add_style("height: 20px")

        over_div = DivWdg()
        button.add(over_div)
        over_div.add_class("spt_button_over")
        over_img = "<img src='{0}/SmallButton_over.png'/>".format(base)
        over_div.add(over_img)
        over_div.add_style("position: absolute")
        over_div.add_style("top: -7px")
        over_div.add_style("left: -2px")
        over_div.add_style("display: none")

        click_div = DivWdg()
        button.add(click_div)
        click_div.add_class("spt_button_click")
        click_img = "<img src='{0}/SmallButton_click.png'/>".format(base)
        click_div.add(click_img)
        click_div.add_style("position: absolute")
        click_div.add_style("top: -7px")
        click_div.add_style("left: -2px")
        click_div.add_style("display: none")

        title = self.kwargs.get("title")
        tip = self.kwargs.get("tip")
        if not tip:
            tip = title

        icon_div = self.icon_div
        button.add(icon_div)
        icon_str = self.kwargs.get("icon")
        icon = IconWdg(tip, icon_str, right_margin=0)
        icon.add_class("spt_button_icon")
        icon_div.add(icon)
        icon_div.add_style("position: absolute")
        icon_div.add_style("top: 2px")
        icon_div.add_style("left: 2px")

        if self.is_disabled:
            icon_div.add_style("opacity: 0.5")

        self.icon_div = icon_div

        self.show_arrow = self.kwargs.get("show_arrow") in [True, 'true']
        if self.show_arrow or self.dialog:
            arrow_div = DivWdg()
            button.add(arrow_div)
            arrow_div.add_style("position: absolute")
            arrow_div.add_style("top: 24px")
            arrow_div.add_style("left: 20px")

            arrow = IconWdg(tip, IconWdg.ARROW_MORE_INFO)
            arrow_div.add(arrow)

        web = WebContainer.get_web()
        is_ie = web.is_IE()

        self.hit_wdg.add_style("width: 100%")
        if is_ie:
            self.hit_wdg.add_style("filter: alpha(opacity=0)")
            self.hit_wdg.add_style("height: 40px")
        else:
            self.hit_wdg.add_style("height: 100%")
            self.hit_wdg.add_style("opacity: 0.0")

        if self.is_disabled:
            self.hit_wdg.add_style("display: none")

        button.add(self.hit_wdg)

        self.hit_wdg.add_style("position: absolute")
        self.hit_wdg.add_style("top: 0px")
        self.hit_wdg.add_style("left: 0px")
        self.hit_wdg.add_attr("title", tip)
        self.hit_wdg.add_behavior({
            'type': 'hover',
            'cbjs_action_over': '''
#.........这里部分代码省略.........
开发者ID:2gDigitalPost,项目名称:custom,代码行数:103,代码来源:button_small_new_wdg.py


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