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


Python DivWdg.add_looks方法代码示例

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


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

示例1: get_display

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

        dd_activator = DivWdg()

        if my.style:
            dd_activator.add_styles( my.style )

        dd_activator.add_style( "width: %spx" % my.width )
        dd_activator.add_class("SPT_DTS");

        if my.nudge_menu_horiz != 0:
            dd_activator.set_attr("spt_nudge_menu_horiz", my.nudge_menu_horiz)

        if my.nudge_menu_vert != 0:
            dd_activator.set_attr("spt_nudge_menu_vert", my.nudge_menu_vert)

        # Generate button ...
        #
        table = Table()
        table.add_row()
        table.add_styles("width: 100%; padding: 0px; margin: 0px;")
        td = table.add_cell()
        td.add_looks("menu border curs_default")
        td.add_styles( "padding: 0px; width: 100%; overflow: hidden; height: 12px; max-height: 12px;" )

        title_div = DivWdg()
        title_div.add_styles( "padding: 0px; margin-left: 4px; margin-top: 1px;" )
        if my.icon_path:
            img = HtmlElement.img()
            img.set_attr("src", my.icon_path)
            img.set_attr("title", my.title)
            img.add_styles("padding: 0px; padding-bottom: 1px; margin: 0px; text-decoration: none;")
            title_div.add(img)
            title_div.add_looks("menu")
        else:
            title_div.add(my.title)
            title_div.add_looks("menu fnt_text")

        td.add( title_div )

        td = table.add_cell()
        # -- Example of setting only some of the borders with dotted style ...
        # td.add_looks( "menu_btn_icon clear_borders border_bottom border_right dotted" )
        td.add_looks( "menu_btn_icon border curs_default" )
        td.add_styles( "padding: 0px; text-align: center; overflow: hidden; " \
                       "width: 15px; min-width: 15px;" \
                       "height: 12px; max-height: 12px;" )

        arrow_img = HtmlElement.img("/context/icons/silk/_spt_bullet_arrow_down_dark_8x8.png")
        arrow_img.add_styles( "border: 0px; margin-left: 1px; margin-top: 0px;" )
        td.add( arrow_img )

        dd_activator.add(table)

        dd_activator.add( my.kwargs.get("smart_menu_set") )
        dd_activator.add_class("SPT_SMENU_ACTIVATOR")
        dd_activator.add_behavior( { 'type': 'click_up', 'activator_type' : 'smart_menu',
                                     'cbjs_action': 'spt.smenu.show_on_dropdown_click_cbk( evt, bvr )' } )

        return dd_activator
开发者ID:2gDigitalPost,项目名称:tactic_src,代码行数:62,代码来源:smart_menu_wdg.py

示例2: get_display

# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_looks [as 别名]
    def get_display(my):
        my.example_count = 0

        div = DivWdg()

        div.add( "<BR/>" )
        ex_title_div = DivWdg()
        ex_title_div.add_looks( "fnt_title_2" )
        ex_title_div.add( my.get_example_title() )
        div.add( ex_title_div )
        div.add( "<BR/>" )

        ex_desc_div = DivWdg()
        ex_desc_div.add( my.get_example_description() )
        ex_desc_div.add_looks( "fnt_title_5 fnt_italic" )
        ex_desc_div.add_styles( "padding-left: 12px;" )
        div.add( ex_desc_div )

        div.add( "<BR/>" )

        ex_div = my.get_example_display()
        ex_div.add_styles( "margin-left: 10px;" )
        div.add( ex_div )

        div.add( "<BR/>" )

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

示例3: get_display

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

        if self.get_example_chooser == 'true':
            return self.get_example_chooser_content()

        div = DivWdg()
        div.set_id("UiPlaygroundPanelWdg")

        title = "UI Playground"
        title_wdg = DivWdg()
        title_wdg.add_looks("fnt_title_2")
        title_wdg.add(title)
        div.add(title_wdg)

        div.add(HtmlElement.hr())

        div.add( '<br/>' )
        click_chooser = DivWdg()
        click_chooser.add_looks("fnt_text")
        click_chooser.add( " UI Examples List Popup" )
        click_chooser.add_class("SPT_DTS")
        click_chooser.add_styles("cursor: pointer; padding: 6px; width: 130px; background-color: black;")

        click_chooser.add_behavior( {'type': 'click_up',
                                     'cbfn_action': 'spt.popup.get_widget',
                                     'options': { 'title': 'TACTIC&trade; UI Examples',
                                                  'width': '400px',
                                                  'popup_id': 'UiExamplesChooserPopup',
                                                  'popup_parent_id': 'UiPlaygroundPanelWdg',
                                                  'class_name': 'tactic.ui.panel.ui_playground_panel_wdg.' \
                                                                'UiPlaygroundPanelWdg'
                                                  },
                                     'args': { 'get_example_chooser': 'true' }
                                     } )


        div.add( click_chooser )
        div.add( '<br/>' )

        example_display_div = DivWdg()
        example_display_div.add_styles( "padding: 10px;" )
        example_display_div.set_id("UiExampleDisplayDiv")

        div.add( example_display_div )

        div.add( '<br/>' )
        div.add( '<br/>' )

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

示例4: get_example_display

# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_looks [as 别名]
    def get_example_display(self):

        div = DivWdg()
        dinfo_list = [
            {'class_name': 'SPT_GIZMO_ONE', 'bgcolor': '#669999', 'color': '#000000'},
            {'class_name': 'SPT_GIZMO_TWO', 'bgcolor': '#0099CC', 'color': '#000000'},
            {'class_name': 'SPT_GIZMO_THREE', 'bgcolor': '#996666', 'color': '#000000'},
            {'class_name': 'SPT_GIZMO_FOUR', 'bgcolor': '#CC9966', 'color': '#000000'}
        ]

        for dinfo in dinfo_list:
            gizmo = DivWdg()
            gizmo.add_class( dinfo.get('class_name') )
            gizmo.add_looks( 'fnt_serif' )
            gizmo.add_styles( 'background: %s; color: %s;' % (dinfo.get('bgcolor'), dinfo.get('color')) )
            gizmo.add_styles( 'width: 200px; border: 1px solid black;' )
            gizmo.add( dinfo.get('class_name') )

            div.add( gizmo )
            div.add( '<br/><br/>' )

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

示例5: get_display

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

        dd_activator = DivWdg()
        dd_activator.set_id( my.id )

        if my.style:
            dd_activator.add_styles( my.style )

        dd_activator.add_style( "width: %spx" % my.width )
        dd_activator.add_class("SPT_DTS");

        if my.nudge_menu_horiz != 0:
            dd_activator.set_attr("spt_nudge_menu_horiz", my.nudge_menu_horiz)

        if my.nudge_menu_vert != 0:
            dd_activator.set_attr("spt_nudge_menu_vert", my.nudge_menu_vert)

        # Generate button ...
        #
        table = Table()
        table.add_row()
        table.add_styles("width: 100%; padding: 0px; margin: 0px;")
        td = table.add_cell()
        td.add_looks("menu border curs_default")
        td.add_styles( "padding: 0px; width: 100%; overflow: hidden; height: 12px; max-height: 12px;" )

        title_div = DivWdg()
        title_div.add_styles( "padding: 0px; margin-left: 4px; margin-top: 1px;" )
        title_div.add_looks("menu fnt_text")
        title_div.add(my.title)

        td.add( title_div )

        td = table.add_cell()
        # -- Example of setting only some of the borders with dotted style ...
        # td.add_looks( "menu_btn_icon clear_borders border_bottom border_right dotted" )
        td.add_looks( "menu_btn_icon border curs_default" )
        td.add_styles( "padding: 0px; text-align: center; overflow: hidden; " \
                       "width: 15px; min-width: 15px;" \
                       "height: 12px; max-height: 12px;" )

        arrow_img = HtmlElement.img("/context/icons/silk/_spt_bullet_arrow_down_dark_8x8.png")
        arrow_img.add_styles( "border: 0px; margin-left: 1px; margin-top: 0px;" )
        td.add( arrow_img )

        dd_activator.add(table)

        # Now generate the main drop down menu and any needed sub-menus ...
        #
        dd_map = my.menus[0]
        if not dd_map.has_key('allow_icons'):
            dd_map['allow_icons'] = True  # default is to allow icons
        if my.match_width:
            dd_map['width'] = my.width

        dd_menu_wdg = DropdownMenuWdg( activator_wdg=dd_activator, menu_id=dd_map['menu_id'],
                                       width=dd_map['width'], opt_spec_list=dd_map['opt_spec_list'],
                                       allow_icons=dd_map['allow_icons'] )
        dd_activator.add( dd_menu_wdg )

        sm_map_list = my.menus[1:]
        for sm_map in sm_map_list:
            if not sm_map.has_key('allow_icons'):
                sm_map['allow_icons'] = True
            submenu_wdg = SubMenuWdg( menu_id=sm_map['menu_id'], width=sm_map['width'],
                                          opt_spec_list=sm_map['opt_spec_list'], allow_icons=sm_map['allow_icons'] )
            dd_activator.add( submenu_wdg )

        return dd_activator
