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


Python DivWdg.get_color方法代码示例

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


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

示例1: get_color

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

        div = DivWdg()
        colors = [
            div.get_color("background3"),
            div.get_color("background3", -10),
            div.get_color("background3", -20),
        ]

        default_color = colors[index%3]

        pipeline_code = sobject.get_value("pipeline_code")
        if not pipeline_code:
            pipeline_code = "task"


        """
        parent = sobject.get_parent()
        if not parent:
            #return default_color
            pipeline_code = "task"
        else:
            pipeline_code = parent.get_value("pipeline_code", no_exception=True)
            if not pipeline_code:
                #return default_color
                pipeline_code = "task"
        """


        pipeline = Pipeline.get_by_code(pipeline_code)
        if not pipeline:
            return default_color

        """
        process_name = sobject.get_value("process")
        if not process_name:
            process_name = sobject.get_value("context")

        # get the process
        process = pipeline.get_process(process_name)
        if not process:
            return default_color
        """

        status = sobject.get_value("status")
        process = pipeline.get_process(status)
        if not process:
            return default_color

        color = process.get_color()
        if not color:
            return default_color
        else:
            color = Common.modify_color(color, 0)


        return color
开发者ID:blezek,项目名称:TACTIC,代码行数:59,代码来源:sobject_calendar_wdg.py

示例2: get_color

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

        div = DivWdg()
        colors = [
            div.get_color("background3"),
            div.get_color("background3", -10),
            div.get_color("background3", -20),
        ]

        default_color = colors[index%3]

        try:
            color = sobject.get("color")
            if color:
                return color
        except:
            pass

        bg_color, text_color = my.color_map.get('status')
        if bg_color:
            color_value = bg_color.get(sobject.get_value('status'))
            
            if color_value:
                return color_value

        pipeline_code = sobject.get_value("pipeline_code", no_exception=True)
        if not pipeline_code:
            pipeline_code = "task"


        pipeline = Pipeline.get_by_code(pipeline_code)
        if not pipeline:
            return default_color

        status = sobject.get_value("status", no_exception=True)
        process = pipeline.get_process(status)
        if not process:
            return default_color

        color = process.get_color()
        if not color:
            return default_color
        else:
            color = Common.modify_color(color, 0)


        return color
开发者ID:0-T-0,项目名称:TACTIC,代码行数:49,代码来源:sobject_calendar_wdg.py

