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


Python web.Palette类代码示例

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


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

示例1: get_color

 def get_color(my):
     color = Xml.get_attribute( my.node, "color" )
     from pyasm.web import Palette
     theme = Palette.get().get_theme()
     if theme == 'dark':
         color = Common.modify_color(color, -50)
     return color
开发者ID:funic,项目名称:TACTIC,代码行数:7,代码来源:pipeline.py

示例2: get_default_task_xml

    def get_default_task_xml():
        global TASK_PIPELINE

        from pyasm.web import Palette
        palette = Palette.get()
        xml = Xml()
        xml.read_string(TASK_PIPELINE)
        nodes = Xml.get_nodes(xml, "pipeline/process")
        for node in nodes:
            process = Xml.get_attribute(node, "name")
            color = Task.get_default_color(process)
            Xml.set_attribute(node, "color", color)

        return xml.to_string()
开发者ID:CeltonMcGrath,项目名称:TACTIC,代码行数:14,代码来源:task.py

示例3: get_default_color

    def get_default_color(process):
        global default_xml
        global OTHER_COLORS
        #MTM added the if statements linked to statuses
        if process.title() == 'Pending': 
            return "#d7d7d7"
        elif process.title() == 'Ready': 
            return "#b2cee8"
        elif process.title() == 'On_Hold': 
            return "#e8b2b8"
        elif process.title() == 'Client Response': 
            return "#ddd5b8"
        elif process.title() == 'Internal Rejection': 
            return "#ff0000"
        elif process.title() == 'External Rejection': 
            return "#ff0000"
        elif process.title() == 'Failed QC': 
            return "#ff0000"
        elif process.title() == 'Rejected': 
            return "#ff0000"
        elif process.title() == 'Fix Needed': 
            return "#c466a1"
        elif process.title() == 'In_Progress': 
            return "#f5f3a4"
        elif process.title() == 'DR In_Progress': 
            return "#d6e0a4"
        elif process.title() == 'BATON In_Progress': 
            return "#c6e0a4"
        elif process.title() == 'Export In_Progress': 
            return "#796999"
        elif process.title() == 'Need Buddy Check': 
            return "#e3701a"
        elif process.title() == 'Buddy Check In_Progress': 
            return "#1aade3"
        elif process.title() == 'Completed': 
            return "#b7e0a5"
        node = default_xml.get_node("pipeline/process[@name='%s']" % process.title())
        if node is None:
            return OTHER_COLORS.get(process.title())
        color = default_xml.get_attribute(node, "color")
        if not color:
            color = OTHER_COLORS.get(process.title())

        from pyasm.web import Palette
        theme = Palette.get()
        if theme == 'dark':
            color = Common.modify_color(color, -50)

        return color
开发者ID:2gDigitalPost,项目名称:tactic_src,代码行数:49,代码来源:task.py

示例4: get_default_color

    def get_default_color(process):
        global default_xml
        global OTHER_COLORS
        node = default_xml.get_node("pipeline/process[@name='%s']" % process.title())
        if node is None:
            return OTHER_COLORS.get(process.title())
        color = default_xml.get_attribute(node, "color")
        if not color:
            color = OTHER_COLORS.get(process.title())

        from pyasm.web import Palette
        theme = Palette.get()
        if theme == 'dark':
            color = Common.modify_color(color, -50)

        return color
开发者ID:CeltonMcGrath,项目名称:TACTIC,代码行数:16,代码来源:task.py

示例5: __init__

    def __init__(self):
        self.data = {}
        self.data['elements'] = []

        palette = Palette.get()
        background = palette.color("background")
        color = palette.color("background3")

        self.data['bg_colour'] = background

        self.data['y_axis'] = {
            'grid-colour': color,
            'grid-visible': True,
            'colour': color,
        }
        self.data['x_axis'] = {
            'grid-colour': color,
            'grid-visible': False,
            'colour': color,
        }
开发者ID:mincau,项目名称:TACTIC,代码行数:20,代码来源:chart_data.py

示例6: get_display

    def get_display(my):
        from pyasm.biz import Project

        security = Environment.get_security()
        if not security.check_access("builtin", "side_bar_schema", "allow", default="deny"):
            return DivWdg()


        section_div = LabeledHidableWdg(label="Schema Views")
        section_div.set_attr('spt_class_name', Common.get_full_class_name(my) )

        palette = Palette.get()
        color = palette.color("background3")

        project_div = RoundedCornerDivWdg(hex_color_code=color,corner_size="10")
        project_div.set_dimensions( width_str='175px', content_height_str='100px' )

        project = Project.get()
        project_code = project.get_code()
        project_type = project.get_type()

        div = DivWdg()
        section_div.add(project_div)
        project_div.add(div)

        # get project type schema
        schema = Schema.get_by_code(project_code)
        if schema:
            div.add( my.get_schema_wdg(schema) )
        #if not project_type:
        #    raise SetupException("Project type not found for this [%s]" %project_code)
        if project_type:
            schema = Schema.get_predefined_schema(project_type)
            if schema:
                div.add( my.get_schema_wdg(schema) )

        schema = Schema.get_predefined_schema('config')
        div.add( my.get_schema_wdg(schema) )

        schema = Schema.get_admin_schema()
        div.add( my.get_schema_wdg(schema) )

        return section_div


        # create a fake schema
        project = Project.get()
        db_name = project.get_database()
        sql = DbContainer.get(db_name)
        tables = sql.get_tables()
        tables.sort()
        tables_str = "\n".join( ['<search_type name="%s"/>'%x for x in tables] )

        # look at all of the search objects for mapped tables
        search = Search("sthpw/search_object")
        #search.add_where('''"namespace" = 'MMS' or namespace = '{project}' ''')
        search.add_filter("namespace", 'MMS')
        search.add_filter("namespace", '{project}')
        search.add_where("or")
        search_types = search.get_sobjects()
        #for search_type in search_types:
        #    print "hhhh: ", search_type

        schema_xml = '''
        <schema>
        %s
        </schema>
        ''' % tables_str
        schema = SearchType.create("sthpw/schema")
        schema.set_value("code", "table")
        schema.set_value("schema", schema_xml)
        #div.add( my.get_schema_wdg(schema) )



        return section_div
