• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python container.Menu类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: get_context_menu

    def get_context_menu(my):

        menu = Menu(width=180)
        menu.set_allow_icons(False)

        menu_item = MenuItem(type='title', label='Actions')
        menu.add(menu_item)


        menu_item = MenuItem(type='action', label='Remove Share')
        menu.add(menu_item)
        menu_item.add_behavior({
            'type': 'click_up',
            'cbjs_action': '''
            if (!confirm("Delete share?") ) {
                return;
            }

            var activator = spt.smenu.get_activator(bvr);
            var code = activator.getAttribute("spt_share_code");

            var class_name = 'tactic.ui.startup.ShareItemCbk';
            var kwargs = {
                'action': 'delete',
                'code': code
            };
            var server = TacticServerStub.get();
            server.execute_cmd(class_name, kwargs);
            
            var top = activator.getParent(".spt_share_top");
            spt.panel.refresh(top);

            '''
        })
        return menu
开发者ID:blezek,项目名称:TACTIC,代码行数:35,代码来源:share_wdg.py


示例2: get_extra_menu

    def get_extra_menu(my):

        menu = Menu(width=180)
        menu.set_allow_icons(False)

        menu_item = MenuItem(type='title', label='Actions')
        menu.add(menu_item)

        menu_item = MenuItem(type='action', label='Edit Tab Config')
        menu_item.add_behavior( {
        'cbjs_action': '''
        var activator = spt.smenu.get_activator(bvr);
        spt.tab.top = activator.getParent(".spt_tab_top");
        var element_name = 'edit_tab_config';
        var title = 'Edit Tab Config';
        var class_name = 'tactic.ui.manager.ViewManagerWdg';
        var kwargs = {
            search_type: 'prod/asset',
            view: 'tab_config_model'
        }
        spt.tab.add_new(element_name, title, class_name, kwargs);

        '''
        } )
        menu.add(menu_item)


        return menu
开发者ID:davidsouthpaw,项目名称:TACTIC,代码行数:28,代码来源:sobject_wdg.py


示例3: get_test_context_menu

    def get_test_context_menu(my):

        menu = Menu(width=180)
        menu.set_allow_icons(False)

        menu_item = MenuItem(type="title", label="Actions")
        menu.add(menu_item)

        menu_item = MenuItem(type="action", label="Refresh")
        menu.add(menu_item)
        menu_item.add_behavior(
            {
                "type": "click_up",
                "view": my.view,
                "cbjs_action": """
            var activator = spt.smenu.get_activator(bvr);
            var top = activator.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);
 

            """,
            }
        )

        menu_item = MenuItem(type="action", label="Edit")
        menu.add(menu_item)
        menu_item.add_behavior(
            {
                "type": "click_up",
                "view": my.view,
                "cbjs_action": """
            var activator = spt.smenu.get_activator(bvr);
            var popup_top = activator.getParent(".spt_popup");
            var top = popup_top.top;
            if (top) {
                top.setAttribute("spt_view", bvr.view);
                spt.app_busy.show("Loading view: " + bvr.view);
                spt.panel.refresh(top);
                spt.app_busy.hide();
            }
            """,
            }
        )

        return menu
开发者ID:hellios78,项目名称:TACTIC,代码行数:48,代码来源:custom_layout_wdg.py


示例4: get_test_context_menu

    def get_test_context_menu(my):

        menu = Menu(width=180)
        menu.set_allow_icons(False)

        menu_item = MenuItem(type='title', label='Actions')
        menu.add(menu_item)


        menu_item = MenuItem(type='action', label='Refresh')
        menu.add(menu_item)
        menu_item.add_behavior( {
            'type': 'click_up',
            'view': my.view,
            'cbjs_action': '''
            var activator = spt.smenu.get_activator(bvr);
            var top = activator.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);
 

            '''
        } )

        menu_item = MenuItem(type='action', label='Edit')
        menu.add(menu_item)
        menu_item.add_behavior( {
            'type': 'click_up',
            'view': my.view,
            'cbjs_action': '''
            var activator = spt.smenu.get_activator(bvr);
            var popup_top = activator.getParent(".spt_popup");
            var top = popup_top.top;
            if (top) {
                top.setAttribute("spt_view", bvr.view);
                spt.app_busy.show("Loading view: " + bvr.view);
                spt.panel.refresh(top);
                spt.app_busy.hide();
            }
            '''
        } )

        return menu
