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


Python IconWdg.get_icon_path方法代码示例

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


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

示例1: get_container

# 需要导入模块: from pyasm.widget import IconWdg [as 别名]
# 或者: from pyasm.widget.IconWdg import get_icon_path [as 别名]
    def get_container(my, xml):
        # handle the container

        element_node = xml.get_node("config/tmp/element")
        attrs = Xml.get_attributes(element_node)
        element_name = attrs.get("name")

        show_resize_scroll = attrs.get("show_resize_scroll")
        if not show_resize_scroll:
            show_resize_scroll = my.kwargs.get("show_resize_scroll")
        if not show_resize_scroll:
            show_resize_scroll = "false"


        # look for attributes in the element tag for specifying a title action button to plug
        # into the title bar of the custom section ...
        #
        title_action_icon = attrs.get("title_action_icon")
        title_action_script = attrs.get("title_action_script")
        title_action_label = attrs.get("title_action_label")
        if title_action_script and not title_action_label:
            title_action_label = '[action]'


        # get the width and height for the element content ...
        width = attrs.get("width")
        height = attrs.get("height")


        if width and height:
            container = ContainerWdg( inner_width=width, inner_height=height, show_resize_scroll=show_resize_scroll )
        else:
            container = ContainerWdg(show_resize_scroll=show_resize_scroll)

        # create the title
        title = attrs.get("title")
        if not title:
            title = Common.get_display_title(element_name)
        title_wdg = DivWdg()
        SmartMenu.assign_as_local_activator( title_wdg, 'HEADER_CTX' )
        title_wdg.add_style("margin: 0px 0px 5px 0px")
        title_wdg.add_gradient("background", "background", 0)
        title_wdg.add_color("color", "color")
        title_wdg.add_style("padding", "5px")


        if title_action_script:
            # add an action button if an action script code was found in the attributes of the element
            proj = Project.get_project_code()
            script_search = Search("config/custom_script")
            script_sobj = script_search.get_by_search_key( "config/custom_script?project=%s&code=%s" %
                                                           (proj, title_action_script) )
            script = script_sobj.get_value('script')
            icon_str = "HELP"
            if title_action_icon:
                icon_str = title_action_icon
            action_btn = HtmlElement.img( IconWdg.get_icon_path(icon_str) )
            action_btn.set_attr('title',title_action_label)
            # action_btn = IconWdg( title_action_label, icon=icon)
            action_btn.add_behavior( {'type': 'click_up', 'cbjs_action':  script } )
            action_btn.add_styles( "cursor: pointer; float: right;" )

            title_wdg.add( action_btn )


        title_wdg.add(title)
        container.add(title_wdg)

        return container
开发者ID:funic,项目名称:TACTIC,代码行数:71,代码来源:custom_layout_wdg.py

示例2: get_link_wdg

