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


Python ActionButtonWdg.add_class方法代码示例

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


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

示例1: get_bottom_wdg

# 需要导入模块: from tactic.ui.widget import ActionButtonWdg [as 别名]
# 或者: from tactic.ui.widget.ActionButtonWdg import add_class [as 别名]
    def get_bottom_wdg(my):
        from tactic.ui.widget import ActionButtonWdg
        div = DivWdg()


        back = ActionButtonWdg(title="< Back", tip="Go back to last page")
        div.add(back)
        back.add_class("spt_wizard_back")
        back.add_style("float: left")

        # FIXME: need to do this because set_style is not the same element as
        # add class
        back.add_behavior( {
        'type': 'load',
        'cbjs_action': '''
        var top = bvr.src_el.getParent(".spt_wizard_top");
        var back = top.getElement(".spt_wizard_back");
        back.setStyle("display", "none");
        '''
        } )

        back.add_behavior( {
        'type': 'click_up',
        'cbjs_action': '''
        var top = bvr.src_el.getParent(".spt_wizard_top");
        var pages = top.getElements(".spt_wizard_page");
        var on_dots = top.getElements(".spt_wizard_on_dot");
        var off_dots = top.getElements(".spt_wizard_off_dot");

        // check boundary
        if (pages[0].hasClass("spt_wizard_selected")) {
            return;
        }

        var selected_index = 0;
        for (var i = 0; i < pages.length; i++) {
            var page = pages[i];
            var on_dot = on_dots[i];
            var off_dot = off_dots[i];
            if (page.hasClass("spt_wizard_selected")) {
                page.removeClass("spt_wizard_selected");
                selected_index = i;
            }
            page.setStyle("display", "none");
            on_dot.setStyle("display", "none");
            off_dot.setStyle("display", "");
        }

        if (selected_index == 1) {
            var back = top.getElement(".spt_wizard_back");
            back.setStyle("display", "none");
        }
        if (selected_index == pages.length-1) {
            var next = top.getElement(".spt_wizard_next");
            next.setStyle("display", "");
        }

        var page = pages[selected_index-1];
        page.setStyle("display", "");
        page.addClass("spt_wizard_selected");
        var on_dot = on_dots[selected_index-1];
        var off_dot = off_dots[selected_index-1];
        on_dot.setStyle("display", "");
        off_dot.setStyle("display", "none");

        '''
        } )




        if my.submit_button:
            submit = my.submit_button
        else:
            command = my.kwargs.get("command")
            submit_title = my.kwargs.get("submit_title")
            if not submit_title:
                submit_title = "Submit"
            submit = ActionButtonWdg(title="%s >>" % submit_title, tip=submit_title)
            submit.add_behavior( {
            'type': 'click_up',
            'command': command,
            'cbjs_action': '''
            var top = bvr.src_el.getParent(".spt_wizard_top");

            var values = spt.api.Utility.get_input_values(top);

            spt.app_busy.show("Executing ...", "");
            var server = TacticServerStub.get();
            try {
                server.execute_cmd(bvr.command, values);
            }
            catch(e) {
                var xml = spt.parse_xml(e);
                var node = xml.getElementsByTagName("string")[0];
                var error = node.textContent;
                spt.error("Error: " + error);
                spt.app_busy.hide();
                throw(e);
            }
#.........这里部分代码省略.........
开发者ID:blezek,项目名称:TACTIC,代码行数:103,代码来源:wizard_wdg.py

示例2: get_top

# 需要导入模块: from tactic.ui.widget import ActionButtonWdg [as 别名]
# 或者: from tactic.ui.widget.ActionButtonWdg import add_class [as 别名]
    def get_top(self):
        top = self.top
        top.add_color("background", "background", -5)
        top.add_style("margin-bottom: -2px")
        top.add_class("spt_filter_top")

        table = Table()
        top.add(table)

        tr, td = table.add_row_cell()


        td.add_class("spt_simple_search_title")


        # add the load wdg
        show_saved_search = True
        if show_saved_search:
            saved_button = ActionButtonWdg(title='Saved', tip='Load Saved Searches')
            saved_button.add_class("spt_simple_search_save_button")
            saved_button.add_behavior( {
                #'type': 'load',
                'search_type': self.search_type,
                'cbjs_action': '''
                var popup = bvr.src_el.getParent(".spt_popup");
                spt.popup.close(popup);
                var class_name = 'tactic.ui.app.LoadSearchWdg';
                var kwargs = {
                    search_type: bvr.search_type
                }
                var layout = spt.table.get_layout();
                var panel = layout.getParent(".spt_view_panel_top");
                var popup = spt.panel.load_popup("Saved Searches", class_name, kwargs);
                popup.activator = panel;
                '''
            } )
            td.add(saved_button)
            saved_button.add_style("float: right")
            saved_button.add_style("margin: 10px")




        clear_button = ActionButtonWdg(title='Clear', tip='Clear all of the filters' )
        td.add(clear_button)
        clear_button.add_class("spt_simple_search_clear_button")
        clear_button.add_style("float: right")
        clear_button.add_style("margin: 10px")
        clear_button.add_behavior( {
        'type': 'click',
        'cbjs_action': '''
        spt.api.Utility.clear_inputs(bvr.src_el.getParent(".spt_filter_top"));
        '''
        } )



        title_div = DivWdg()
        td.add(title_div)
        title_div.add("<div style='font-size: 16px'>Search Criteria</div>")
        title_div.add("<div>Select filters to refine your search</div>")
        title_div.add_style("padding: 20px 0px 0px 20px")

        table.add_style("margin-left: auto")
        table.add_style("margin-right: auto")
        table.add_style("margin-bottom: 15px")
        table.add_style("width: 100%")


        tr = table.add_row()

        if not self.content:
            self.content = DivWdg()
            self.content.add("No Content")

        td = table.add_cell()
        td.add(self.content)
        #self.content.add_style("margin: -2 -1 0 -1")


        show_search = self.kwargs.get("show_search")
        if show_search in [False, 'false']:
            show_search = False
        else:
            show_search = True

        show_search = True
        if show_search:
            search_wdg = self.get_search_wdg()
            table.add_row()
            search_wdg.add_style("float: right")
            search_wdg.add_class("spt_simple_search_button")

            search_wdg.add_style("padding-top: 6px")
            search_wdg.add_style("padding-left: 10px")
            search_wdg.add_style("height: 33px")

            td = table.add_cell()
            td.add(search_wdg)
            td.add_style("padding: 5px 10px")
#.........这里部分代码省略.........
开发者ID:mincau,项目名称:TACTIC,代码行数:103,代码来源:simple_search_wdg.py


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