root/galaxy-central/static/june_2007_style/make_style.py @ 2

リビジョン 2, 4.4 KB (コミッタ: hatakeyama, 14 年 前)

import galaxy-central

  • 属性 svn:executable の設定値 *
行番号 
1#!/usr/bin/env python
2
3import sys, string, os, tempfile, subprocess
4
5# from Cheetah.Template import Template
6from subprocess import Popen, PIPE
7
8assert sys.version_info[:2] >= ( 2, 4 )
9
10# To create a new style ( this is an example ):
11# In case you have not yet installed required packages:
12# % sudo easy_install pyparsing
13# % sudo easy_install http://effbot.org/downloads/Imaging-1.1.7.tar.gz
14# When you have the above installed, add whatever new style you want to /static/june_2007_style/blue_colors.ini and then:
15# % cd ~/static/june_2007_style/
16# % python make_style.py blue_colors.ini blue
17
18def run( cmd ):
19    return Popen( cmd, stdout=PIPE).communicate()[0]
20
21templates = [ ( "base.css.tmpl", "base.css" ),
22              ( "panel_layout.css.tmpl", "panel_layout.css" ),
23              ( "masthead.css.tmpl", "masthead.css" ),
24              ( "library.css.tmpl", "library.css" ),
25              ( "history.css.tmpl", "history.css" ),
26              ( "tool_menu.css.tmpl", "tool_menu.css" ),
27              ( "iphone.css.tmpl", "iphone.css" ),
28              ( "autocomplete_tagging.css.tmpl", "autocomplete_tagging.css" ),
29              ( "trackster.css.tmpl", "trackster.css" ) ]
30
31# TODO: Are these images still being used?  If not, clean this code up!
32images = [
33           ( "./gradient.py 9 30 $panel_header_bg_top - $panel_header_bg_bottom 0 0 $panel_header_bg_bottom 1 1", "panel_header_bg.png" ),
34           ( "./gradient.py 9 30 $panel_header_bg_bottom - $panel_header_bg_top 0 0 $panel_header_bg_top 1 1", "panel_header_bg_pressed.png" ),
35           ( "./gradient.py 9 1000 $menu_bg_top $menu_bg_hatch $menu_bg_over 0 0 $menu_bg_over 1 1", "menu_bg.png" ),
36           ( "./gradient.py 9 1000 $base_bg_top - $base_bg_bottom 0 0 $base_bg_bottom 1 1", "base_bg.png" ),
37           ( "./gradient.py 9 500 $form_body_bg_top - $form_body_bg_bottom 0 0 $form_body_bg_bottom 1 1", "form_body_bg.png" ),
38           ( "./gradient.py 9 50 $masthead_bg $masthead_bg_hatch", "masthead_bg.png" ),
39           ( "./gradient.py 9 30 $footer_title_bg $footer_title_hatch 000000 0 0.5 000000 1 1", "footer_title_bg.png" ),
40           ( "./gradient.py 9 50 $form_title_bg_top $form_title_bg_hatch $form_title_bg_bottom 0 0 $form_title_bg_bottom 1 1", "form_title_bg.png" ),
41           ( "./gradient.py 9 200 $history_ok_bg - FFFFFF 0 0.5 FFFFFF 0.5 1", "ok_bg.png" ),
42           ( "./gradient.py 9 200 $history_error_bg - FFFFFF 0 0.5 FFFFFF 0.5 1", "error_bg.png" ),
43           ( "./gradient.py 9 200 $history_running_bg - FFFFFF 0 0.5 FFFFFF 0.5 1", "warn_bg.png" ),
44           ( "./gradient.py 9 200 $history_queued_bg - FFFFFF 0 0.5 FFFFFF 0.5 1", "gray_bg.png" ),
45           ( "./callout_top.py 20 10 $panel_header_bg_top $layout_border", "popupmenu_callout_top.png" ),
46           ( "./circle.py 12 #FFFFFF #D8B365 right > workflow_circle_open.png" ),
47           ( "./circle.py 12 #BBFFBB #D8B365 right > workflow_circle_green.png" ),
48           ( "./circle.py 12 #FFFFFF #D8B365 none> workflow_circle_drag.png" ),
49           ]
50
51# TODO: Are these shared_images still being used?  If not, clean this code up!
52shared_images = [
53    # Dialog boxes
54    ( "ok_large.png", "done_message_bg", "done_message_icon.png" ),
55    ( "info_large.png", "info_message_bg", "info_message_icon.png" ),
56    ( "warn_large.png", "warn_message_bg", "warn_message_icon.png" ),
57    ( "error_large.png", "error_message_bg", "error_message_icon.png" ),
58    # History icons
59    ( "ok_small.png", "history_ok_bg", "data_ok.png" ),
60    ( "error_small.png", "history_error_bg", "data_error.png" ),
61    ( "wait_small.png", "history_queued_bg", "data_queued.png" ),
62]
63
64if __name__ == "__main__":
65    if len(sys.argv) > 1: # has params
66        ini_file, out_dir = sys.argv[1:]
67    else:
68        cwd = os.getcwd() # default settings
69        ini_file, out_dir = cwd + "/blue_colors.ini", cwd + "/blue"
70
71    for in_file, out_file in templates:
72        print in_file ,"->", out_file
73        subprocess.call( "./process_css.py %s shared_images:../images %s < %s > %s" % ( ini_file, out_dir, in_file, os.path.join( out_dir, out_file ) ), shell=True )
74
75 
76"""
77for rule, output in images:
78    t = string.Template( rule ).substitute( context )
79    print t, "->", output
80    open( os.path.join( out_dir, output ), "w" ).write( run( t.split() ) )
81   
82for src, bg, out in shared_images:
83    t = "./png_over_color.py shared_images/%s %s %s" % ( src, context[bg], os.path.join( out_dir, out ) )
84    print t
85    run( t.split() )
86"""
87
88
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。