# 需要导入模块: from pyasm.widget import IconWdg [as 别名]
# 或者: from pyasm.widget.IconWdg import get_icon_path [as 别名]
    def get_link_wdg(my, element_name, config, options, info):
        li = HtmlElement.li()
        li.add_class("spt_side_bar_link")

        level = info.get("level")
        if level == 1:
            li.add_class("menu_header")
            li.add_class("main_link")
        else:
            li.add_class("sub_li")

        title = my._get_title(config, element_name)
        attributes = config.get_element_attributes(element_name)

        show_icons = my.kwargs.get("show_icons")
        if show_icons in [True, 'true']:
            icon = attributes.get("icon")
            if not icon:
                icon = "view"
            icon_path = IconWdg.get_icon_path(icon.upper())
            li.add(HtmlElement.img(icon_path))
            li.add(" ")


        link_mode = my.kwargs.get("link_mode")
        if not link_mode:
            use_href = my.kwargs.get("use_href")
            if use_href in ['true', True]:
                link_mode = 'href'
            link_mode = 'tab'



        target = my.kwargs.get("target")
        if not target:
            target = ".spt_content"
        else:
            if target[0] not in [".", "#"]:
                target = ".%s" % target

        link = "/tab/%s" % (element_name)
        #link = "/link/%s" % (element_name)
        li.add_attr("spt_link", link)

        if link_mode == 'href':
            project_code = Project.get_project_code()
            #li.add("<a href='/tactic/%s/#/tab/%s'>%s</a>" % (project_code, element_name, title) )
            li.add("<a>%s</a>" % title)
            li.add_behavior( {
                'type': 'click_up',
                'bvr_repeat_interval': 3,
                'title': title,
                'link': link,
                'target': target,
                'cbjs_action': '''
                var content = $(document).getElement(bvr.target);
                spt.app_busy.show("Loading link "+bvr.title);
                spt.panel.load_link(content, bvr.link);
                spt.app_busy.hide();
                '''
            } )
        elif link_mode == 'tab':
            # find the tab below the target
            li.add("<a>%s</a>" % title)
            li.add_behavior( {
                'type': 'click_up',
                'bvr_repeat_interval': 3,
                'title': title,
                'link': link,
                'element_name': element_name,
                'target': target,
                'cbjs_action': '''

                var content = $(document).getElement(bvr.target);
                var tab_top = null;;
                // check if there even is a tab
                if (spt.tab) {
                    tab_top = spt.tab.set_tab_top(content);
                }
                if (tab_top) {
                    setTimeout( function() {
                    spt.app_busy.show("Loading link "+bvr.title);
                    }, 0 );



                    var link = bvr.src_el.getAttribute("spt_link");
                    var class_name = 'tactic.ui.panel.HashPanelWdg';
                    var kwargs = {
                        hash: link
                    }
                    spt.tab.add_new(bvr.element_name,bvr.title,class_name,kwargs);
                }
                else {
                    spt.app_busy.show("Loading link "+bvr.title);
                    spt.panel.load_link(content, bvr.link);
                }

                spt.app_busy.hide();
                '''
#.........这里部分代码省略.........
开发者ID:davidsouthpaw,项目名称:TACTIC,代码行数:103,代码来源:simple_side_bar_wdg.py

示例3: get_display

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

        web = WebContainer.get_web()
        skin = web.get_skin()

        # default to 'small' size ...
        h = 16
        fnt_sz = 11

        if my.size == 'medium':
            h = 18
            fnt_sz = 13
        elif my.size == 'large':
            h = 20
            fnt_sz = 15

        w = (h / 2) - 1

        my.top_el.add_styles( "height: %spx;" % (h) )

        t_styles = "color: #c2c2c2; border: 0px; border-collapse: collapse; padding: 0px"
        bgi_open = "background-image: url(/context/themes/%(skin)s/images/text_btn/%(skin)s_btn_h%(h)s_" % \
                    {'skin': skin, 'h': h}
        bgi_close = ".png)"

        # pos_list = [ 'left', 'middle', 'right' ]
        spacer = HtmlElement.img( IconWdg.get_icon_path("TRANSPARENT") )
        spacer.add_styles( "width: 2px;" )

        div_left = DivWdg()
        div_left.add_styles( "%(bgi_open)s%(pos)s%(bgi_close)s;" %
                                    {'bgi_open': bgi_open, 'pos': 'left', 'bgi_close': bgi_close} )
        div_left.add_styles("float: left; height: %spx; width: %spx;" % (h, w) )

        div_mid = DivWdg()
        div_mid.add_styles( "%(bgi_open)s%(pos)s%(bgi_close)s;" %
                                    {'bgi_open': bgi_open, 'pos': 'middle', 'bgi_close': bgi_close} )
        div_mid.add_styles("float: left; height: %spx; width: auto;" % (h) )
        div_mid.add_styles("color: #c2c2c2;")
        div_mid.add_styles("vertical-align: middle")
        # move the text lower by 1 px
        div_mid.add_style('padding-top: 1px')

        div_mid.add_styles( "font-family: Arial, Helvetica, sans-serif; font-size: %spx;" % fnt_sz )
        div_mid.add( spacer )
        span = SpanWdg(my.label)

        # this is better fixed. Bold fonts don't look good 
        span.add_style('font-weight: 100')
        span.add_style('vertical-align: middle')

        div_mid.add( span )
        div_mid.add( spacer )

        if my.show_option:
            bgi_close = '_options.png)'
            w += 10
        
        my.div_right.add_styles( "%(bgi_open)s%(pos)s%(bgi_close)s;" %
                                    {'bgi_open': bgi_open, 'pos': 'right', 'bgi_close': bgi_close} )
        my.div_right.add_styles("float: left; height: %spx; width: %spx;" % (h, w) )
        my.top_el.add( div_left )
        my.top_el.add( div_mid )
        my.top_el.add( my.div_right )

        my.top_el.add_styles("overflow: hidden;")
        if my.horiz_align == 'center':
            my.top_el.add_styles("margin: auto;")   # margin: auto -- used for centering in non-IE brwsrs
        elif my.horiz_align == 'left':
            my.top_el.add_styles("margin-left: %s;" % my.horiz_offset)

        if my.vert_offset:
            my.top_el.add_styles("margin-top: %s;" % my.vert_offset)

        if my.width:
            if type(my.width) == str:
                my.width.replace("px","")
            my.top_el.add_styles("width: %spx" % my.width)
        else:
            my.top_el.add_behavior({'type': 'load', 'cbjs_action': 'spt.widget.btn_wdg.set_btn_width( bvr.src_el );' })

        return my.top_el
开发者ID:0-T-0,项目名称:TACTIC,代码行数:84,代码来源:button_wdg.py

示例4: get_link_wdg

# 需要导入模块: from pyasm.widget import IconWdg [as 别名]
# 或者: from pyasm.widget.IconWdg import get_icon_path [as 别名]
    def get_link_wdg(self, element_name, config, options, info):
        attributes = config.get_element_attributes(element_name)
        if attributes.get("is_visible") == "false":
            return

        if options.get("popup") in [True, 'true']:
            popup = True
        else:
            popup = False

        #display_options = config.get_display_options(element_name)
        #class_name = display_options.get("class_name")
        #print element_name
        #print display_options
        #print class_name
        #print "---"


        li = HtmlElement.li()
        li.add_class("spt_side_bar_link")

        level = info.get("level")
        if level == 1:
            li.add_class("menu_header")
            li.add_class("main_link unselectable")
        else:
            li.add_class("sub_li")


        title = self._get_title(config, element_name)

        show_icons = self.kwargs.get("show_icons")
        if show_icons in [True, 'true']:
            icon = attributes.get("icon")
            if not icon:
                icon = "view"
            icon_path = IconWdg.get_icon_path(icon.upper())
            li.add(HtmlElement.img(icon_path))
            li.add(" ")


        link_mode = self.kwargs.get("link_mode")
        if not link_mode:
            use_href = self.kwargs.get("use_href")
            if use_href in ['true', True]:
                link_mode = 'href'
            link_mode = 'tab'



        target = self.kwargs.get("target")
        if not target:
            target = ".spt_content"
        else:
            if target[0] in ["."]:
                target = target[1:]

        #link = "/link/%s" % (element_name)
        link = "/tab/%s" % (element_name)
        li.add_attr("spt_link", link)




        if link_mode == 'href':
            project_code = Project.get_project_code()
            #li.add("<a href='/tactic/%s/#/tab/%s'>%s</a>" % (project_code, element_name, title) )
            li.add("<a>%s</a>" % title)
            li.add_behavior( {
                'type': 'click_up',
                'bvr_repeat_interval': 3,
                'title': title,
                'link': link,
                'target': target,
                'cbjs_action': '''

                var target_class = bvr.target;

                if (target_class.indexOf("#") != -1) {
                    var target = $(document.body).getElement(target_class);
                }
                else if (target_class.indexOf(".") != -1) {
                    var parts = target_class.split(".");
                    var top = bvr.src_el.getParent("."+parts[0]);
                    var target = top.getElement("."+parts[1]);  
                }
                else {
                    var target = $(document.body).getElement("."+target_class);
                }

                //var content = $(document).getElement(bvr.target);
                var content = target;
                spt.app_busy.show("Loading link "+bvr.title);
                spt.panel.load_link(content, bvr.link);
                spt.app_busy.hide();
                '''
            } )
        elif link_mode == 'tab':
            # find the tab below the target

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

示例5: get_display

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

# 需要导入模块: from pyasm.widget import IconWdg [as 别名]
# 或者: from pyasm.widget.IconWdg import get_icon_path [as 别名]
    def get_display(my):
        my.icon_string = my.get_value("icon")
        my.icon_label = my.get_value("label")

        top = DivWdg()
        top.add_class("spt_icon_chooser_top")

        # FIXME: this is being generated every time .... where to put is?
        icon_chooser = IconChooserWdg( is_popup=True )
        top.add( icon_chooser )

        icon_entry_text = TextInputWdg(name=my.get_input_name())
        #icon_entry_text.set_attr("disabled", "disabled")
        icon_entry_text.add_class( "SPT_ICON_ENTRY_TEXT" )


        button = ActionButtonWdg(title='Choose', tip='Click to select an icon')

        icon_img = HtmlElement.img()
        icon_img.add_class( "SPT_ICON_IMG" )

        if my.icon_string:
            # icon_path = IconWdg.icons.get(my.icon_string)
            icon_path = IconWdg.get_icon_path(my.icon_string)
            if icon_path:
                # icon = IconWdg( my.icon_string, icon_path, right_margin='0px' )
                icon_img.set_attr("src", icon_path)
            else:
                icon_img.set_attr("src", IconWdg.get_icon_path("TRANSPARENT"))

            icon_entry_text.set_value( my.icon_string )
        else:
            icon_entry_text.set_value( "" )
            icon_img.set_attr("src", IconWdg.get_icon_path("TRANSPARENT"))


        named_event_name = "ICON_CHOOSER_SELECTION_MADE"
        icon_entry_text.add_behavior( {'type': 'listen', 'event_name': named_event_name,
           'cbjs_action': '''
                var top = $("IconChooserPopup");
                var chooser = spt.get_element(top, ".SPT_ICON_CHOOSER_WRAPPER_DIV");
                //var chooser = spt.get_cousin( bvr.src_el,
                //    ".spt_icon_chooser_top", ".SPT_ICON_CHOOSER_WRAPPER_DIV" );

                var icon_name = chooser.getProperty("spt_icon_selected");
                var icon_path = chooser.getProperty("spt_icon_path");
                // bvr.src_el.innerHTML = icon_name;
                bvr.src_el.value = icon_name;
                if( spt.is_hidden( bvr.src_el ) ) { spt.show( bvr.src_el ); }
                var img_el = spt.get_cousin( bvr.src_el,
                    ".spt_icon_chooser_top", ".SPT_ICON_IMG" );
                if( icon_path ) {
                    img_el.setProperty("src", icon_path);
                } else {
                    img_el.setProperty("src","/context/icons/common/transparent_pixel.gif");
                }
           ''' } )

        top.add_behavior( {'type': 'click_up', 'cbjs_action': 'spt.popup.open( "IconChooserPopup", false);' } )

        #top.add( my.icon_label )
        spacing = "<img src='%s' style='width: %spx;' />" % (IconWdg.get_icon_path("TRANSPARENT"), 3)

        #button.add_behavior( {'type': 'click_up', 'cbjs_action': 'spt.popup.open( "IconChooserPopup", false);' } )
        #top.add( button )
        #button.add_style("float: right")
        #button.add_style("margin-top: -3px")

        top.add( icon_img )
        top.add( spacing )
        top.add( icon_entry_text )



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

示例7: get_display

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

        if my.is_popup:
            icon_chooser_popup_id = "IconChooserPopup"
            icon_chooser_popup = PopupWdg(id=icon_chooser_popup_id, allow_page_activity=False, width="760px")
            icon_chooser_popup.add("Icon Chooser", "title")

        orig_icon_list = IconWdg.icons.keys()
        icon_list = ['-- No Icon --']
        do_not_list = [ 'MAYA', 'HOUDINI', 'PROGRESS', 'CLIP_PLAY', 'XSI', 'CLIP_PAUSE', 'CHECK_OUT_LG','CHECK_OUT','PUBLISH_LG' ]

        for k in orig_icon_list:
            if k in do_not_list:
                continue
            icon_list.append(k)

        icon_list.sort()
        icon_list_len = float(len(icon_list))

        num_cols = 5
        num_rows = int( math.ceil( icon_list_len / float(num_cols) ) )

        chooser_wrapper_div = DivWdg()
        chooser_wrapper_div.add_class( "SPT_ICON_CHOOSER_WRAPPER_DIV" )

        chooser_bkg_rc = RoundedCornerDivWdg(hex_color_code="949494",corner_size="10")
        chooser_bkg_rc.set_dimensions( width_str='740px', content_height_str='520px' )

        table = Table()
        for r in range(num_rows):
            table.add_row()
            for c in range(num_cols):
                td = table.add_cell()
                td.add_styles("color: black; overflow: hidden; width: 140px; max-width: 140px; height: 20px;")
                td.add_styles("border: 1px solid transparent; cursor: pointer;")
                td.add_behavior( {'type': 'hover', 'mod_styles': 'background-color: #555555;'} )

                if c > 0:
                    td.add_styles("border-left-color: black;")

                idx = int( c * num_rows + r )
                if idx < icon_list_len:
                    icon_name = icon_list[ idx ]
                    icon_path = ''
                    if icon_name != '-- No Icon --':
                        icon_path = IconWdg.get_icon_path(icon_name)
                        icon = IconWdg( icon_name, icon_path )
                        td.add(icon)
                    text_span = SpanWdg()
                    text_span.add_looks( "fnt_code" )
                    text_span.add_styles( "font-size: 10px" )
                    if len(icon_name) > 16:
                        text_span.add( "%s..." % icon_name[:15] )
                    else:
                        text_span.add( icon_name )
                    td.add( text_span )
                    if icon_name == '-- No Icon --':
                        icon_name = ''
                    td.add_class( "SPT_ICON_SELECT_%s" % icon_name )
                    if my.is_popup:
                        cbjs_action = '''
                            var cwd = bvr.src_el.getParent(".SPT_ICON_CHOOSER_WRAPPER_DIV");
                            cwd.setProperty("spt_icon_selected", "%s");
                            cwd.setProperty("spt_icon_path", "%s");
                            spt.popup.close( spt.popup.get_popup( bvr.src_el ) );
                            spt.named_events.fire_event("%s",bvr);
                        ''' % (icon_name, icon_path,"ICON_CHOOSER_SELECTION_MADE")
                    else:
                        cbjs_action = '''
                            var cwd = bvr.src_el.getParent(".SPT_ICON_CHOOSER_WRAPPER_DIV");
                            cwd.setProperty("spt_icon_selected", "%s");
                            cwd.setProperty("spt_icon_path", "%s");
                            spt.hide( cwd );
                            spt.named_events.fire_event("%s",bvr);
                        ''' % (icon_name, icon_path,"ICON_CHOOSER_SELECTION_MADE")
                        pass
                    td.add_behavior( {'type': 'click_up', 'cbjs_action': cbjs_action} )

        chooser_bkg_rc.add( table )
        chooser_wrapper_div.add( chooser_bkg_rc )


        if my.is_popup:
            icon_chooser_popup.add(chooser_wrapper_div, "content")
            return icon_chooser_popup


        return div
开发者ID:0-T-0,项目名称:TACTIC,代码行数:90,代码来源:chooser_wdg.py


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