當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。