CraftLaunch APIリファレンス

clnch_colortable.py

00001 import clnch_ini
00002 
00003 class ColorSetting:
00004 
00005     def __init__( self, color, enabled, next=None ):
00006         self.color = color
00007         self.enabled = enabled
00008         self.next = next
00009 
00010     def getColor(self):
00011         if self.enabled:
00012             return self.color
00013         elif self.next:
00014             return self.next.getColor()
00015         else:
00016             return (0,0,0)
00017 
00018 def loadSetting():
00019 
00020     global bg_setting
00021     global fg_setting
00022     global bar_fg_setting
00023     global bar_error_fg_setting
00024     global file_fg_setting
00025     global dir_fg_setting
00026     global hidden_file_fg_setting
00027     global hidden_dir_fg_setting
00028     global error_file_fg_setting
00029     global select_file_bg1_setting
00030     global select_file_bg2_setting
00031     global file_cursor_setting
00032     global select_bg_setting
00033     global choice_bg_setting
00034     global edit_fg_setting
00035     global edit_select_fg_setting
00036     global edit_select_bg_setting
00037     global candlist_fg_setting
00038     global candlist_bg_setting
00039     global candlist_select_fg_setting
00040     global candlist_select_bg_setting
00041     global diff_bg1_setting
00042     global diff_bg2_setting
00043     global diff_bg3_setting
00044     
00045     def createColorSetting( name, default ):
00046         return ColorSetting( eval( clnch_ini.get( "COLOR", name, default ) ), True )
00047 
00048     bg_setting                  = createColorSetting( "bg",                "(   0,   0,   0 )" )
00049     fg_setting                  = createColorSetting( "fg",                "( 255, 255, 255 )" )
00050     bar_fg_setting              = createColorSetting( "bar_fg",            "(   0,   0,   0 )" )
00051     bar_error_fg_setting        = createColorSetting( "bar_error_fg",      "( 200,   0,   0 )" )
00052     file_fg_setting             = createColorSetting( "file_fg",           "( 255, 255, 255 )" )
00053     dir_fg_setting              = createColorSetting( "dir_fg",            "( 255, 255, 150 )" )
00054     hidden_file_fg_setting      = createColorSetting( "hidden_file_fg",    "(  85,  85,  85 )" )
00055     hidden_dir_fg_setting       = createColorSetting( "hidden_dir_fg",     "(  85,  85,  50 )" )
00056     error_file_fg_setting       = createColorSetting( "error_file_fg",     "( 255,   0,   0 )" )
00057     select_file_bg1_setting     = createColorSetting( "select_file_bg1",   "(  30, 100, 150 )" )
00058     select_file_bg2_setting     = createColorSetting( "select_file_bg2",   "(  60, 200, 255 )" )
00059     file_cursor_setting         = createColorSetting( "file_cursor",       "( 255, 128, 128 )" )
00060     select_bg_setting           = createColorSetting( "select_bg",         "(  30, 100, 150 )" )
00061     choice_bg_setting           = createColorSetting( "choice_bg",         "(  50,  50,  50 )" )
00062     edit_fg_setting             = createColorSetting( "edit_fg",           "( 255, 255, 255 )" )
00063     edit_select_fg_setting      = createColorSetting( "edit_select_fg",    "( 255, 255, 255 )" )
00064     edit_select_bg_setting      = createColorSetting( "edit_select_bg",    "(  30, 100, 150 )" )
00065     candlist_fg_setting         = createColorSetting( "candlist_fg",       "( 255, 255, 255 )" )
00066     candlist_bg_setting         = createColorSetting( "candlist_bg",       "(  16,  26,  56 )" )
00067     candlist_select_fg_setting  = createColorSetting( "candlist_select_fg","( 255, 255, 255 )" )
00068     candlist_select_bg_setting  = createColorSetting( "candlist_select_bg","(  30, 100, 150 )" )
00069     diff_bg1_setting            = createColorSetting( "diff_bg1",          "( 100,  50,  50 )" )
00070     diff_bg2_setting            = createColorSetting( "diff_bg2",          "(  50, 100,  50 )" )
00071     diff_bg3_setting            = createColorSetting( "diff_bg3",          "(  50,  50, 100 )" )
00072 
00073     _applySetting()
00074 
00075 def saveSetting():
00076     
00077     _applySetting()
00078     
00079     clnch_ini.set( "COLOR", "bg", str( bg_setting.color ) )
00080     clnch_ini.set( "COLOR", "fg", str( fg_setting.color ) )
00081     clnch_ini.set( "COLOR", "bar_fg", str( bar_fg_setting.color ) )
00082     clnch_ini.set( "COLOR", "bar_error_fg", str( bar_error_fg_setting.color ) )
00083     clnch_ini.set( "COLOR", "file_fg", str( file_fg_setting.color ) )
00084     clnch_ini.set( "COLOR", "dir_fg", str( dir_fg_setting.color ) )
00085     clnch_ini.set( "COLOR", "hidden_file_fg", str( hidden_file_fg_setting.color ) )
00086     clnch_ini.set( "COLOR", "hidden_dir_fg", str( hidden_dir_fg_setting.color ) )
00087     clnch_ini.set( "COLOR", "error_file_fg", str( error_file_fg_setting.color ) )
00088     clnch_ini.set( "COLOR", "select_file_bg1", str( select_file_bg1_setting.color ) )
00089     clnch_ini.set( "COLOR", "select_file_bg2", str( select_file_bg2_setting.color ) )
00090     clnch_ini.set( "COLOR", "file_cursor", str( file_cursor_setting.color ) )
00091     clnch_ini.set( "COLOR", "select_bg", str( select_bg_setting.color ) )
00092     clnch_ini.set( "COLOR", "choice_bg", str( choice_bg_setting.color ) )
00093     clnch_ini.set( "COLOR", "edit_fg", str( edit_fg_setting.color ) )
00094     clnch_ini.set( "COLOR", "edit_select_fg", str( edit_select_fg_setting.color ) )
00095     clnch_ini.set( "COLOR", "edit_select_bg", str( edit_select_bg_setting.color ) )
00096     clnch_ini.set( "COLOR", "candlist_fg", str( candlist_fg_setting.color ) )
00097     clnch_ini.set( "COLOR", "candlist_bg", str( candlist_bg_setting.color ) )
00098     clnch_ini.set( "COLOR", "candlist_select_fg", str( candlist_select_fg_setting.color ) )
00099     clnch_ini.set( "COLOR", "candlist_select_bg", str( candlist_select_bg_setting.color ) )
00100     clnch_ini.set( "COLOR", "diff_bg1", str( diff_bg1_setting.color ) )
00101     clnch_ini.set( "COLOR", "diff_bg2", str( diff_bg2_setting.color ) )
00102     clnch_ini.set( "COLOR", "diff_bg3", str( diff_bg3_setting.color ) )
00103    
00104 
00105 def _applySetting():
00106     
00107     global bg
00108     global fg
00109     global bar_fg
00110     global bar_error_fg
00111     global file_fg
00112     global dir_fg
00113     global hidden_file_fg
00114     global hidden_dir_fg
00115     global error_file_fg
00116     global select_file_bg1
00117     global select_file_bg2
00118     global file_cursor
00119     global select_bg
00120     global choice_bg
00121     global edit_fg
00122     global edit_select_fg
00123     global edit_select_bg
00124     global candlist_fg
00125     global candlist_bg
00126     global candlist_select_fg
00127     global candlist_select_bg
00128     global diff_bg1
00129     global diff_bg2
00130     global diff_bg3
00131 
00132     bg                  = bg_setting.getColor()
00133     fg                  = fg_setting.getColor()
00134     bar_fg              = bar_fg_setting.getColor()
00135     bar_error_fg        = bar_error_fg_setting.getColor()
00136     file_fg             = file_fg_setting.getColor()
00137     dir_fg              = dir_fg_setting.getColor()
00138     hidden_file_fg      = hidden_file_fg_setting.getColor()
00139     hidden_dir_fg       = hidden_dir_fg_setting.getColor()
00140     error_file_fg       = error_file_fg_setting.getColor()
00141     select_file_bg1     = select_file_bg1_setting.getColor()
00142     select_file_bg2     = select_file_bg2_setting.getColor()
00143     file_cursor         = file_cursor_setting.getColor()
00144     select_bg           = select_bg_setting.getColor()
00145     choice_bg           = choice_bg_setting.getColor()
00146     edit_fg             = edit_fg_setting.getColor()
00147     edit_select_fg      = edit_select_fg_setting.getColor()
00148     edit_select_bg      = edit_select_bg_setting.getColor()
00149     candlist_fg         = candlist_fg_setting.getColor()
00150     candlist_bg         = candlist_bg_setting.getColor()
00151     candlist_select_fg  = candlist_select_fg_setting.getColor()
00152     candlist_select_bg  = candlist_select_bg_setting.getColor()
00153     diff_bg1            = diff_bg1_setting.getColor()
00154     diff_bg2            = diff_bg2_setting.getColor()
00155     diff_bg3            = diff_bg3_setting.getColor()
00156 

Copyright © 2009 craftware. All rights reserved.