开发者ID:southpawtech,项目名称:TACTIC-DEV,代码行数:45,代码来源:custom_layout_wdg.py


示例5: get_node_context_menu

    def get_node_context_menu(my):

        menu = Menu(width=180)
        menu.set_allow_icons(False)
        menu.set_setup_cbfn( 'spt.dg_table.smenu_ctx.setup_cbk' )


        menu_item = MenuItem(type='title', label='Actions')
        menu.add(menu_item)


        menu_item = MenuItem(type='action', label='Load Detail Report')
        menu_item.add_behavior( {
            'cbjs_action': '''
            var node = spt.smenu.get_activator(bvr);
            var name = node.getAttribute("spt_element_name");

            var top = node.getParent(".spt_detail_top");
            spt.tab.top = top.getElement(".spt_tab_top");

            var search_key = top.getAttribute("spt_parent_key");
            if (!search_key) {
                search_key = top.getAttribute("spt_search_key");
            }

            var class_name = 'tactic.ui.tools.sobject_wdg.SObjectSingleProcessDetailWdg';
            var kwargs = {
                search_key: search_key,
                process: name
            }

            var title = "Detail ["+name+"]";
            var element_name = "detail_"+name;
            spt.tab.add_new(element_name, title, class_name, kwargs);
            '''
        } )
        menu.add(menu_item)


        return menu
开发者ID:davidsouthpaw,项目名称:TACTIC,代码行数:40,代码来源:sobject_wdg.py


示例6: get_header_context_menu

    def get_header_context_menu(my):

        menu = Menu(width=180)
        menu.set_allow_icons(False)
        menu.set_setup_cbfn( 'spt.dg_table.smenu_ctx.setup_cbk' )

        menu_item = MenuItem(type='title', label='Actions')
        menu.add(menu_item)


        menu_item = MenuItem(type='action', label='Edit Column Definition')
        menu_item.add_behavior( {
            'args' : {
                'search_type': my.search_type,
                'options': {
                    'class_name': 'tactic.ui.manager.ElementDefinitionWdg',
                    'popup_id': 'edit_column_defn_wdg',
                    'title': 'Edit Column Definition'
                }
            },
            'cbjs_action': '''
            spt.alert("Not yet implemented");
            return


            var activator = spt.smenu.get_activator(bvr);
            bvr.args.element_name = activator.getProperty("spt_element_name");
            bvr.args.view = activator.getAttribute('spt_view');
            var popup = spt.popup.get_widget(evt,bvr);
            popup.activator = activator;
            '''
        } )
        menu.add(menu_item)


        return menu
开发者ID:funic,项目名称:TACTIC,代码行数:36,代码来源:edit_wdg.py


示例7: get_text_new_context_menu

    def get_text_new_context_menu(self):

        search_type_obj = SearchType.get(self.search_type)
        title = search_type_obj.get_title()


        menu = Menu(width=180)
        menu.set_allow_icons(False)

        menu_item = MenuItem(type='title', label='Actions')
        menu.add(menu_item)

        menu_item = MenuItem(type='action', label="Update line")
        menu.add(menu_item)
        menu_item.add_behavior( {
            'type': 'click_up',
            'cbjs_action': '''
            var activator = spt.smenu.get_activator(bvr);
            var line_el = activator.getParent(".spt_new_line");
            var prev_line_el = line_el.getPrevious(".spt_line");
            prev_line_el.setStyle("border", "solid 1px red");

            var content = prev_line_el.getElement(".spt_line_content");
            alert(content.innerHTML);



            var prev_line_el = prev_line_el.getPrevious(".spt_line");
            prev_line_el.setStyle("border", "solid 1px red");

            var next_line_el = line_el.getNext(".spt_line");
            next_line_el.setStyle("border", "solid 1px red");

            var next_line_el = next_line_el.getNext(".spt_line");
            next_line_el.setStyle("border", "solid 1px red");
            '''
        } )

        return menu
开发者ID:mincau,项目名称:TACTIC,代码行数:39,代码来源:doc_tool_wdg.py