开发者ID:0-T-0,项目名称:TACTIC,代码行数:71,代码来源:click_activate_menu_wdg.py

示例6: get_schema_wdg

# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_looks [as 别名]
    def get_schema_wdg(my, schema):
        web = WebContainer.get_web()

        div = DivWdg()
        div.add_style("margin: 10 0 10 0")

        if not schema:
            Environment.add_warning("No schema", "No schema found")
            return div
        schema_xml = schema.get_xml_value("schema")
        code = schema.get_code()


        schema_search_types = schema_xml.get_values("schema/search_type/@name")
        if not schema_search_types:
            return


        title = DivWdg()
        view_margin_top = '4px'
        title.add_styles( "margin-top: %s; margin-bottom: 3px; vertical-align: middle" % view_margin_top )
        if not web.is_IE():
            title.add_styles( "margin-left: -10px; margin-right: -10px;" )
        title.add_looks( "navmenu_header" )

        title_label = SpanWdg()
        title_label.add_styles( "margin-left: 6px; padding-bottom: 2px;" )
        title_label.add_looks( "fnt_title_5 fnt_bold" )
        title_label.add("%s Schema" % code.capitalize())
        title.add(title_label)
        #title.add_style("margin-top: 7px")
        #title.add_style("font-weight: bold")
        #title.add_style("font-size: 1.1em")
        #title.add_style("color: black")
        #underline = HtmlElement.hr()
        #underline.add_style("color: black")
        #underline.add_style("size: 1px")
        #underline.add_style("margin-top: -3px")
        #title.add(underline)
        div.add( title )



        for schema_search_type in schema_search_types:
            try:
                search_type_obj = SearchType.get(schema_search_type)
            except SearchException:
                title = "<span style='color: #F44'>? %s</span>" % schema_search_type
            else:
                title = search_type_obj.get_title()


            span = DivWdg()
            span.add_style("padding: 1px")

            options = {
                'search_type': schema_search_type,
                'view': 'table',
                'schema_default_view': 'true',
            }
            link = my.get_link_wdg("schema", "main_body", title, options)


            # walk up the tree
            current_type = schema_search_type
            has_parent = False
            while 1:
                parent_type = schema.get_parent_type(current_type)
                if parent_type and parent_type != '*':
                    span.add("&nbsp;&nbsp;&nbsp;")
                    has_parent = True
                else:
                    if has_parent:
                        span.add("+&nbsp;")
                    break
                current_type = parent_type

            span.add(link)
            div.add(span)

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

示例7: get_example_display

# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_looks [as 别名]
    def get_example_display(self):

        font_div = DivWdg()

        font_div.add_styles( "background: #CCCCCC; color: #000000; border: 3px solid black; width: 750px;" )


        font_table = Table()
        font_table.add_styles( "margin-top: 6px;" )
        font_table.add_row()

        ft_style = "border: 1px solid black; border-collapse: collapse; padding: 3px; " \
                   "color: #000000; cursor: pointer; %s"

        td = font_table.add_cell()
        td.add_styles( "border: 0px; border-collapse: collapse; padding: 0px; width: 6px; background: #CCCCCC;" )
        td.add( "&nbsp;" )

        td = font_table.add_cell()
        td.set_id("SPT_FONT_EXAMPLE_BTN")
        td.add_styles( ft_style % "background: #CCCCCC;" )
        td.add( "normal" )
        td.add_behavior( { 'type': 'click_up',
                           'cbjs_action': '$("SPT_FONT_EXAMPLE").setStyle("display","block"); ' \
                                        '$("SPT_FONT_EXAMPLE_ITALIC").setStyle("display","none"); ' \
                                        '$("SPT_FONT_EXAMPLE_BOLD").setStyle("display","none"); ' \
                                        '$("SPT_FONT_EXAMPLE_BOLD_ITALIC").setStyle("display","none"); ' \
                                        '$("SPT_FONT_EXAMPLE_BTN").setStyle("background","#CCCCCC"); ' \
                                        '$("SPT_FONT_EXAMPLE_ITALIC_BTN").setStyle("background","#777777"); ' \
                                        '$("SPT_FONT_EXAMPLE_BOLD_BTN").setStyle("background","#777777"); ' \
                                        '$("SPT_FONT_EXAMPLE_BOLD_ITALIC_BTN").setStyle("background","#777777"); ' } )

        td = font_table.add_cell()
        td.add_styles( "border: 0px; border-collapse: collapse; padding: 0px; width: 6px; background: #CCCCCC;" )
        td.add( "&nbsp;" )

        td = font_table.add_cell()
        td.set_id("SPT_FONT_EXAMPLE_ITALIC_BTN")
        td.add_styles( ft_style % "background: #777777;" )
        td.add( "<i>italic</i>" )
        td.add_behavior( { 'type': 'click_up',
                           'cbjs_action': '$("SPT_FONT_EXAMPLE").setStyle("display","none"); ' \
                                        '$("SPT_FONT_EXAMPLE_ITALIC").setStyle("display","block"); ' \
                                        '$("SPT_FONT_EXAMPLE_BOLD").setStyle("display","none"); ' \
                                        '$("SPT_FONT_EXAMPLE_BOLD_ITALIC").setStyle("display","none"); ' \
                                        '$("SPT_FONT_EXAMPLE_BTN").setStyle("background","#777777"); ' \
                                        '$("SPT_FONT_EXAMPLE_ITALIC_BTN").setStyle("background","#CCCCCC"); ' \
                                        '$("SPT_FONT_EXAMPLE_BOLD_BTN").setStyle("background","#777777"); ' \
                                        '$("SPT_FONT_EXAMPLE_BOLD_ITALIC_BTN").setStyle("background","#777777"); ' } )

        td = font_table.add_cell()
        td.add_styles( "border: 0px; border-collapse: collapse; padding: 0px; width: 6px; background: #CCCCCC;" )
        td.add( "&nbsp;" )

        td = font_table.add_cell()
        td.set_id("SPT_FONT_EXAMPLE_BOLD_BTN")
        td.add_styles( ft_style % "background: #777777;" )
        td.add( "<b>bold</b>" )
        td.add_behavior( { 'type': 'click_up',
                           'cbjs_action': '$("SPT_FONT_EXAMPLE").setStyle("display","none"); ' \
                                        '$("SPT_FONT_EXAMPLE_ITALIC").setStyle("display","none"); ' \
                                        '$("SPT_FONT_EXAMPLE_BOLD").setStyle("display","block"); ' \
                                        '$("SPT_FONT_EXAMPLE_BOLD_ITALIC").setStyle("display","none"); ' \
                                        '$("SPT_FONT_EXAMPLE_BTN").setStyle("background","#777777"); ' \
                                        '$("SPT_FONT_EXAMPLE_ITALIC_BTN").setStyle("background","#777777"); ' \
                                        '$("SPT_FONT_EXAMPLE_BOLD_BTN").setStyle("background","#CCCCCC"); ' \
                                        '$("SPT_FONT_EXAMPLE_BOLD_ITALIC_BTN").setStyle("background","#777777"); ' } )

        td = font_table.add_cell()
        td.add_styles( "border: 0px; border-collapse: collapse; padding: 0px; width: 6px; background: #CCCCCC;" )
        td.add( "&nbsp;" )

        td = font_table.add_cell()
        td.set_id("SPT_FONT_EXAMPLE_BOLD_ITALIC_BTN")
        td.add_styles( ft_style % "background: #777777;" )
        td.add( "<b><i>bold italic</i></b>" )
        td.add_behavior( { 'type': 'click_up',
                           'cbjs_action': '$("SPT_FONT_EXAMPLE").setStyle("display","none"); ' \
                                        '$("SPT_FONT_EXAMPLE_ITALIC").setStyle("display","none"); ' \
                                        '$("SPT_FONT_EXAMPLE_BOLD").setStyle("display","none"); ' \
                                        '$("SPT_FONT_EXAMPLE_BOLD_ITALIC").setStyle("display","block"); ' \
                                        '$("SPT_FONT_EXAMPLE_BTN").setStyle("background","#777777"); ' \
                                        '$("SPT_FONT_EXAMPLE_ITALIC_BTN").setStyle("background","#777777"); ' \
                                        '$("SPT_FONT_EXAMPLE_BOLD_BTN").setStyle("background","#777777"); ' \
                                        '$("SPT_FONT_EXAMPLE_BOLD_ITALIC_BTN").setStyle("background","#CCCCCC"); ' } )

        font_div.add( font_table )


        font_palettes = [ 'fnt_title_1', 'fnt_title_2', 'fnt_title_3', 'fnt_title_4', 'fnt_title_5',
                          'fnt_text', 'fnt_text_small', 'fnt_serif', 'fnt_code' ]

        font_modifiers = [ 'fnt_italic', 'fnt_bold', 'fnt_bold fnt_italic' ]

        font_example_div = DivWdg()
        font_example_div.set_id( "SPT_FONT_EXAMPLE" )
        for fnt_pal in font_palettes:
            font_palette_div = DivWdg()
            font_palette_div.add_looks( fnt_pal )
            font_palette_div.add_styles( "color: black; padding-top: 10px; padding-left: 10px;" )