开发者ID:blezek,项目名称:TACTIC,代码行数:76,代码来源:schema_section_wdg.py

示例7: get_display


#.........这里部分代码省略.........
            except:
	        sobject = SearchKey.get_by_search_key(my.search_key)
            sobjects = [sobject]
        else:
            try:
                # this will raise an exception if it is not in a table element
                sobject = my.get_current_sobject()
                if sobject:
                    sobjects = [sobject]
                else:
                    sobjects = []
            except:
                sobject = my.sobjects


        my.layout = my.get_layout_wdg()



        # preprocess using mako
        include_mako = my.kwargs.get("include_mako")
        if not include_mako:
            include_mako = my.view_attrs.get("include_mako")


        if xml:
            mako_node = xml.get_node("config/%s/mako" % my.view)
            if mako_node is not None:
                mako_str = xml.get_node_value(mako_node)
                html = "<%%\n%s\n%%>\n%s" % (mako_str, html)



        from pyasm.web import Palette
        num_palettes = Palette.num_palettes()


        #if include_mako in ['true', True]:
        if include_mako not in ['false', False]:
            html = html.replace("&lt;", "<")
            html = html.replace("&gt;", ">")

            html = my.process_mako(html)



        # preparse out expressions

        # use relative expressions - [expr]xxx[/expr]
        p = re.compile('\[expr\](.*?)\[\/expr\]')
        parser = ExpressionParser()
        matches = p.finditer(html)
        for m in matches:
            full_expr = m.group()
            expr = m.groups()[0]
            result = parser.eval(expr, sobjects, single=True, state=my.state)
            if isinstance(result, basestring):
                result = Common.process_unicode_string(result)
            else:
                result = str(result)
            html = html.replace(full_expr, result )


        # use absolute expressions - [expr]xxx[/expr]
        p = re.compile('\[abs_expr\](.*?)\[\/abs_expr\]')
        parser = ExpressionParser()
开发者ID:southpawtech,项目名称:TACTIC-DEV,代码行数:67,代码来源:custom_layout_wdg.py

示例8: get_display


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

        # Add the script editor listener
        load_div = DivWdg()
        body.add(load_div)
        load_div.add_behavior( {
        'type': 'listen',
        'event_name': 'show_script_editor',
        'cbjs_action': '''
        var js_popup_id = "TACTIC Script Editor";
        var js_popup = $(js_popup_id);
        if( js_popup ) {
            spt.popup.toggle_display( js_popup_id, false );
        }
        else {
            spt.panel.load_popup(js_popup_id, "tactic.ui.app.ShelfEditWdg", {}, {"load_once": true} );
        }
        '''} )



        # deal with the palette defined in /index which can override the palette
        if my.kwargs.get("hash") == ():
            key = "index"
            search = Search("config/url")
            search.add_filter("url", "/%s/%%"%key, "like")
            search.add_filter("url", "/%s"%key)
            search.add_where("or")
            url = search.get_sobject()
            if url:
                xml = url.get_xml_value("widget")
                palette_key = xml.get_value("element/@palette")

                # look up palette the expression for index
                from pyasm.web import Palette
                palette = Palette.get()

                palette.set_palette(palette_key)
                colors = palette.get_colors()
                colors = jsondumps(colors)

                script = HtmlElement.script('''
                    var env = spt.Environment.get();
                    env.set_colors(%s);
                    env.set_palette('%s');
                    ''' % (colors, palette_key)
                )
                body.add(script)


        env = Environment.get()
        client_handoff_dir = env.get_client_handoff_dir(include_ticket=False, no_exception=True)
        client_asset_dir = env.get_client_repo_dir()

        login = Environment.get_login()
        user_name = login.get_value("login")
        user_id = login.get_id()
        login_groups = Environment.get_group_names()


        # add environment information
        script = HtmlElement.script('''
        var env = spt.Environment.get();
        env.set_project('%s');
        env.set_user('%s');
        env.set_user_id('%s');
        var login_groups = '%s'.split('|');
开发者ID:blezek,项目名称:TACTIC,代码行数:67,代码来源:top_wdg.py


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