ó f Qc@s,dZdZddlZddlZddlZddlZddlmZddlmZddlmZddl m Z ddl m Z ej d Z d Z d Zd d ejjejd dƒgZd„Zdd„Zd„Zdddddd„Zd„Zd„Zedkr(eƒndS(sPynche -- The PYthon Natural Color and Hue Editor. Contact: %(AUTHNAME)s Email: %(AUTHEMAIL)s Version: %(__version__)s Pynche is based largely on a similar color editor I wrote years ago for the SunView window system. That editor was called ICE: the Interactive Color Editor. I'd always wanted to port the editor to X but didn't feel like hacking X and C code to do it. Fast forward many years, to where Python + Tkinter provides such a nice programming environment, with enough power, that I finally buckled down and implemented it. I changed the name because these days, too many other systems have the acronym `ICE'. This program currently requires Python 2.2 with Tkinter. Usage: %(PROGRAM)s [-d file] [-i file] [-X] [-v] [-h] [initialcolor] Where: --database file -d file Alternate location of a color database file --initfile file -i file Alternate location of the initialization file. This file contains a persistent database of the current Pynche options and color. This means that Pynche restores its option settings and current color when it restarts, using this file (unless the -X option is used). The default is ~/.pynche --ignore -X Ignore the initialization file when starting up. Pynche will still write the current option settings to this file when it quits. --version -v print the version number and exit --help -h print this message initialcolor initial color, as a color name or #RRGGBB format s1.4.1iÿÿÿÿN(t PyncheWidget(t Switchboard(t StripViewer(t ChipViewer(t TypeinVieweris Barry Warsawsbarry@python.orgs/usr/openwin/lib/rgb.txts/usr/lib/X11/rgb.txts X/rgb.txtcCs ttƒS(N(t__doc__tglobals(((s1/usr/lib64/python2.7/site-packages/pynche/Main.pyt docstringSstcCs'tƒGH|r|GHntj|ƒdS(N(Rtsystexit(tcodetmsg((s1/usr/lib64/python2.7/site-packages/pynche/Main.pytusageWscCsŸ|d„}||ƒ\}}}|dkrI|d|ƒ\}}}n|dkrvdG|GH|dƒ\}}}n|dkr’tddƒn|||fS(NcSsty|j|ƒ\}}}WnHtjk rfytj|ƒ\}}}Wqgtjk rbdSXnX|||fS(N(NNN(t find_bynametColorDBtBadColortrrggbb_to_triplettNone(tstcolordbtrtgtb((s1/usr/lib64/python2.7/site-packages/pynche/Main.pyt scan_coloras t#s Bad initial color, using gray50:tgray50is#Cannot find an initial color to use(RR (RRRRRR((s1/usr/lib64/python2.7/site-packages/pynche/Main.pyt initial_color_s     cCs t| o |ƒ}|dkr7|jƒjdƒ}nd}t}|dkr_|jƒ}nxe|dkrÆytj|ƒ}Wntt fk ršnX|dkrb|s±Pn|jdƒ}qbqbW|sÝt ddƒn|j |ƒt t |d|ƒ}|jƒ} |jt|| ƒƒ|jt|| ƒƒ|jt|| ƒƒ|dkrÔ|jƒ} | jdƒ} | jdƒ} | jdƒ} | dks¶| dks¶| dkrìtd |ƒ\} } } qìnt||ƒ\} } } |j| | | ƒ||fS( NtDBFILEiis0No color database file found, see the -d option.tmastertREDtGREENtBLUEtgrey50(RRtoptiondbtgettRGB_TXTtpopRt get_colordbtKeyErrortIOErrorR t set_colordbRt __version__twindowtadd_viewRRRRt update_views(Rt initialcolortinitfiletignoretdbfileRRtfilestapptwR"tredtgreentblue((s1/usr/lib64/python2.7/site-packages/pynche/Main.pytbuild{sD       $cCs&y|jƒWntk r!nXdS(N(tstarttKeyboardInterrupt(R3R((s1/usr/lib64/python2.7/site-packages/pynche/Main.pytrun¯s c Cs–y5tjtjdddddddgƒ\}}Wn#tjk rZ}td|ƒnXt|ƒdkrvd}n)t|ƒdkr•|d}n tdƒt}d}tj j d ƒ}x”|D]Œ\}}|dkrétdƒqÄ|dkrdt ƒGHtj dƒqÄ|dkr&|}qÄ|dkr;t }qÄ|dkrÄ|}qÄqÄWtd|d|d|d|ƒ\} } t| | ƒ| jƒdS(Nishd:i:Xvs database=s initfile=R0thelptversionis ~/.pynches-hs--helps-vs --versionsxPynche -- The PYthon Natural Color and Hue Editor. Contact: %(AUTHNAME)s Email: %(AUTHEMAIL)s Version: %(__version__)ss-ds --databases-Xs--ignores-is --initfileR.R/R1(s-hs--help(s-vs --version(s-ds --database(s-Xs--ignore(s-is --initfile(tgetoptR targvterrorR tlenRtFalsetostpatht expanduserRR tTrueR8R;t save_views( toptstargsR R.R0R1R/topttargR3tsb((s1/usr/lib64/python2.7/site-packages/pynche/Main.pytmain·sB "               t__main__(RR*R RCR>RRRRRRR?tPROGRAMtAUTHNAMEt AUTHEMAILRDtjoinR$RR RRR8R;RMt__name__(((s1/usr/lib64/python2.7/site-packages/pynche/Main.pyt/s2          3  -