#.........这里部分代码省略.........
开发者ID:mincau,项目名称:TACTIC,代码行数:103,代码来源:font_palettes_example_wdg.py

示例8: get_display

# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_looks [as 别名]
    def get_display(my):
        my.config_search_type = my.kwargs.get("config_search_type")
        if not my.config_search_type:
            my.config_search_type = "SideBarWdg"

        title = my.kwargs.get('title')
        config = my.kwargs.get('config')
        view = my.kwargs.get('view')
        width = my.kwargs.get('width')
        #sortable = my.kwargs.get('sortable')
        if not width:
            width = "175"

        my.prefix = my.kwargs.get("prefix")
        if not my.prefix:
            my.prefix = "side_bar"

        my.mode = my.kwargs.get("mode")
        if not my.mode:
            my.mode = 'view'


        my.default = my.kwargs.get('default') == 'True'

        div = DivWdg()
        div.add_class("spt_section_top")
        div.set_attr("SPT_ACCEPT_DROP", "manageSideBar")


        # create the top widgets
        label = SpanWdg()
        label.add(title)
        label.add_style("font-size: 1.1em")
        section_div = LabeledHidableWdg(label=label)
        div.add(section_div)

        section_div.set_attr('spt_class_name', Common.get_full_class_name(my))
        for name, value in my.kwargs.items():
            if name == "config":
                continue
            section_div.set_attr("spt_%s" % name, value)

        bgcolor = label.get_color("background3")
        project_div = RoundedCornerDivWdg(hex_color_code=bgcolor,corner_size="10")
        project_div.set_dimensions( width_str='%spx' % width, content_height_str='100px' )
        content_div = project_div.get_content_wdg()

        #project_div = DivWdg()
        #content_div = project_div


        section_div.add( project_div )

        content_div.add_class("spt_side_bar_content")
        content_div.add_attr("spt_view", view)

        if type(view) in types.StringTypes:
            view = [view]

        view_margin_top = '4px'

        web = WebContainer.get_web()
        for viewx in view:
            config = my.get_config(my.config_search_type, viewx, default=my.default)
            if not config:
                continue

            # make up a title
            title = DivWdg()
            title.add_gradient( "background", "side_bar_title", 0, -15, default="background" )
            title.add_color( "color", "side_bar_title_color", default="color" )
            title.add_styles( "margin-top: %s; margin-bottom: 3px; vertical-align: middle" % view_margin_top )
            if not web.is_IE():
                title.add_styles( "margin-left: -5px; margin-right: -5px;")
            title.add_looks( "navmenu_header" )
            title.add_style( "height: 18px" )
            title.add_style( "padding-top: 2px" )
            """
            title = DivWdg()
            title.add_styles( "margin-top: %s; margin-bottom: 3px; vertical-align: middle" % view_margin_top )
            if not web.is_IE():
                title.add_styles( "margin-left: -10px; margin-right: -10px;")
            title.add_looks( "navmenu_header" )
            """

            # FIXME: not sure if this logic should be here. It basically
            # makes special titles for certain view names
            view_attrs = config.get_view_attributes()
            title_str = view_attrs.get("title")
            if not title_str:
                if viewx.startswith("my_view_"):
                    title_str = "My Views"
                else:
                    title_str = viewx

            title_str = Common.get_display_title(title_str)

            title_label = SpanWdg()
            title_label.add_styles( "margin-left: 6px; padding-bottom: 2px;" )
            title_label.add_looks( "fnt_title_5 fnt_bold" )