示例3: get_elements_wdg

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

        div = DivWdg()
        div.add_style("min-width: 200px")
        div.add_style("min-height: 500px")

        title_wdg = DivWdg()
        div.add(title_wdg)
        title_wdg.add("Elements")
        title_wdg.add_style("padding: 5px")
        title_wdg.add_gradient("background", "background", -10)

        #element_names = ['Checkin', 'Checkout']
        element_names = my.config.get_element_names()

        elements_wdg = DivWdg()
        div.add(elements_wdg)
        elements_wdg.add_style("padding: 5px")


        view = 'tab_config_whatever'


        hover = div.get_color("background", -10)

        for element_name in element_names:
            element_div = DivWdg()
            elements_wdg.add(element_div)
            element_div.add(element_name)
            element_div.add_style("padding: 3px")

            element_div.add_behavior( {
                'type': 'hover',
                'hover': hover,
                'cbjs_action_over': '''bvr.src_el.setStyle("background", bvr.hover)''',
                'cbjs_action_out': '''bvr.src_el.setStyle("background", "")'''
            } )
            element_div.add_class("hand")

            element_div.add_behavior( {
                'type': 'click_up',
                'view': view,
                'element_name': element_name,
                'cbjs_action': '''
                var top = bvr.src_el.getParent(".spt_tab_edit_top");
                var content = top.getElement(".spt_tab_edit_content");
                var class_name = 'tactic.ui.tools.tab_edit_wdg.TabElementDefinitionWdg';
                var kwargs = {
                  view: bvr.view,
                  element_name: bvr.element_name
                };

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


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

示例4: get_display

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


        total_straight = 0
        for index, sobject in enumerate(my.sobjects):
            straight = sobject.get_value("straight_time")
            if straight:
                total_straight += float(straight)

        straight_div = DivWdg()
        div.add(straight_div)
        straight_div.add("%s" % total_straight)
        if not total_straight:
            straight_div.add_style("opacity: 0.3")
        else:
            week_total = my.week_totals.get(my.current_week)
            if week_total == None:
                week_total = 0
            week_total += total_straight
            my.week_totals[my.current_week] = week_total


        div.add_style("padding: 5px")
        div.add_style("text-align: right")
        div.add_style("width: 90")


        if not total_straight:
            color = div.get_color("background", [10, -10, -10])
            div.add_style("background: %s" % color)
            div.add_style("opacity: 0.5")
            div.add_style("font-style: italic")
        else:
            color = div.get_color("background", [-20, 30, -20])
            div.add_style("background: %s" % color)
            div.add_style("font-weight: bold")

        return div
开发者ID:CeltonMcGrath,项目名称:TACTIC,代码行数:41,代码来源:sobject_calendar_wdg.py

示例5: get_doc_wdg

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

        search = Search("config/widget_config")
        search.add_filter("category", "HelpWdg")
        sobjects = search.get_sobjects()

        hover = div.get_color("background", -10)

        for sobject in sobjects:
            help_div = DivWdg()
            div.add(help_div)
            help_div.add_style("padding: 3px")

            view = sobject.get_value("view")
            help_div.add(view)

            help_div.add_class("hand")
            help_div.add_behavior(
                {
                    "type": "hover",
                    "hover": hover,
                    "cbjs_action_over": """
            bvr.src_el.setStyle("background", bvr.hover);
            """,
                    "cbjs_action_out": """
            bvr.src_el.setStyle("background", "");
            """,
                }
            )

            help_div.add_behavior(
                {
                    "type": "click_up",
                    "view": view,
                    "cbjs_action": """
            var top = bvr.src_el.getParent(".spt_help_edit_top");
            var content = top.getElement(".spt_help_edit_content");

            var class_name = 'tactic.ui.app.HelpEditContentWdg';
            var kwargs = {
                view: bvr.view 
            };

            spt.panel.load(content, class_name, kwargs);

            """,
                }
            )

        return div
开发者ID:hellios78,项目名称:TACTIC,代码行数:53,代码来源:help_wdg.py

示例6: get_row_wdgXX

# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import get_color [as 别名]
    def get_row_wdgXX(my, buttons, show_title=False):

        top = DivWdg()
        #top.add_style("-moz-transform: scale(1.0)")
        top.add_style("float: left")
        top.add_style("margin-left: 3px")
        top.add_style("margin-right: 3px")

        if show_title:
            top.add_style("height: 29px")
        else:
            top.add_style("height: 23px")
        top.add_style("height: 33px")

        left = DivWdg()
        left.set_round_corners(20)
        #left.add_style("-moz-border-radius-topleft: 20px")
        #left.add_style("-moz-border-radius-bottomleft: 20px")
        left.add_border()
        left.add_gradient("background", "background", 20, -35)
        #left.add_style("background: black")
        left.add_style("float: left")
        left.add_style("height: 100%")
        left.add_style("width: 5px")
        left.add_style("z-index: 0")
        left.add_style("margin-right: -1")
        top.add(left)

        for button in buttons:
            button.add_style("float: left")
            top.add(button)


        right = DivWdg()
        right.add_style("-moz-border-radius-topright: 20px")
        right.add_style("-moz-border-radius-bottomright: 20px")
        right.add_gradient("background", "background", 20, -35)
        #right.add_style("background: black")
        right.add_style("float: left")
        right.add_style("height: 100%")
        right.add_style("width: 5px")
        #right.add_style("margin-left: -1px")
        right.add_style("z-index: 0")
        right.add_style("border-style: solid")
        right.add_style("border-color: %s" % right.get_color("border") )
        right.add_style("border-width: 1 1 1 0")
        top.add(right)


        return top
开发者ID:0-T-0,项目名称:TACTIC,代码行数:52,代码来源:button_new_wdg.py

示例7: get_title_wdg

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

        title = DivWdg()

        title.add_color("background", "background3")
        title.add_style("height: 20px")
        title.add_style("padding: 6px")
        title.add_style("font-weight: bold")
        title.add_style("font-size: 1.4em")
        title.add_border()

        code = my.parent.get_value("code", no_exception=True)
        name = my.parent.get_value("name", no_exception=True)

        process = my.sobject.get("process")
        task_code = my.sobject.get("code")

        bgcolor = title.get_color("background")
        title.add("<span style='font-size: 1.2em; padding: 4px; margin: 0px 20px 0px 0px; background-color: %s'>%s</span>  Task  <i style='font-size: 0.8em'>(%s)</i> for %s <i style='font-size: 0.8em'>(%s)</i>" % (bgcolor, process, task_code, name, code))
        return title
开发者ID:southpawtech,项目名称:TACTIC-DEV,代码行数:22,代码来源:sobject_wdg.py

示例8: get_display

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

#.........这里部分代码省略.........
            config.set_view(category)
            element_names = config.get_element_names()

            if category == "definition":
                title = "All Reports"
            else:
                title = Common.get_display_title(category)


            category_div = DivWdg()
            categories_div.add(category_div)
            category_div.add(title)
            category_div.add_style("padding: 5px")
            category_div.add_class("hand")

            category_div.add_behavior( {
            'type': 'click_up',
            'category': category,
            'element_names': element_names,
            'class_name': Common.get_full_class_name(my),
            'cbjs_action': '''
            var kwargs = {
                is_refresh: true,
                category: bvr.category,
                element_names: bvr.element_names
            }

            //spt.panel.refresh(top, kwargs);
            var top = bvr.src_el.getParent(".spt_reports_top");
            spt.panel.load(top, bvr.class_name, kwargs);
            '''
            } )

            bgcolor = category_div.get_color("background3", -10)
            category_div.add_behavior( {
            'type': 'mouseover',
            'bgcolor': bgcolor,
            'cbjs_action': '''
            bvr.src_el.setStyle("background", bvr.bgcolor);
            '''
            } )
            category_div.add_behavior( {
            'type': 'mouseout',
            'bgcolor': bgcolor,
            'cbjs_action': '''
            bvr.src_el.setStyle("background", "");
            '''
            } )








        # create a bunch of panels
        table = Table()
        table_div.add(table)
        table.add_color("color", "color")
        table.add_style("margin-top: 20px")
        table.center()
        table_div.add_style("margin: -3px -3px -1px -2px")


        if not reports:
开发者ID:0-T-0,项目名称:TACTIC,代码行数:70,代码来源:reports_wdg.py

示例9: get_display

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

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

        values = [
            "Label",
            "Box",
            "Text",
            "TextArea",
            "Button",
            "Preview",
            "Image",
            "HTML",
            "Table",
            "Border",
            "Custom Layout",
        ]
        names = ["label", "box", "text", "textarea", "button", "preview", "image", "html", "table", "border", "custom"]
        icons = [IconWdg.VIEW]

        for name, value in zip(names, values):

            element_div = DivWdg()
            left_div.add(element_div)
            element_div.add_style("padding: 3px")
            element_div.add_class("SPT_DTS")
            element_div.add_class("hand")

            icon = IconWdg(name, IconWdg.VIEW)
            element_div.add(icon)

            element_div.add(value)
            element_div.add_class("SPT_ELEMENT_CLICK")
            element_div.add_attr("spt_element_name", name)
            element_div.add_style("padding-left: 10px")

            hover = element_div.get_color("background", -10)
            element_div.add_behavior(
                {
                    "type": "hover",
                    "hover": hover,
                    "cbjs_action_over": """bvr.src_el.setStyle("background", bvr.hover)""",
                    "cbjs_action_out": """bvr.src_el.setStyle("background", "")""",
                }
            )
            element_div.add_class("hand")

            element_div.add_behavior(
                {"type": "drag", "drag_el": "@", "cb_set_prefix": "spt.freeform.create_element_drag"}
            )

        """
        button = ActionButtonWdg(title="Save")
        left_div.add(button)
        button.add_behavior( {
        'type': 'click_up',
        'cbjs_action': '''
        var top = bvr.src_el.getParent(".spt_freeform_top");
        var canvas_top = top.getElement(".spt_freeform_canvas_top");
        var canvas = canvas_top.getElement(".spt_freeform_canvas");
        spt.freeform.init(canvas);
        var xml = spt.freeform.export();
        var search_type = canvas.getAttribute("spt_search_type");
        var view = canvas.getAttribute("spt_view");
        if (!search_type || !view) {
            alert("Cannot find search type or view");
            return;
        }
开发者ID:hellios78,项目名称:TACTIC,代码行数:69,代码来源:freeform_layout_wdg.py

示例10: get_display

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

#.........这里部分代码省略.........
                pointer.setStyle("margin-left", menu_size.x - button_size.x);

            } 
            '''
        } )


        outer_wdg = DivWdg()
        top.add(outer_wdg)
            
        # menu_wdg 


        menu_wdg = DivWdg()
        outer_wdg.add(menu_wdg)
        menu_wdg.add_color("color", "color")
        menu_wdg.add_color("background", "background")
        menu_wdg.add_border()
        menu_wdg.add_class("spt_switcher_menu")
        menu_wdg.add_style("display: none")
        menu_wdg.add_style("margin-top", "20px")
        menu_wdg.add_style("position", "absolute")
        menu_wdg.add_style("z-index", "101")
        menu_wdg.add_behavior( {
            'type': 'mouseleave',
            'cbjs_action': '''
            var menu = bvr.src_el;
            var top = menu.getParent(".spt_switcher_top");
            top.removeClass("spt_selected");
            menu.setStyle("display", "none")
            '''
        } )

        border_color = menu_wdg.get_color("border")
        
        # Pointer under activator
        pointer_wdg = DivWdg()
        menu_wdg.add(pointer_wdg)
        pointer_wdg.add('''
            <div class="spt_switcher_first_arrow_div"> </div>
            <div class="spt_switcher_second_arrow_div"> </div>
        ''')
        pointer_wdg.add_class("spt_switcher_popup_pointer")

        style = HtmlElement.style('''
            .spt_switcher_menu .spt_switcher_popup_pointer {
                z-index: 10;
                position: absolute;
                top: -15px;
                right: 15px;
            }

            .spt_switcher_menu .spt_switcher_first_arrow_div {
                border-color: rgba(0, 0, 0, 0) rgba(0, 0, 0, 0) %s;
                top: -15px;
                z-index: 1;
                border-width: 0 15px 15px;
                height: 0;
                width: 0;
                border-style: dashed dashed solid;
                left: 15px;
            }

            .spt_switcher_menu .spt_switcher_second_arrow_div{
                border-color: rgba(0, 0, 0, 0) rgba(0, 0, 0, 0) #fff;
                z-index: 1;
开发者ID:mincau,项目名称:TACTIC,代码行数:70,代码来源:layout_switcher_wdg.py

示例11: get_tile_wdg

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

        div = DivWdg()

        
        div.add_class("spt_tile_top")
        div.add_class("unselectable")
        div.add_style('margin', my.spacing)
        div.add_style('background-color','transparent')
        div.add_style('position','relative')

        div.add_class("spt_table_row")
        div.add_class("spt_table_row_%s" % my.table_id)

        if my.kwargs.get("show_title") not in ['false', False]:
            if my.title_wdg:
                my.title_wdg.set_sobject(sobject)
                div.add(my.title_wdg.get_buffer_display())
            else:
                title_wdg = my.get_title(sobject)
                div.add( title_wdg )

        div.add_attr("spt_search_key", sobject.get_search_key(use_id=True))
        div.add_attr("spt_search_key_v2", sobject.get_search_key())
        div.add_attr("spt_name", sobject.get_name())
        div.add_attr("spt_search_code", sobject.get_code())

        display_value = sobject.get_display_value(long=True)
        div.add_attr("spt_display_value", display_value)

        SmartMenu.assign_as_local_activator( div, 'DG_DROW_SMENU_CTX' )

        
        if my.kwargs.get("show_drop_shadow") not in ['false', False]:
            div.set_box_shadow()
        div.add_color("background", "background", -3)
        
        div.add_style("overflow: hidden")

        div.add_style("float: left")

        border_color = div.get_color('border', modifier=20)

        thumb_drag_div = DivWdg()
        div.add(thumb_drag_div)
        thumb_drag_div.add_class("spt_tile_drag")
        thumb_drag_div.add_style("width: auto")
        thumb_drag_div.add_style("height: auto")
        thumb_drag_div.add_behavior( {
            "type": "drag",
            #'drag_el': 'drag_ghost_copy',
            #//'use_copy': 'true',
            "drag_el": '@',
            'drop_code': 'DROP_ROW',
            'border_color': border_color,
            'search_type': my.search_type,
            "cb_set_prefix": 'spt.tile_layout.image_drag'
        } )

        thumb_div = DivWdg()
        thumb_drag_div.add(thumb_div)
        thumb_div.add_class("spt_tile_content")


        
        thumb_div.add_style("width: %s" % my.aspect_ratio[0])

        thumb_div.add_style("height: %s" % my.aspect_ratio[1])
        #thumb_div.add_style("overflow: hidden")

        kwargs = {'show_name_hover': my.show_name_hover}

        thumb = ThumbWdg2(**kwargs)
        thumb.set_sobject(sobject)
        thumb_div.add(thumb)
        thumb_div.add_border()

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

        div.add_attr("ondragenter", "spt.thumb.noop_enter(event, this)")
        div.add_attr("ondragleave", "spt.thumb.noop_leave(event, this)")
        div.add_attr("ondragover", "return false")
        div.add_attr("ondrop", "spt.thumb.noop(event, this)")
        
        if my.overlay_expr:
            from tactic.ui.widget import OverlayStatsWdg
            stat_div = OverlayStatsWdg(expr = my.overlay_expr, sobject = sobject, bg_color = my.overlay_color)
            div.add(stat_div)


        return div
开发者ID:2gDigitalPost,项目名称:tactic_src,代码行数:99,代码来源:tile_layout_wdg.py

示例12: get_display

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

#.........这里部分代码省略.........
        button.add_style("float: right")
        button.add_style("margin-top: -3px")
        div.add(button)
        button.add_behavior( {
            'type': 'click_up',
            'cbjs_action': '''
            var top = bvr.src_el.getParent(".spt_ingest_top");
            var file_els = top.getElements(".spt_upload_file");
            for ( var i = 0; i < file_els.length; i++) {
                spt.behavior.destroy( file_els[i] );
            };

         '''
         } )




        div.add("<br clear='all'/>")


        files_div = DivWdg()
        files_div.add_style("position: relative")
        files_div.add_class("spt_upload_files")
        div.add(files_div)
        files_div.add_style("max-height: 300px")
        files_div.add_style("height: 300px")
        files_div.add_style("overflow-y: auto")
        files_div.add_border()
        files_div.add_style("padding: 3px")
        files_div.add_color("background", "background3")
        #files_div.add_style("display: none")

        bgcolor = div.get_color("background3")
        bgcolor2 = div.get_color("background3", -3)

        files_div.add_behavior( {
            'type': 'mouseenter',
            'bgcolor': bgcolor2,
            'cbjs_action': '''
            bvr.src_el.setStyle("background", bvr.bgcolor)
            '''
        } )

        files_div.add_behavior( {
            'type': 'mouseout',
            'bgcolor': bgcolor,
            'cbjs_action': '''
            bvr.src_el.setStyle("background", bvr.bgcolor)
            '''
        } )


        background = DivWdg()
        background.add_class("spt_files_background")
        files_div.add(background)
        background.add_style("font-size: 4.0em")
        background.add_style("font-weight: bold")
        background.add_style("opacity: 0.1")
        background.add_style("position: absolute")
        background.add_style("left: 50%")
        background.add_style("top: 100px")
        background.add_border()
        inner_background = DivWdg("Drag Files Here")
        background.add(inner_background)
        inner_background.set_style("position: absolute")
开发者ID:funic,项目名称:TACTIC,代码行数:70,代码来源:ingest_wdg.py

示例13: get_templates_wdg

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

        div = DivWdg()
        div.add_style("padding: 5px")
        div.add_color("background", "background3")
        div.add_style("height: 100%")

        title_div = DivWdg()

        button = ActionButtonWdg(title="+", tip="Choose a Project Template file to install", size="small")
        title_div.add(button)
        button.add_style("float: right")
        button.add_style("margin-top: -6px")
        button.add_style("margin-right: -4px")
        button.add_behavior( {
            'type': 'click_up',
            'cbjs_action': r'''
            var applet = spt.Applet.get();
            spt.app_busy.show('Choose a Project Template file');

            var paths = applet.open_file_browser();
            var server = TacticServerStub.get();
            var cmd = "tactic.ui.app.ProjectTemplateInstallCmd";

            if (!paths.length) {
                return;
            }

            try {
                
                for (var i = 0; i < paths.length; i++) {    
                    if (!paths[i].test(/\.zip/)) {
                        spt.alert('A template file should be a zip file');
                        return;
                    }

                    server.upload_file(paths[i]);
                }

                var kwargs = {
                    paths: paths
                };
                server.execute_cmd(cmd, kwargs);

                var path = paths[0]
                path = path.replace(/\\/g, "/");
                var parts = path.split("/");
                var name = parts[parts.length-1];
                var parts2 = name.split("-");
                var name = parts2[0];


                var top = bvr.src_el.getParent(".spt_project_template_top");
                top.setAttribute("spt_template", name);
                spt.panel.refresh(top);
                spt.app_busy.hide();
                spt.notify.show_message("Project Template ["+name+"] has been installed.");
            }catch (e) {
                spt.app_busy.hide();
                spt.alert(spt.exception.handler(e));
            }

            '''
        } )




        div.add(title_div)
        title_div.add("<b>Installed Templates</b>")
        title_div.add_gradient("background", "background", 0, -10)
        title_div.add_color("color", "color3")
        title_div.add_style("margin: -5px -5px 5px -5px")
        title_div.add_style("font-weight: bold")
        title_div.add_style("padding: 8px")

        templates_div = DivWdg()
        div.add(templates_div)

        templates_div.add_relay_behavior( {
            'type': 'mouseup',
            'bvr_match_class': 'spt_template',
            'cbjs_action': '''
            var top = bvr.src_el.getParent(".spt_project_template_top");
            var content = top.getElement(".spt_project_template_content")
            var class_name = 'tactic.ui.app.ProjectTemplateEditWdg';
            var template_dir = bvr.src_el.getAttribute("spt_template_dir");
            var kwargs = {
                template_dir: template_dir
            };
            spt.panel.load(content, class_name, kwargs);
            '''
        } )
        templates_div.add_class("hand")


        bgcolor = title_div.get_color("background3")
        bgcolor2 = title_div.get_color("background3", -10)
        templates_div.add_relay_behavior( {
            'type': 'mouseover',
#.........这里部分代码省略.........
开发者ID:0-T-0,项目名称:TACTIC,代码行数:103,代码来源:project_template_wdg.py

示例14: get_day_wdg

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

#.........这里部分代码省略.........
        div.add_color("color", "color")
        div.add_style("vertical-align: top")

        
        st_title = SearchType.get(my.search_type).get_value('title')
        if sobjects:
            #ids = "".join( [ "['id','%s']" % x.get_id() for x in sobjects ])
            ids = [ str(x.get_id()) for x in sobjects ]
            ids_filter = "['id' ,'in', '%s']" %'|'.join(ids) 
            expression = "@SOBJECT(%s%s)" % (my.search_type, ids_filter)
            div.add_behavior( {
                'type': "click_up",
                'cbjs_action': '''
                var class_name = 'tactic.ui.panel.TableLayoutWdg';
                var title = '%s: %s';
                var kwargs = {
                    'search_type': '%s',
                    'view': 'table',
                    'show_insert': 'false',
                    'expression': "%s"
                };
                spt.app_busy.show("Loading...")
                setTimeout(function() {
                    //spt.panel.load_popup( title, class_name, kwargs );
                    spt.tab.set_main_body_tab();
                    spt.tab.add_new(title, title, class_name, kwargs);
                    spt.app_busy.hide();
                }, 200)

                ''' % (st_title, str(day),my.search_type, expression ),
            } )


            content = DivWdg()
            content.add_style("vertical-align: top")
            content.add_class("spt_calendar_day_content")

            content.add_style("height: 100%")
            #content.add_style("width: 400px")
            content.add_style("min-height: %s" % my.height);

            my.handler.set_sobjects(sobjects)
        else:
            content = DivWdg()
            content.add_style("vertical-align: top")
            content.add_style("height: 100%")
            #content.add_style("width: 400px")
            content.add_style("min-height: %s" % my.height);

            my.handler.set_sobjects([])

        # force it to be 120px for now
        if my.width:
            content.add_style("width: %spx" % my.width)

        my.handler.set_date(day)

        content.add( my.handler.get_buffer_display() )

        div.add(content)



        today = datetime.today()
       

        # store date like the database does YYYY-MM-DD
        date_str = "%04d-%02d-%02d" % (day.year, day.month, day.day)
        div.add_attr('spt_date', date_str)
        div.add_class('spt_date_day')


        color1 = div.get_color("background")
        color2 = div.get_color("background", -10)


        # put a different color for days that are not in the current month
        if day.month != month:
            div.add_style("color: #c22")
            div.add_style("opacity: 0.7")

            #div.add_style("background-image", "linear-gradient(135deg, #ccc 0%, #ccc 25%, #bbb 25%, #bbb 50%, #ccc 50%, #ccc 75%, #bbb 75%);");
            div.add_style("background-size", "15px 15px")
            div.add_style("background-color", "")
            div.add_style("background-image", "linear-gradient(135deg, rgba(0, 0, 0, 0.06) 25%, rgba(0, 0, 0, 0) 25%, rgba(0, 0, 0, 0) 50%, rgba(0, 0, 0, 0.06) 50%, rgba(0, 0, 0, 0.06) 75%, rgba(0, 0, 0, 0) 75%, rgba(0, 0, 0, 0));")




        elif day.year == today.year and day.month == today.month and day.day == today.day:
            div.add_color("background", "background", [-10, -10, 20])
            color1 = div.get_color("background", [-10, -10, 20])




        div.add_event("onmouseover", "$(this).setStyle('background-color','%s')" % color2)
        div.add_event("onmouseout", "$(this).setStyle('background-color','%s')" % color1)

        return div
开发者ID:CeltonMcGrath,项目名称:TACTIC,代码行数:104,代码来源:sobject_calendar_wdg.py

示例15: get_display

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

        #content.add_event("oncontextmenu", "spt.side_bar.manage_context_menu_action_cbk(); return false")
        context_menu = DivWdg()
        context_menu.add_class('spt_menu_top')
        context_menu.add_behavior( {
            'type': 'load',
            'cbjs_action': '''
            spt.finger_menu = {};
            spt.finger_menu.timeout_id = -1;
            '''
        } )
        context_menu.add_behavior( {
            'type': 'mouseover',
            'cbjs_action': '''
            if (spt.finger_menu.timeout_id != -1) {
                clearTimeout(spt.finger_menu.timeout_id);
                spt.finger_menu.timeout_id = -1;
            }
            '''
        } )

 


        #context_menu.set_box_shadow(color='#fff')
        # this may not be needed as it is set in JS
        context_menu.add_style("z-index: 200")

        # set up what happens when the mouse leaves the actual menu
        my._set_menu_out(context_menu)


        width = my.kwargs.get('width')
        height = my.kwargs.get('height')
        if not height:
            height = 20
        if not width:
            width = 35
        font_size = my.kwargs.get('font_size')
        if not font_size:
            font_size = 'smaller'


        force = my.kwargs.get("force")

        if my.mode == 'horizontal':
            div = DivWdg(css='spt_finger_menu')
            if force:
                div.add_attr("spt_finger_force", force)

            div.add_style("border-color: #aaa")
            div.add_style("border-style: solid")

            if force == "left":
                div.add_style("border-width: 1px 0px 1px 1px")
                div.add_style("border-radius: 12px 0px 0px 12px")
            else:
                div.add_style("border-width: 1px 1px 1px 0px")
                div.add_style("border-radius: 0px 12px 12px 0px")


            div.set_box_shadow(value="0px 0px 2px 1px")
            #div.add_style("z-index: 1000")

            total_width = width * len(my.items) + 15
            div.add_style('width', total_width)
            div.add_styles('height: %spx; padding: 2px;' %height)
            context_menu.add(div)

            div.add_color('background','background', -10)
            palette = div.get_palette()

            sb_title_bg = palette.color('side_bar_title')
            bg_color = div.get_color('background', -10)
            color = div.get_color('color')
            
            for item in my.items:
                mouse_enter_bvr = {'type':'mouseenter', 'cbjs_action': '''
                    bvr.src_el.setStyles({'background': '%s', 'color': 'white'})''' %sb_title_bg}
                mouse_leave_bvr = {'type':'mouseleave', 'cbjs_action': '''
                    bvr.src_el.setStyles({'background': '%s', 'color': '%s'})''' %(bg_color, color)}

                menu_item = FloatDivWdg(css='unselectable hand')
                menu_item.add_color('background','background', -10)
                menu_item.add(item.get_option('label'))

                menu_item.add_behavior( mouse_enter_bvr )
                menu_item.add_behavior( mouse_leave_bvr )

                # add the passed-in bvr
                bvr = item.get_option('bvr_cb')
                menu_item.add_behavior(bvr )


                menu_item.add_styles('margin: 0px 0 0 0; padding: 2px 0 2px 0; text-align: center; font-size: %s; width: %s; height: %spx'%(font_size, width, height-4))
                menu_item.add_behavior({'type': 'click_up',
                    'cbjs_action': '''var menu = bvr.src_el.getParent('.spt_menu_top'); spt.hide(menu);'''})
                div.add(menu_item)
        
#.........这里部分代码省略.........
开发者ID:CeltonMcGrath,项目名称:TACTIC,代码行数:103,代码来源:menu_wdg.py


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