示例#1
0
文件: misc_wdg.py 项目: 0-T-0/TACTIC
    def get_display(my):

        top = my.top

        button_div = DivWdg()
        top.add(button_div)
        button_div.add_class("spt_buttons_top")
        button_div.add_border()

        button_div.add_style("margin-bottom: 0px")
        button_div.add_style("width: 1200px")
        button_div.add_style("height: 33px")
        button_div.add_color("background", "background2")
        button_div.add_style("margin-left: auto")
        button_div.add_style("margin-right: auto")


        button = SingleButtonWdg(title="Collapse", icon=IconWdg.HOME)
        button_div.add(button)
        button.add_style("float: left")
        button.add_style("left: 5px")
        button.add_style("top: 5px")


        # FIXME: get home for the user
        #home = 'tactic.ui.startup.ContentCreatorWdg'
        home = 'tactic.ui.startup.MainWdg'


        button.add_behavior( {
            'type': 'click_up',
            'cbjs_action': '''
            spt.tab.set_main_body_tab();
            var class_name = 'tactic.ui.startup.MainWdg';
            var kwargs = {
                help_alias: 'main'
                };
            spt.tab.add_new("_startup", "Startup", class_name, kwargs);

            '''
        } )


        top_class = my.kwargs.get("top_class")
        list_class = my.kwargs.get("list_class")
        height = my.kwargs.get("height")
        assert(top_class)
        assert(list_class)
        assert(height)

        button = SingleButtonWdg(title="Collapse", icon=IconWdg.ARROW_UP)
        button_div.add(button)
        button.add_class("spt_collapse")
        top.add(button_div)
        button.add_style("float: left")
        button.add_style("left: 5px")
        button.add_style("top: 5px")

        button.add_behavior( {
            'type': 'click_up',
            'top_class': top_class,
            'list_class': list_class,
            'height': height,
            'cbjs_action': '''
            var top = bvr.src_el.getParent("."+bvr.top_class);
            var element = top.getElement("."+bvr.list_class);

            var buttons = bvr.src_el.getParent(".spt_buttons_top");
            expand = buttons.getElement(".spt_expand");
            new Fx.Tween(element).start('margin-top', "-"+bvr.height+"px");
            expand.setStyle("display", "");
            bvr.src_el.setStyle("display", "none");
            '''
        } )

        button = SingleButtonWdg(title="Expand", icon=IconWdg.ARROW_DOWN)
        button.add_style("display: none")
        button.add_class("spt_expand")
        button_div.add(button)
        button.add_style("left: 5px")
        button.add_style("top: 5px")
        top.add(button_div)
        button.add_style("float: left")
        button.add_behavior( {
            'type': 'click_up',
            'top_class': top_class,
            'list_class': list_class,
            'cbjs_action': '''
            var top = bvr.src_el.getParent("."+bvr.top_class);
            var element = top.getElement("."+bvr.list_class);

            var buttons = bvr.src_el.getParent(".spt_buttons_top");
            collapse = buttons.getElement(".spt_collapse");
            new Fx.Tween(element).start('margin-top', "0px");
            collapse.setStyle("display", "");
            bvr.src_el.setStyle("display", "none");
            '''
        } )

        return top
示例#2
0
    def get_display(self):

        top = self.top

        button_div = DivWdg()
        top.add(button_div)
        button_div.add_class("spt_buttons_top")
        button_div.add_border()

        button_div.add_style("margin-bottom: 0px")
        button_div.add_style("width: 1200px")
        button_div.add_style("height: 33px")
        button_div.add_color("background", "background2")
        button_div.add_style("margin-left: auto")
        button_div.add_style("margin-right: auto")

        button = SingleButtonWdg(title="Collapse", icon=IconWdg.HOME)
        button_div.add(button)
        button.add_style("float: left")
        button.add_style("left: 5px")
        button.add_style("top: 5px")

        # FIXME: get home for the user
        #home = 'tactic.ui.startup.ContentCreatorWdg'
        home = 'tactic.ui.startup.MainWdg'

        button.add_behavior({
            'type':
            'click_up',
            'cbjs_action':
            '''
            spt.tab.set_main_body_tab();
            var class_name = 'tactic.ui.startup.MainWdg';
            var kwargs = {
                help_alias: 'main'
                };
            spt.tab.add_new("_startup", "Startup", class_name, kwargs);

            '''
        })

        top_class = self.kwargs.get("top_class")
        list_class = self.kwargs.get("list_class")
        height = self.kwargs.get("height")
        assert (top_class)
        assert (list_class)
        assert (height)

        button = SingleButtonWdg(title="Collapse", icon=IconWdg.ARROW_UP)
        button_div.add(button)
        button.add_class("spt_collapse")
        top.add(button_div)
        button.add_style("float: left")
        button.add_style("left: 5px")
        button.add_style("top: 5px")

        button.add_behavior({
            'type':
            'click_up',
            'top_class':
            top_class,
            'list_class':
            list_class,
            'height':
            height,
            'cbjs_action':
            '''
            var top = bvr.src_el.getParent("."+bvr.top_class);
            var element = top.getElement("."+bvr.list_class);

            var buttons = bvr.src_el.getParent(".spt_buttons_top");
            expand = buttons.getElement(".spt_expand");
            new Fx.Tween(element).start('margin-top', "-"+bvr.height+"px");
            expand.setStyle("display", "");
            bvr.src_el.setStyle("display", "none");
            '''
        })

        button = SingleButtonWdg(title="Expand", icon=IconWdg.ARROW_DOWN)
        button.add_style("display: none")
        button.add_class("spt_expand")
        button_div.add(button)
        button.add_style("left: 5px")
        button.add_style("top: 5px")
        top.add(button_div)
        button.add_style("float: left")
        button.add_behavior({
            'type':
            'click_up',
            'top_class':
            top_class,
            'list_class':
            list_class,
            'cbjs_action':
            '''
            var top = bvr.src_el.getParent("."+bvr.top_class);
            var element = top.getElement("."+bvr.list_class);

            var buttons = bvr.src_el.getParent(".spt_buttons_top");
            collapse = buttons.getElement(".spt_collapse");
            new Fx.Tween(element).start('margin-top', "0px");
            collapse.setStyle("display", "");
            bvr.src_el.setStyle("display", "none");
            '''
        })

        return top