#.........这里部分代码省略.........
开发者ID:0-T-0,项目名称:TACTIC,代码行数:103,代码来源:base_section_wdg.py

示例9: get_link_wdg

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

示例10: generate_section

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

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

                paths = []
                if current_path in paths:
                    is_open = True
                else:
                    is_open = False


                options = config.get_display_options(element_name)
                config_view = config.get_view()

                current_path = "%s/%s" % (base_path, element_name)
                
                # create HTML elements for Section Link ...
                outer_div = DivWdg()
                outer_div.add_attr("spt_view", config_view )
                outer_div.add_class("spt_side_bar_element")
                outer_div.add_class("spt_side_bar_section")
                outer_div.set_attr("SPT_ACCEPT_DROP", "manageSideBar")
                outer_div.add_attr("spt_element_name", element_name)
                outer_div.add_attr("spt_title", title)
                
                #if info.get('login') : 
                #    outer_div.add_attr("spt_login", info.get('login')) 

                # add an invisible drop widget
                outer_div.add(my.get_drop_wdg())


                # Create the link
                s_link_div = DivWdg()
                s_link_div.add_class("SPT_DTS")
                s_link_div.add_class("spt_side_bar_section_link")

                s_link_div.add_style("cursor: pointer")
                s_link_div.add_style( "padding-top: 4px" )

                s_link_div.add_looks("navmenu_section fnt_text fnt_bold")

                # FIXME: currently 'is_open' is hardcoded to be False (see above) ... the state of open or close
                #        of sections is currently stored in a cookie on the client machine. So, at some point if
                #        we decide to store the open/close state of side bar sections then we need to fix this.
                #        here ...
                #
                if is_open:
                    s_link_div.add( "<img src='/context/icons/silk/_spt_bullet_arrow_down_dark.png' " \
                            "style='float: top left; margin-left: -5px; margin-top: -4px;' />" \
                            "<span style=''>%s</span>" % title )
                else:
                    s_link_div.add( "<img src='/context/icons/silk/_spt_bullet_arrow_right_dark.png' " \
                            "style='float: top left; margin-left: -5px; margin-top: -4px;' />" \
                            "<span style=''>%s</span>" % title )

                # create the content of the link div
                s_content_div = DivWdg()
                info['counter'] = info['counter'] + 1
                s_content_div.add_class("SPT_DTS")

                s_content_div.add_attr("spt_path", current_path)
                
                s_content_div.add_class("spt_side_bar_section_content")

                s_content_div.add_style( "padding-left: 11px" )

                if is_open:
                    s_content_div.add_style( "display: block" )
                else:
                    s_content_div.add_style( "display: none" )


                # add the behaviors
                my.add_folder_behavior(s_link_div, element_name, config, options)

                # then get view name from options in order to read a new
                # config and recurse ...
                options_view_name = options.get('view')
                if options_view_name:
                    sub_config = my.get_config( my.config_search_type, options_view_name, default=my.default)
                    my.generate_section( sub_config, s_content_div, info, current_path )

                outer_div.add(s_link_div)
                outer_div.add(s_content_div)
                subsection_div.add( outer_div )

            else:
                # FIXME: specify LinkWdg, it's too loosely defined now
                options = config.get_display_options(element_name)
                options['path'] = '%s/%s' % (current_path, element_name)

                # put in a default class name
                if not options.get('class_name'):
                    options['class_name'] = "tactic.ui.panel.ViewPanelWdg"
                    #FIXME: this cause an error in xmlrpc
                    #options['haha'] = False
                link_wdg = my.get_link_wdg(element_name, config, options)

                if link_wdg:
                    my.add_link_behavior(link_wdg, element_name, config, options)
                    subsection_div.add(link_wdg)
开发者ID:0-T-0,项目名称:TACTIC,代码行数:104,代码来源:base_section_wdg.py


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