示例8: get_gear_menu

    def get_gear_menu(my):

        top = DivWdg()

        # FIXME: the gear menu widget should be here
        from tactic.ui.container import GearMenuWdg, Menu, MenuItem

        menu = Menu(width=180)

        menu_item = MenuItem(type="title", label="Actions")
        menu.add(menu_item)

        # create a new element
        menu_item = MenuItem(type="action", label="New Element")
        behavior = {
            "options": {"is_insert": "true", "search_type": my.search_type, "view": my.view},
            "cbjs_action": """

        var activator = spt.smenu.get_activator(bvr);
        var top = activator.getParent(".spt_view_manager_top");
        var detail_panel = top.getElement(".spt_view_manager_detail");

        var class_name = 'tactic.ui.manager.ElementDefinitionWdg';
        var options = bvr.options
        var values = {};
        spt.panel.load(detail_panel, class_name, options, values, false);
        """,
        }
        menu_item.add_behavior(behavior)
        menu.add(menu_item)

        menu_item = MenuItem(type="separator")
        menu.add(menu_item)

        # Show preview of the view
        menu_item = MenuItem(type="action", label="Show Preview")
        behavior = {
            "search_type": my.search_type,
            "view": my.view,
            "cbjs_action": """
        var kwargs = {
          search_type: bvr.search_type,
          view: bvr.view
        };
        var title = "Search Type: [" + bvr.search_type + "], View [" + bvr.view + "]";
        spt.panel.load_popup(title, 'tactic.ui.panel.ViewPanelWdg', kwargs);
        """,
        }
        menu_item.add_behavior(behavior)
        menu.add(menu_item)

        # Show preview of the view
        menu_item = MenuItem(type="action", label="Show Full XML Config")
        behavior = {
            "search_type": my.search_type,
            "view": my.view,
            "cbjs_action": """
        var kwargs = {
          search_type: 'config/widget_config',
          view: 'table',
          expression: "@SOBJECT(config/widget_config['search_type','"+bvr.search_type+"']['view','"+bvr.view+"'])",
          filter: [{}]
        };
        var title = "Widget Config - ["+bvr.search_type+"] ["+bvr.view+"]";
        spt.panel.load_popup(title, 'tactic.ui.panel.ViewPanelWdg', kwargs);
        """,
        }
        menu_item.add_behavior(behavior)
        menu.add(menu_item)

        menu_item = MenuItem(type="separator")
        menu.add(menu_item)

        # New view popup
        new_view_wdg = DivWdg()
        new_view_wdg.add_class("spt_new_view")
        new_view_wdg.add_style("display: none")
        new_view_wdg.add_style("position: absolute")
        new_view_wdg.add_color("background", "background")
        new_view_wdg.add_style("z-index: 100")
        new_view_wdg.add_border()
        new_view_wdg.set_round_corners()
        new_view_wdg.set_box_shadow()
        new_view_wdg.add_style("padding: 30px")
        new_view_wdg.add("New View Name: ")
        new_view_text = TextWdg("new_view")
        new_view_text.add_class("spt_new_view_text")
        new_view_wdg.add(new_view_text)
        new_view_wdg.add(HtmlElement.br(2))

        # new_view_button = ProdIconButtonWdg('Save New View')
        new_view_button = ActionButtonWdg(title="Save", tip="Save New View")
        new_view_button.add_style("float: left")
        new_view_wdg.add(new_view_button)
        new_view_button.add_behavior(
            {
                "type": "click_up",
                "search_type": my.search_type,
                "cbjs_action": """
            var top = bvr.src_el.getParent(".spt_view_manager_top");
#.........这里部分代码省略.........
开发者ID:hellios78,项目名称:TACTIC,代码行数:101,代码来源:view_manager_wdg.py


示例9: get_menu

    def get_menu(my):
        menu = Menu(width=180)
        menu_item = MenuItem(type='title', label='Actions')
        menu.add(menu_item)


        menu_item = MenuItem(type='action', label='View')
        menu_item.add_behavior( {
            'cbjs_action': '''
            var activator = spt.smenu.get_activator(bvr);
            var report_top = activator.getParent(".spt_report_top");
            var kwargs = report_top.kwargs;
            var class_name = report_top.class_name;
            var element_name = report_top.element_name;

            spt.tab.set_main_body_tab();
            spt.tab.add_new(element_name, element_name, class_name, kwargs);
            '''
        } )
        menu.add(menu_item)



        menu_item = MenuItem(type='action', label='Show Definition')
        menu_item.add_behavior( {
            'cbjs_action': '''
            var activator = spt.smenu.get_activator(bvr);
            var report_top = activator.getParent(".spt_report_top");
            var xml = report_top.xml;
            console.log(xml);
            alert(xml);
            '''
        } )
        menu.add(menu_item)


        menu_item = MenuItem(type='separator')
        menu.add(menu_item)


        menu_item = MenuItem(type='action', label='Add to Side Bar')
        menu_item.add_behavior( {
            'cbjs_action': '''
            var activator = spt.smenu.get_activator(bvr);
            var top = activator.getParent(".spt_tab_top");
            spt.tab.top = top;

            var header = activator;
            var title = header.getAttribute("spt_title");

            var report_top = activator.getParent(".spt_report_top");
            var kwargs = report_top.kwargs;
            var class_name = report_top.class_name;
            var element_name = report_top.element_name;

            var element_name = element_name.replace(/ /g, "_");
            element_name = element_name.replace(/\//g, "_");

            var kwargs = {
                class_name: 'LinkWdg',
                display_options: kwargs,
                element_attrs: {
                    title: title
                }
            }

            try {
                spt.app_busy.show("Adding Side Bar Link ["+element_name+"]");
                var server = TacticServerStub.get();
                server.start({description:"Added Side Bar Link ["+element_name+"]"});
                var info = server.add_config_element("SideBarWdg", "definition", element_name, kwargs);
                var info = server.add_config_element("SideBarWdg", "project_view", element_name, {});

                server.finish();
                spt.panel.refresh("side_bar");
                spt.app_busy.hide();
            }
            catch(e) {
                server.abort();
                alert(e);
                spt.app_busy.hide();
                throw(e);
            }

            '''
        } )
        menu.add(menu_item)

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


示例10: get_menu

    def get_menu(self):
        menu = Menu(width=180)
        menu_item = MenuItem(type='title', label='Actions')
        menu.add(menu_item)

        
        menu_item = MenuItem(type='action', label='View')
        menu_item.add_behavior( {
            'cbjs_action': '''
            var activator = spt.smenu.get_activator(bvr);
            var report_top = activator.getParent(".spt_report_top");
            var kwargs = report_top.kwargs;
            var class_name = report_top.class_name;
            var element_name = report_top.element_name;

            spt.tab.set_main_body_tab();
            spt.tab.add_new(element_name, element_name, class_name, kwargs);
            '''
        } )
        menu.add(menu_item)



        menu_item = MenuItem(type='action', label='Show Definition')
        menu_item.add_behavior( {
            'cbjs_action': '''
            var activator = spt.smenu.get_activator(bvr);
            var report_top = activator.getParent(".spt_report_top");
            var xml = report_top.xml;
            alert(xml);
            '''
        } )
        menu.add(menu_item)


        menu_item = MenuItem(type='separator')
        menu.add(menu_item)



        widget_def = '''
<element name='index' palette="BLACK">
  <display class='tactic.ui.panel.CustomLayoutWdg'>
    <view>VIEW</view>
  </display>
</element>
        '''


        menu_item = MenuItem(type='action', label='Set as Project Theme')
        menu_item.add_behavior( {
            'type': 'click_up',
            'widget_def': widget_def,
            'cbjs_action': '''
            var activator = spt.smenu.get_activator(bvr);
            var report_top = activator.getParent(".spt_report_top");
            var kwargs = report_top.kwargs;
            var class_name = report_top.class_name;
            var element_name = report_top.element_name;
            var view = report_top.view;

            if (!confirm("Change theme to ["+view+"]?")) {
                return;
            }

            var widget_def = bvr.widget_def;
            widget_def = widget_def.replace(/VIEW/, view);

            var data = {
                url: '/index',
                description: 'Index Page',
                widget: widget_def
            }

            var server = TacticServerStub.get();
            var url = server.eval("@SOBJECT(config/url['url','/index'])", {single:true});
            if (url) {
                server.update(url, data);
            }
            else {
                server.insert('config/url', data);
            }

            '''
        } )
        menu.add(menu_item)

        return menu
开发者ID:mincau,项目名称:TACTIC,代码行数:88,代码来源:themes_wdg.py


示例11: add_top_behaviors


#.........这里部分代码省略.........
        var last_index;
        var cur_index;
        for (var i = 0; i < rows.length; i++) {
            if (rows[i] == last_selected) {
                last_index = i;
            }
            if (rows[i] == bvr.src_el) {
                cur_index = i;
            }
        }
        var start_index;
        var end_index;
        if (last_index < cur_index) {
            start_index = last_index + 1;
            end_index = cur_index ;
        }
        else {
            start_index = cur_index;
            end_index = last_index -1 ;
        }

        for (var i = start_index; i < end_index+1; i++) {
            spt.checkin_list.select(rows[i]);
        }

        spt.checkin_list.last_selected = bvr.src_el;
        '''
        } )




        # add a top menu
        menu = Menu(width=180)
        my.menu = menu
        menu_item = MenuItem(type='title', label='Actions')
        menu.add(menu_item)


        #menu_item = MenuItem(type='action', label='Revert to Latest')
        #menu.add(menu_item)




        menu_item = MenuItem(type='action', label='Open File')
        menu.add(menu_item)
        menu_item.add_behavior( {
            'type': 'click_up',
            'cbjs_action': '''
            var applet = spt.Applet.get();

            var activator = spt.smenu.get_activator(bvr);
            var path = activator.getAttribute("spt_path");
            applet.open_file(path);
            '''
        } )



        menu_item = MenuItem(type='action', label='Open Containing Folder')
        menu.add(menu_item)
        menu_item.add_behavior( {
            'type': 'click_up',
            'cbjs_action': '''
            var applet = spt.Applet.get();
开发者ID:lucasnemeth,项目名称:TACTIC,代码行数:67,代码来源:checkin_dir_list_wdg.py


示例12: add_base_dir_behaviors

    def add_base_dir_behaviors(my, div, base_dir):

        # add tooltip
        div.add_attr('title','This is the sandbox folder. Double-click to open and right-click for more options.')
        # add a top menu
        menu = Menu(width=180)
        menu_item = MenuItem(type='title', label='Actions')
        menu.add(menu_item)
        menu_item = MenuItem(type='action', label='Explore sandbox folder')
        menu.add(menu_item)
        menu_item.add_behavior( {
            'type': 'click_up',
            'base_dir': base_dir,
            'cbjs_action': '''
            var applet = spt.Applet.get();
            var activator = spt.smenu.get_activator(bvr);
            var path = bvr.base_dir;
            applet.open_file(path);
            '''
        } )


        menu_item = MenuItem(type='action', label='Browse for sandbox folder')
        menu.add(menu_item)
        # FIXME: this code is identical to the one in checkin_wdg.py
        menu_item.add_behavior( {
        'type': 'click_up',
        'base_dir': base_dir,
        'cbjs_action': '''
            var current_dir = bvr.base_dir;
            var applet = spt.Applet.get();
            var file_paths = applet.open_file_browser(current_dir);

            // take the first one make sure it is a directory
            var dir = file_paths[0];
            if (!applet.is_dir(dir)) {
                spt.alert("Please Select a Folder");
                return;
            }
            dir = dir.replace(/\\\\/g, "/");

            var activator = spt.smenu.get_activator(bvr);
            var top = activator.getParent(".spt_checkin_top");
            top.setAttribute("spt_sandbox_dir", dir);
            spt.panel.refresh(top);

        '''
        } )


        menu_item = MenuItem(type='action', label='Download from clipboard')
        menu.add(menu_item)
        menu_item.add_behavior( {
        'type': 'click_up',
        'base_dir': base_dir,
        'cbjs_action': '''
        var current_dir = bvr.base_dir;
        var server = TacticServerStub.get();
        var base = spt.Environment.get().get_server_url();
        var user = spt.Environment.get().get_user();

        var expr = "@SOBJECT(sthpw/clipboard['login','"+user+"'].sthpw/file)";
        var items = server.eval(expr);

        var applet = spt.Applet.get();

        var urls = [];
        for (var i = 0; i < items.length; i++) {
            var url = base + "/assets/" + items[i].relative_dir + "/" + items[i].file_name;
            var file_name = items[i].file_name;
            applet.download_file(url, current_dir + "/" + file_name);
        }

        var activator = spt.smenu.get_activator(bvr);
        var top = activator.getParent(".spt_checkin_top");
        spt.panel.refresh(top);

        '''
        } )

        menus_in = {
            'SANDBOX_MENU_CTX': menu,
        }
        SmartMenu.attach_smart_context_menu( div, menus_in, False )
        SmartMenu.assign_as_local_activator( div, 'SANDBOX_MENU_CTX' )


        super(CheckinDirListWdg, my).add_base_dir_behaviors(div,base_dir)
开发者ID:lucasnemeth,项目名称:TACTIC,代码行数:88,代码来源:checkin_dir_list_wdg.py


示例13: get_add_menu

    def get_add_menu(my):
        from tactic.ui.container import Menu, MenuItem

        menu = Menu(width=180)
        menu.set_allow_icons(False)
        # menu.set_setup_cbfn( 'spt.dg_table.smenu_ctx.setup_cbk' )

        menu_item = MenuItem(type="title", label="Add Item")
        menu.add(menu_item)

        menu_item = MenuItem(type="action", label="Label")
        menu_item.add_behavior({"element_name": "label", "cbjs_action": my.get_add_bvr_action()})
        menu.add(menu_item)

        menu_item = MenuItem(type="action", label="Text")
        menu_item.add_behavior({"element_name": "text", "cbjs_action": my.get_add_bvr_action()})
        menu.add(menu_item)

        menu_item = MenuItem(type="action", label="TextArea")
        menu_item.add_behavior({"element_name": "textarea", "cbjs_action": my.get_add_bvr_action()})
        menu.add(menu_item)

        return menu
开发者ID:hellios78,项目名称:TACTIC,代码行数:23,代码来源:freeform_layout_wdg.py


示例14: add_top_behaviors


#.........这里部分代码省略.........
        var last_index;
        var cur_index;
        for (var i = 0; i < rows.length; i++) {
            if (rows[i] == last_selected) {
                last_index = i;
            }
            if (rows[i] == bvr.src_el) {
                cur_index = i;
            }
        }
        var start_index;
        var end_index;
        if (last_index < cur_index) {
            start_index = last_index + 1;
            end_index = cur_index ;
        }
        else {
            start_index = cur_index;
            end_index = last_index -1 ;
        }

        for (var i = start_index; i < end_index+1; i++) {
            spt.checkin_list.select(rows[i]);
        }

        spt.checkin_list.last_selected = bvr.src_el;
        '''
        } )




        # add a top menu
        menu = Menu(width=180)
        self.menu = menu
        menu_item = MenuItem(type='title', label='Actions')
        menu.add(menu_item)


        #menu_item = MenuItem(type='action', label='Revert to Latest')
        #menu.add(menu_item)




        menu_item = MenuItem(type='action', label='Open File')
        menu.add(menu_item)
        menu_item.add_behavior( {
            'type': 'click_up',
            'cbjs_action': '''
            var applet = spt.Applet.get();

            var activator = spt.smenu.get_activator(bvr);
            var path = activator.getAttribute("spt_path");
            applet.open_file(path);
            '''
        } )



        menu_item = MenuItem(type='action', label='Open Containing Folder')
        menu.add(menu_item)
        menu_item.add_behavior( {
            'type': 'click_up',
            'cbjs_action': '''
            var applet = spt.Applet.get();
开发者ID:mincau,项目名称:TACTIC,代码行数:67,代码来源:checkin_dir_list_wdg.py


示例15: get_text_context_menu

    def get_text_context_menu(self):

        search_type_obj = SearchType.get(self.search_type)
        title = search_type_obj.get_title()


        menu = Menu(width=180)
        menu.set_allow_icons(False)

        menu_item = MenuItem(type='title', label='Actions')
        menu.add(menu_item)



        label = 'Create New "%s"' % title
        menu_item = MenuItem(type='action', label=label)
        menu.add(menu_item)
        menu_item.add_behavior( {
            'type': 'click_up',
            'search_type': self.search_type,
            'column': self.column,
            'cbjs_action': r'''
            var activator = spt.smenu.get_activator(bvr);

            var selection = spt.document.selected_text;
            if (!selection) {
                alert("Nothing selected");
                return;
            }

            spt.app_busy.show("Adding " + bvr.search_type);


            var data = {}
            data[bvr.column] = selection;

            var server = TacticServerStub.get();
            server.insert(bvr.search_type, data);

            spt.app_busy.hide();
            '''
        } )


        label = '%s (Detail)' % label
        menu_item = MenuItem(type='action', label=label)
        menu.add(menu_item)
        menu_item.add_behavior( {
            'type': 'click_up',
            'search_type': self.search_type,
            'cbjs_action': r'''
            var activator = spt.smenu.get_activator(bvr);

            var selection = spt.document.selected_text;
            if (!selection) {
                alert("Nothing selected");
                return;
            }

            var class_name = 'tactic.ui.panel.EditWdg';
            var kwargs = {
                search_type: bvr.search_type,
                default: {
                  description: selection
                }
            }


            spt.panel.load_popup("Add", class_name, kwargs);
            '''
        } )



        menu_item = MenuItem(type='separator')
        menu.add(menu_item)

        menu_item = MenuItem(type='action', label='Search')
        menu.add(menu_item)
        menu_item.add_behavior( {
            'type': 'click_up',
            'search_type': self.search_type,
            'cbjs_action': r'''
            var activator = spt.smenu.get_activator(bvr);
            var selection = spt.document.selected_text;
            if (!selection) {
                alert("Nothing selected");
                return;
            }

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

            spt.app_busy.show("Searching " + selection);

            var class_name = 'tactic.ui.panel.ViewPanelWdg';
            var kwargs = {
                'search_type': bvr.search_type,
                'keywords': selection,
                'simple_search_view': 'simple_filter',
#.........这里部分代码省略.........
开发者ID:mincau,项目名称:TACTIC,代码行数:101,代码来源:doc_tool_wdg.py


示例16: get_display


#.........这里部分代码省略.........
        # the relative path to the root.  The following removes
        # the root of the sandbox folder assuming that this is mapped
        # to the base of the depot
        my.root_sandbox_dir = Environment.get_sandbox_dir()
        repo_dir = my.sandbox_dir
        repo_dir = my.sandbox_dir.replace("%s/" % my.root_sandbox_dir, "")



        #button.add_style("padding-right: 14px")
        button.add_style("float: left")
        button.add_behavior( {
        'type': 'click_up',
        'repo_dir': repo_dir,
        'cbjs_action': '''
        var top = bvr.src_el.getParent(".spt_checkin_top");
        spt.app_busy.show("Reading file system ...")

        var data = spt.scm.checkout(bvr.repo_dir)
        spt.panel.refresh(top);

        spt.app_busy.hide();
        '''
        } )





        button = ButtonNewWdg(title="Perforce Actions", icon=IconWdg.PERFORCE, show_arrow=True)
        #button.set_show_arrow_menu(True)
        button_row.add(button)

        menu = Menu(width=220)
        menu_item = MenuItem(type='title', label='Perforce')
        menu.add(menu_item)

        menu_item = MenuItem(type='action', label='Show Workspaces')
        menu.add(menu_item)
        menu_item.add_behavior( {
            'type': 'click_up',
            'cbjs_action': '''
            var activator = spt.smenu.get_activator(bvr);

            var class_name = 'tactic.ui.checkin.WorkspaceWdg';
            var top = activator.getParent(".spt_checkin_top");
            var content = top.getElement(".spt_checkin_content");

            var el = top.getElement(".spt_mode");
            el.value = "workspace";

            var kwargs = {};
            spt.panel.load(content, class_name, kwargs);
            '''
        } )





        menu_item = MenuItem(type='action', label='Show Changelists')
        menu.add(menu_item)
        menu_item.add_behavior( {
            'type': 'click_up',
            'cbjs_action': '''
            var activator = spt.smenu.get_activator(bvr);
开发者ID:blezek,项目名称:TACTIC,代码行数:67,代码来源:scm_dir_list_wdg.py


示例17: get_display

    def get_display(my):

        menus = []

        widget = DivWdg(id='ProjectSelectWdg', css='spt_panel')
        widget.set_attr('spt_class_name', 'tactic.ui.app.ProjectSelectWdg') 
        if not WebContainer.get_web().is_IE():
            widget.add_style("float: right")

        from tactic.ui.widget import SingleButtonWdg
        button = SingleButtonWdg(title='Open Project', icon=IconWdg.PROJECT, show_arrow=True)
        widget.add(button)


        #from tactic.ui.activator import ButtonForDropdownMenuWdg
        #menu_data = []
        #menu_id = "project_select_menu"

        allowed = Project.get_user_projects()
        allowed_codes = [x.get_code() for x in allowed]

        search = Search("sthpw/project")
        search.add_filters("code", allowed_codes)
        # ignore some builtin projects
        search.add_where("\"code\" not in ('admin','sthpw','unittest')")
        search.add_op("begin")
        #search.add_filter("is_template", 'true', quoted=False, op='!=')
        search.add_filter("is_template", True, op='!=')
        search.add_filter("is_template", 'NULL', quoted=False, op='is')
        search.add_op("or")
        projects = search.get_sobjects()


        from tactic.ui.container import  Menu, MenuItem
        menu = Menu(width=240)
        menus.append(menu)
        menu.set_allow_icons(False)

        security = Environment.get_security()
        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='Project Action')
            menu.add(menu_item)

            menu_item = MenuItem(type='action', label='Create New Project')
            menu.add(menu_item)
            menu_item.add_behavior( {
            'cbjs_action': '''
            //spt.popup.open('create_project_wizard');
            //Effects.fade_in($('create_project_wizard'), 200);
            var env = spt.Environment.get();
            var project = env.get_project();
            if (project == 'admin') {
                spt.tab.set_main_body_top();
                var class_name = 'tactic.ui.app.ProjectCreateWdg';
                spt.tab.add_new("create_project", "Create Project", class_name);
            }
            else {
                document.location = "/tactic/admin/link/create_project";
            }
            '''
            } )


            search = Search("config/url")
            search.add_filter("url", "/index")
            url = search.get_sobject()
            if url:
                menu_item = MenuItem(type='action', label='Open Index')
                menu.add(menu_item)
                menu_item.add_behavior( {
                'cbjs_action': '''
                var env = spt.Environment.get();
                var project = env.get_project();
                //document.location = "/tactic/" + project + "/";
                window.open('/tactic/'+project+'/');
                '''
                } )




        menu_item = MenuItem(type='title', label='Open Project')
        menu.add(menu_item)


        def add_project_menu(menu, project):
            project_code = project.get_code()
            menu_item = MenuItem(type='action', label=project.get_value("title"))

            web = WebContainer.get_web()
            browser = web.get_browser()

            if browser != 'Qt':

                menu_item.add_behavior( {
                'type': 'click_up',
                'project_code': project_code,
                'cbjs_action': '''
                window.open('/tactic/%s/');
                ''' % project_code
#.........这里部分代码省略.........
开发者ID:hellios78,项目名称:TACTIC,代码行数:101,代码来源:page_header_wdg.py


示例18: add_top_behaviors

    def add_top_behaviors(my, top):

        # convert this to a repo directory
        asset_dir = Environment.get_asset_dir()

        # FIXME: not sure how general this
        #webdirname = "/assets/%s" % dirname.replace(asset_dir, "")

        web = WebContainer.get_web()
        browser = web.get_browser()


        if browser == 'Qt':
            top.add_relay_behavior( {
            'type': 'dblclick',
            'bvr_match_class': 'spt_dir_list_item',
            'cbjs_action': '''
            var path = bvr.src_el.getAttribute("spt_path");
            var asset_dir = '%s';
            var url = "/assets/" + path.replace(asset_dir, "");
            //window.open(url);

            var url_parts = url.split("/");
            var file = url_parts.pop();
            file = encodeURIComponent(file);
            url_parts.push(file);
            url = url_parts.join("/");

            var class_name = 'tactic.ui.widget.EmbedWdg';
            var kwargs = {
                src: url
            }

            var parts = path.split("/");
            var filename = parts[parts.length-1];
            spt.tab.set_main_body_tab()
            spt.tab.add_new(filename, filename, class_name, kwargs);
            ''' % asset_dir
            } )
        else:
            top.add_relay_behavior( {
            'type': 'dblclick',
            'bvr_match_class': 'spt_dir_list_item',
            'cbjs_action': '''
            var path = bvr.src_el.getAttribute("spt_path");
            
            if (path.indexOf('####') != -1) {
                spt.info('Cannot open the file sequence');
            } 
            else {
            var asset_dir = '%s';
            var url = "/assets/" + path.replace(asset_dir, "");

            var url_parts = url.split("/");
            var filename = url_parts.pop();
            filename = encodeURIComponent(filename);
            url_parts.push(filename);
            url = url_parts.join("/");

            window.open(url);
            }
            ''' % asset_dir
            } )

        # add a top menu
        menu = Menu(width=180)
        menu_item = MenuItem(type='title', label='Actions')
        menu.add(menu_item)

        menu_item = MenuItem(type='action', label='Download to Folder')
        menu.add(menu_item)
        menu_item.add_behavior( {
        'type': 'click_up',
        'cbjs_action': '''
            var activator = spt.smenu.get_activator(bvr);
            var applet = spt.Applet.get();
            var select_dir = true;
            var dir = applet.open_file_browser('', select_dir);
            if (!dir) {
                dir = applet.get_current_dir();
            }
            if (!dir) {
                spt.alert("No folder selected to copy to");
                return;
            }
            
            var path = activator.getAttribute("spt_path");

            var asset_dir = '%s';
            var env = spt.Environment.get();
            va 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python container.MenuItem类代码示例发布时间:2022-05-27
下一篇:
Python command.PythonCmd类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap