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


Python SmartMenu.assign_as_local_activator方法代码示例

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


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

示例1: get_section_wdg

# 需要导入模块: from tactic.ui.container import SmartMenu [as 别名]
# 或者: from tactic.ui.container.SmartMenu import assign_as_local_activator [as 别名]
    def get_section_wdg(my, title, description, image, behavior):

        section_wdg = DivWdg()
        section_wdg.set_round_corners()
        section_wdg.add_border()
        section_wdg.add_class("spt_report_top")
        section_wdg.add_style("width: 200px")
        section_wdg.add_style("height: 100px")
        section_wdg.add_style("overflow: hidden")
        section_wdg.add_style("margin: 10px")
        section_wdg.set_box_shadow("0px 0px 10px")

        title_wdg = DivWdg()
        section_wdg.add(title_wdg)
        title_wdg.add(title)
        title_wdg.add_style("height: 20px")
        title_wdg.add_style("padding: 3px")
        title_wdg.add_style("margin-top: 3px")
        title_wdg.add_style("font-weight: bold")
        title_wdg.add_gradient("background", "background")


        button = IconButtonWdg(title="Options", icon=IconWdg.ARROWHEAD_DARK_DOWN)
        title_wdg.add(button)
        button.add_style("float: right")

        # set up menus
        menu = my.get_menu()
        SmartMenu.add_smart_menu_set( button, { 'MENU_ITEM': menu } )
        SmartMenu.assign_as_local_activator( button, "MENU_ITEM", True )


        section_wdg.add_color("background", "background")
        #section_wdg.add_gradient("background", "background", 0, -3)
        section_wdg.add_behavior( {
        'type': 'hover',
        'add_color_modifier': -5,
        'cb_set_prefix': 'spt.mouse.table_layout_hover',
        } )

        desc_div = DivWdg()
        desc_div.add(description)
        desc_div.add_style("padding: 5px 10px 10px 5px")


        div = DivWdg()
        section_wdg.add(div)
        div.add_style("padding: 3px")
        div.add_style("margin: 5px")
        div.add_style("width: 65px")
        div.add_style("height: 50px")
        div.add_style("float: left")
        div.add(image)
        section_wdg.add(desc_div)
        div.add_style("overflow: hidden")

        section_wdg.add_behavior( behavior )
        section_wdg.add_class("hand")

        return section_wdg
开发者ID:0-T-0,项目名称:TACTIC,代码行数:62,代码来源:reports_wdg.py

示例2: get_display

# 需要导入模块: from tactic.ui.container import SmartMenu [as 别名]
# 或者: from tactic.ui.container.SmartMenu import assign_as_local_activator [as 别名]
    def get_display(my):
        security = Environment.get_security()
        if security.check_access("builtin", "view_site_admin", "allow"):
            menus = [my.get_main_menu(), my.get_add_menu(), my.get_edit_menu(), my.get_tools_menu(), my.get_help_menu()]
        else:
            menus = [my.get_main_menu(), my.get_edit_menu(), my.get_help_menu()]

        """
        btn_dd = DivWdg()
        btn_dd.add_styles("width: 36px; height: 18px; padding: none; padding-top: 1px;")

        btn_dd.add( "<img src='/context/icons/common/transparent_pixel.gif' alt='' " \
                   # "title='TACTIC Actions Menu' class='tactic_tip' " \
                    "style='text-decoration: none; padding: none; margin: none; width: 4px;' />" )
        btn_dd.add( "<img src='/context/icons/silk/cog.png' alt='' " \
                "title='TACTIC Actions Menu' class='tactic_tip' " \
                    "style='text-decoration: none; padding: none; margin: none;' />" )
        btn_dd.add( "<img src='/context/icons/silk/bullet_arrow_down.png' alt='' " \
                "title='TACTIC Actions Menu' class='tactic_tip' " \
                    "style='text-decoration: none; padding: none; margin: none;' />" )
        """

        from tactic.ui.widget import SingleButtonWdg

        btn_dd = SingleButtonWdg(title="Global Options", icon=IconWdg.GEAR, show_arrow=True)

        # btn_dd.add_behavior( { 'type': 'hover',
        #            'mod_styles': 'background-image: url(/context/icons/common/gear_menu_btn_bkg_hilite.png); ' \
        #                            'background-repeat: no-repeat;' } )
        smenu_set = SmartMenu.add_smart_menu_set(btn_dd, {"DG_TABLE_GEAR_MENU": menus})
        SmartMenu.assign_as_local_activator(btn_dd, "DG_TABLE_GEAR_MENU", True)
        return btn_dd
开发者ID:hellios78,项目名称:TACTIC,代码行数:34,代码来源:gear_menu_wdg.py

示例3: get_tile_wdg

# 需要导入模块: from tactic.ui.container import SmartMenu [as 别名]
# 或者: from tactic.ui.container.SmartMenu import assign_as_local_activator [as 别名]
    def get_tile_wdg(my, sobject):

        div = DivWdg()
        div.add_class("spt_tile_top")

        div.add_class("spt_table_row")


        top_view = my.kwargs.get("top_view")
        if top_view:
            title_wdg = my.get_view_wdg(sobject, top_view)
        else:
            title_wdg = my.get_title(sobject)
        div.add( title_wdg )


        div.add_attr("spt_search_key", sobject.get_search_key())
        div.add_attr("spt_name", sobject.get_name())
        div.add_attr("spt_search_code", sobject.get_code())

        SmartMenu.assign_as_local_activator( div, 'DG_DROW_SMENU_CTX' )

        div.add_border()
        div.set_box_shadow()
        div.add_color("background", "background", -3)
        div.add_style("margin: 10px")
        div.add_style("overflow: hidden")

        div.add_style("float: left")

        thumb_div = DivWdg()
        thumb_div.add_class("spt_tile_content")
        #thumb_div.add_class("spt_tile_detail")
        div.add(thumb_div)

        width =  240
        height = 160

        thumb_div.add_style("width: %s" % width)
        thumb_div.add_style("height: %s" % height)
        thumb_div.add_style("overflow: hidden")

        thumb = ThumbWdg2()
        thumb.set_sobject(sobject)
        thumb_div.add(thumb)


        bottom_view = my.kwargs.get("bottom_view")
        if bottom_view:
            div.add( my.get_view_wdg(sobject, bottom_view) )



        div.add_attr("ondragenter", "return false")
        div.add_attr("ondragover", "return false")
        div.add_attr("ondrop", "spt.thumb.noop(event, this)")


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

示例4: add_menu_wdg

# 需要导入模块: from tactic.ui.container import SmartMenu [as 别名]
# 或者: from tactic.ui.container.SmartMenu import assign_as_local_activator [as 别名]
    def add_menu_wdg(my, button, menus):

        from tactic.ui.container import SmartMenu

        my.menus = []
        my.menus.append(menu.get_data())

        smenu_set = SmartMenu.add_smart_menu_set( button, { 'BUTTON_MENU': my.menus } )
        SmartMenu.assign_as_local_activator( button, "BUTTON_MENU", True )
开发者ID:0-T-0,项目名称:TACTIC,代码行数:11,代码来源:button_new_wdg.py

示例5: add_file_behaviors

# 需要导入模块: from tactic.ui.container import SmartMenu [as 别名]
# 或者: from tactic.ui.container.SmartMenu import assign_as_local_activator [as 别名]
    def add_file_behaviors(my, item_div, dirname, basename):

        path = "%s/%s" % (dirname, basename)
        item_div.add_attr("spt_path", path)

        item_div.add_class("spt_dir_list_item")
        SmartMenu.assign_as_local_activator( item_div, 'FILE_MENU_CTX' )
        # for explicit Browse
        if my.preselected:
            item_div.add_class("spt_preselected") 
        super(CheckinDirListWdg, my).add_file_behaviors(item_div, dirname, basename)
开发者ID:lucasnemeth,项目名称:TACTIC,代码行数:13,代码来源:checkin_dir_list_wdg.py

示例6: get_item_wdg

# 需要导入模块: from tactic.ui.container import SmartMenu [as 别名]
# 或者: from tactic.ui.container.SmartMenu import assign_as_local_activator [as 别名]
    def get_item_wdg(my, sobject):

        div = DivWdg()
        div.add_class("spt_item_top")
        div.add_style("padding: 10px")
        SmartMenu.assign_as_local_activator( div, 'DG_DROW_SMENU_CTX' )
        div.add_class("spt_table_row")
        div.add_attr("spt_search_key", sobject.get_search_key(use_id=True))
        div.add_attr("spt_search_code", sobject.get_code())
        name = sobject.get_value("name", no_exception=True)
        if not name:
            name = sobject.get_code()
        div.add_attr("spt_name", name)

        table = Table()
        div.add(table)
        table.set_max_width()
        tr = table.add_row()

        width = my.kwargs.get("preview_width")
        if not width:
            width = "240px"

        td = table.add_cell()
        td.add_style("width: %s" % width);
        td.add_style("vertical-align: top")

        """
        from tile_layout_wdg import ThumbWdg2
        thumb_div = DivWdg()
        #td.add(thumb_div)
        thumb_div.add_border()
        thumb_div.set_box_shadow("0px 0px 5px")
        thumb_div.add_color("background", "background", -5)
        thumb_div.add_class("spt_item_content")
        #thumb_div.add_style("min-height: 120px")

        thumb = ThumbWdg2()
        thumb_div.add(thumb)
        thumb.set_sobject(sobject)
        """


        tile_wdg = my.tile_layout.get_tile_wdg(sobject)
        td.add(tile_wdg)

        info_div = my.get_info_wdg(sobject)
        td = table.add_cell(info_div)
        td.add_style("vertical-align: top")


        return div
开发者ID:nuxping,项目名称:TACTIC,代码行数:54,代码来源:tool_layout_wdg.py

示例7: add_dir_behaviors

# 需要导入模块: from tactic.ui.container import SmartMenu [as 别名]
# 或者: from tactic.ui.container.SmartMenu import assign_as_local_activator [as 别名]
    def add_dir_behaviors(my, dir_div, dirname, basename):

        path = "%s/%s" % (dirname, basename)
        dir_div.add_attr("spt_path", path)

        dir_div.add_class("spt_dir_list_item")
        SmartMenu.assign_as_local_activator( dir_div, 'FILE_MENU_CTX' )
        dir_div.add_class("spt_dir")
        # for explicit Browse
        if my.preselected:
            dir_div.add_class("spt_preselected")
            # for dir, only preselect the first one
            my.preselected = False
        super(CheckinDirListWdg, my).add_dir_behaviors(dir_div, dirname, basename)
开发者ID:lucasnemeth,项目名称:TACTIC,代码行数:16,代码来源:checkin_dir_list_wdg.py

示例8: add_file_behaviors

# 需要导入模块: from tactic.ui.container import SmartMenu [as 别名]
# 或者: from tactic.ui.container.SmartMenu import assign_as_local_activator [as 别名]
    def add_file_behaviors(my, item_div, dirname, basename):


        path = "%s/%s" % (dirname, basename)

        file_objects = my.kwargs.get("files")
        file_object = file_objects.get(path)
        if not file_object:
            print "WARNING: No file object for [%s]" % path
            return
        file_search_key = file_object.get_search_key()


        item_div.add_class("spt_dir_list_item")
        item_div.add_attr("spt_path", path)
        item_div.add_attr("spt_file_search_key", file_search_key)
        SmartMenu.assign_as_local_activator( item_div, 'FILE_MENU_CTX' )
开发者ID:asmboom,项目名称:TACTIC,代码行数:19,代码来源:snapshot_files_wdg.py

示例9: get_display

# 需要导入模块: from tactic.ui.container import SmartMenu [as 别名]
# 或者: from tactic.ui.container.SmartMenu import assign_as_local_activator [as 别名]
    def get_display(my):
        assert my.load_script

        widget = DivWdg()
        widget.add_style('float', 'right')

        load_button = TextOptionBtnWdg(label='   Load   ', size='medium')
        load_button.get_top_el().add_style('float', 'left')
        load_button.get_top_el().set_id(my.LOAD_BUTTON_ID)
        load_button.add_behavior(
                {'type': "click_up",
                "cbjs_action":
                "setTimeout(function() {%s}, 200) "% my.load_script
                })
        widget.add(load_button)
        arrow_button = load_button.get_option_widget()
        #widget.add(arrow_button)
        suffix = "ASSET_LOADER_FUNCTIONS"
        menus_in = [ my.smart_menu_data ]


        SmartMenu.add_smart_menu_set( arrow_button,  menus_in)
        SmartMenu.assign_as_local_activator(arrow_button, None, True)

        #SmartMenu.attach_smart_context_menu( load_button, menus_in, False )
        x_div = FloatDivWdg("x")
        x_div.add_color('color','color')
        x_div.add_style('margin-right: 6px')
        widget.add(x_div)
        multiplier = TextWdg()
        multiplier.set_id("load_multiplier")
        multiplier.set_option("size", "1.5")
        multiplier.add_style("font-size: 0.8em")
        multiplier.add_style("float: left")
        multiplier.add_class("load_multiplier")
        widget.add( multiplier )
        return widget
开发者ID:0-T-0,项目名称:TACTIC,代码行数:39,代码来源:loader_button_wdg.py

示例10: get_display

# 需要导入模块: from tactic.ui.container import SmartMenu [as 别名]
# 或者: from tactic.ui.container.SmartMenu import assign_as_local_activator [as 别名]

#.........这里部分代码省略.........
                pre.add(text)

            else:
                line_table = Table()
                pre.add(line_table)
                line_table.add_style("width: 100%")
                count = 1
                for line in lines:
                    #line = line.replace(" ", "&nbsp;")
                    tr = line_table.add_row()
                    if count % 2 == 0:
                        tr.add_color("background", "background", -2)

                    td = line_table.add_cell()

                    # FIXME: hacky
                    if line.startswith('''<span style='background: #CFC'>'''):
                        is_new = True
                    else:
                        td.add_style("vertical-align: top")
                        text = TextWdg()
                        text.add_style("border", "none")
                        text.add_style("text-align", "right")
                        text.add_style("width", "25px")
                        text.add_style("margin", "0 10 0 0")
                        text.add_style("opacity", "0.5")
                        text.set_value(count)
                        td.add(text)
                        count += 1
                        is_new = False

                    td = line_table.add_cell()
                    if not is_new:
                        SmartMenu.assign_as_local_activator( td,'TEXT_CTX' )
                        tr.add_class("spt_line");
                    else:
                        SmartMenu.assign_as_local_activator( td,'TEXT_NEW_CTX' )
                        tr.add_class("spt_new_line");

                    td.add_class("spt_line_content");
                    td.add(line)




            #from tactic.ui.app import AceEditorWdg
            #editor = AceEditorWdg(code=text, show_options=False, readonly=True, height="600px")
             #text_wdg.add(editor)



        # add a click on spt_item
        text_wdg.add_relay_behavior( {
            'type': 'mouseup',
            'bvr_match_class': 'spt_document_item',
            'search_type': self.search_type,
            'cbjs_action': '''

            var top = bvr.src_el.getParent(".spt_document_top");
            var data_el = top.getElement(".spt_document_data");

            var search_key = bvr.src_el.getAttribute("spt_search_key");

            var class_name = 'tactic.ui.panel.ViewPanelWdg';
            var kwargs = {
                'search_type': bvr.search_type,
开发者ID:mincau,项目名称:TACTIC,代码行数:70,代码来源:doc_tool_wdg.py

示例11: handle_is_test

# 需要导入模块: from tactic.ui.container import SmartMenu [as 别名]
# 或者: from tactic.ui.container.SmartMenu import assign_as_local_activator [as 别名]
    def handle_is_test(my, content):

        content.add_behavior( {
            'type': 'mouseover',
            'cbjs_action': '''
            bvr.src_el.setStyle("border", "solid 1px blue");
            bvr.src_el.setStyle("margin", "-1px");
            var els = bvr.src_el.getElements(".spt_test");
            for (var i = 0; i < els.length; i++) {
                els[i].setStyle("display", "");
                break;
            }

            '''
        } )


        content.add_behavior( {
            'type': 'mouseleave',
            'cbjs_action': '''

            bvr.src_el.setStyle("border", "none");
            bvr.src_el.setStyle("margin", "0px");
            var els = bvr.src_el.getElements(".spt_test");
            for (var i = 0; i < els.length; i++) {
                els[i].setStyle("display", "none");
                break;
            }
            '''
        } )


        div = DivWdg()
        content.add(div)
        div.add_style("position: absolute")
        div.add(my.view)
        div.add_class("spt_test")
        div.add_border()
        div.set_box_shadow("1px 1px 1px 1px")
        div.add_style("display: none")
        div.add_style("padding: 3px")
        div.add_style("left: 0px")
        div.add_style("top: -15px")
        #div.add_style("opacity: 0.5")
        div.add_style("inherit: false")
        div.add_style("z-index: 1000")
        div.add_style("background-color: white")
        div.add_class("hand")


        div.add_behavior( {
            'type': 'click_up',
            'cbjs_action': '''
            var top = bvr.src_el.getParent(".spt_custom_top");
            top.setAttribute("spt_is_test", "true");
            var size = top.getSize();
            top.innerHTML = "<div style='width: "+size.x+";height: "+size.y+";padding: 10px; font-weight: bold'>Loading ...</div>";
            spt.panel.refresh(top);
            '''
        } )


        # add in a context menu
        menu = my.get_test_context_menu()
        menus = [menu.get_data()]
        menus_in = {
            'TEST_CTX': menus,
        }
        SmartMenu.attach_smart_context_menu( div, menus_in, False )
        SmartMenu.assign_as_local_activator( div, 'TEST_CTX' )
开发者ID:southpawtech,项目名称:TACTIC-DEV,代码行数:72,代码来源:custom_layout_wdg.py

示例12: get_container

# 需要导入模块: from tactic.ui.container import SmartMenu [as 别名]
# 或者: from tactic.ui.container.SmartMenu import assign_as_local_activator [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

示例13: get_display

# 需要导入模块: from tactic.ui.container import SmartMenu [as 别名]
# 或者: from tactic.ui.container.SmartMenu import assign_as_local_activator [as 别名]

#.........这里部分代码省略.........
                msg = DivWdg("Warning: The widget definition for [%s] uses [%s] and is not meant for use in Edit Layout. Please revise the edit_definition in widget config."% (widget.get_name(), widget.__class__.__name__ ))
                msg.add_style('color: orange')
                content_div.add(msg)
                content_div.add(HtmlElement.br())
                continue
            if my.input_prefix:
                widget.set_input_prefix(my.input_prefix)

           
            if isinstance(widget, HiddenWdg):
                content_div.add(widget)
                continue


            # Set up any validations configured on the widget ...
            from tactic.ui.app import ValidationUtil
            v_util = ValidationUtil( widget=widget )
            v_bvr = v_util.get_validation_bvr()
            if v_bvr:
                if (isinstance(widget, CalendarInputWdg)):
                    widget.set_validation( v_bvr.get('cbjs_validation'), v_bvr.get('validation_warning') );
                else:
                    widget.add_behavior( v_bvr )
                    widget.add_behavior( v_util.get_input_onchange_bvr() )
                  



            new_row = i % num_columns == 0
            if new_row:
                tr = table.add_row()


                if my.color_mode == "default":
                    if i % 2 == 0:
                        tr.add_color("background", "background")
                    else:
                        tr.add_color("background", "background", -5)



           
            show_title = (widget.get_option("show_title") != "false")
            if show_title:
                title = widget.get_title()

                td = table.add_cell(title)
                td.add_style("padding: 10px 15px 10px 5px")
                td.add_style("vertical-align: top")

                title_width = my.kwargs.get("title_width")
                if title_width:
                    td.add_style("width: %s" % title_width)
                else:
                    td.add_style("width: 100px")

                security = Environment.get_security()
                if security.check_access("builtin", "view_site_admin", "allow"):
                    SmartMenu.assign_as_local_activator( td, 'HEADER_CTX' )

                if my.color_mode == "default":
                    td.add_color("border-color", "table_border", default="border")
                    td.add_style("border-width: 1" )
                    td.add_style("border-style: solid" )

                td.add_style("text-align: right" )
 

            if not show_title:
                th, td = table.add_row_cell( widget )
                #td.add_border()

                continue
            else:
                td = table.add_cell( widget )
                #td = table.add_cell( widget.get_value() )
                td.add_style("min-width: 300px")
                td.add_style("padding: 10px 15px 10px 5px")
                td.add_style("vertical-align: top")

                if my.color_mode == "default":
                    td.add_color("border-color", "table_border", default="border")
                    td.add_style("border-width: 1" )
                    td.add_style("border-style: solid" )

                hint = widget.get_option("hint")
                if hint:
                    table.add_data( HintWdg(hint) ) 


        if not my.is_disabled and not my.mode == 'view':
            tr, td = table.add_row_cell( my.get_action_html() )
        
        if my.input_prefix:
            prefix = HiddenWdg("input_prefix", my.input_prefix)
            tr, td = table.add_row_cell()
            td.add(prefix)

        top_div.add(content_div) 
        return top_div
开发者ID:funic,项目名称:TACTIC,代码行数:104,代码来源:edit_wdg.py

示例14: get_display

# 需要导入模块: from tactic.ui.container import SmartMenu [as 别名]
# 或者: from tactic.ui.container.SmartMenu import assign_as_local_activator [as 别名]

#.........这里部分代码省略.........
        inner.add(table)
        table.add_style("margin: 20px")
        table.add_style("box-sizing: border-box")


        if is_owner:
            menu = self.get_action_menu()
            #SmartMenu.add_smart_menu_set( top, { 'BUTTON_MENU': menu } )

        element_names = config.get_element_names()

        index = 0
        for y in range(grid[1]):
            row = DivWdg()
            table.add(row)
            row.add_class("row")
            row.add_style("box-sizing: border-box")

            num_cols = grid[0]
            size = 12 / num_cols

            for x in range(grid[0]):
                col = DivWdg()
                row.add(col)
                col.add_class("col-sm-%s" % size)
                col.add_style("box-sizing: border-box")
                col.add_style("overflow: auto")

                col.add_class("spt_panel_top")



                if is_owner:
                    header = DivWdg()
                    col.add(header)

                    menu_wdg = DivWdg()
                    header.add(menu_wdg)
                    menu_wdg.add_style("float: right")
                    menu_wdg.add("<i class='fa fa-bars'> </i>")
                    menu_wdg.add_class("hand")

                    SmartMenu.add_smart_menu_set( menu_wdg, { 'BUTTON_MENU': menu } )
                    SmartMenu.assign_as_local_activator( menu_wdg, "BUTTON_MENU", True )


                element = None
                title = None
                if index < len(element_names):
                    element_name = element_names[index]
                    #element_name = "%s,%s" % (x,y)

                    element = config.get_display_widget(element_name)
                    title = config.get_element_title(element_name)
                    if not title:
                        title = Common.get_display_title(element_name)

                if not element:
                    element = DivWdg()
                    element.add("No content")
                    element.add_style("height: 100%")
                    element.add_style("width: 100%")
                    element.add_style("text-align: center")
                    element.add_border()
                else:
                    try:
                        element = element.get_buffer_display()
                    except:

                        element = DivWdg()
                        element.add("No content")
                        element.add_style("height: 100%")
                        element.add_style("width: 100%")
                        element.add_style("text-align: center")
                        element.add_border()



                if is_owner:
                    if title:
                        header.add(title)
                    else:
                        header.add("Panel: %s,%s" % (x, y))
                    col.add("<hr/>")

                content = DivWdg()
                col.add(content)
                content.add_class("spt_panel_content")
                content.add_style("min-height: 200px;")


                content.add(element)


                index += 1

        if self.kwargs.get("is_refresh"):
            return inner
        else:
            return top
开发者ID:mincau,项目名称:TACTIC,代码行数:104,代码来源:panel_wdg.py

示例15: get_display

# 需要导入模块: from tactic.ui.container import SmartMenu [as 别名]
# 或者: from tactic.ui.container.SmartMenu import assign_as_local_activator [as 别名]

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

            if category_projects:
                suffix = Common.get_filesystem_name(category)
                label = "%s (%s)" % (category, len(category_projects))
                menu_item = MenuItem(type='submenu', label=label)
                menu_item.set_submenu_tag_suffix(suffix)
                menu.add(menu_item)

                submenu = Menu(width=200, menu_tag_suffix=suffix)
                menus.append(submenu)
                for project in category_projects:
                    add_project_menu(submenu, project)


        from pyasm.security import get_security_version
        security_version = get_security_version()

        for project in projects:
            if project.get_value("category") != "":
                continue

            project_code = project.get_code()
            if security_version >= 2:
                key = { "code": project_code }
                key2 = { "code": "*" }
                keys = [key, key2]
                default = "deny"
                if not security.check_access("project", keys, "allow", default=default):
                    continue
            else:
                if not security.check_access("project", project_code, "view", default="allow"):
                    continue

            add_project_menu(menu, project)



        if not projects:
            menu_item = MenuItem(type='action', label="- No Projects Created -")
            menu_item.add_behavior( {
            'cbjs_action': '''
            '''
            } )
            menu.add(menu_item)




        if security.check_access("builtin", "view_site_admin", "allow") or security.check_access("builtin", "view_template_projects", "allow"):
            search = Search("sthpw/project")
            #search.add_filter("is_template", 'true', quoted=False)
            search.add_filter("is_template", True)
            projects = search.get_sobjects()

            if projects:
                menu_item = MenuItem(type='title', label="Template Projects")
                menu.add(menu_item)

           

            for project in projects:
                project_code = project.get_code()
                if security_version >= 2:
                    key = { "code": project_code }
                    key2 = { "code": "*" }
                    keys = [key, key2]
                    default = "deny"
                    if not security.check_access("project", keys, "allow", default=default):
                        continue
                else:
                    if not security.check_access("project", project_code, "view", default="allow"):
                        continue

                menu_item = MenuItem(type='action', label=project.get_value("title"))
                menu_item.add_behavior( {
                'project_code': project_code,
                'cbjs_action': '''
                spt.app_busy.show("Jumping to Project ["+bvr.project_code+"]", "");
                document.location = '/projects/%s/'
                ''' % project_code
                } )
                menu.add(menu_item)


        if security.check_access("builtin", "view_site_admin", "allow", default="deny") or security.check_access("builtin", "create_projects", "allow", default="deny"):
            menu_item = MenuItem(type='title', label="Admin")
            menu.add(menu_item)
            project = Project.get_by_code("admin")
            add_project_menu(menu, project)





        from tactic.ui.container import SmartMenu
        smenu_set = SmartMenu.add_smart_menu_set( button, { 'BUTTON_MENU': menus } )
        SmartMenu.assign_as_local_activator( button, "BUTTON_MENU", True )


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


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