f Qc@s,dZdZddlZddlZddlZddlZddlmZddlmZddlmZddl m Z ddl m Z ej d Z d Z d Zd d ejjejd dgZdZddZdZddddddZdZdZedkr(endS(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.1iN(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 ttS(N(t__doc__tglobals(((s1/usr/lib64/python2.7/site-packages/pynche/Main.pyt docstringSstcCs'tGH|r|GHntj|dS(N(Rtsystexit(tcodetmsg((s1/usr/lib64/python2.7/site-packages/pynche/Main.pytusageWscCs|d}||\}}}|dkrI|d|\}}}n|dkrvdG|GH|d\}}}n|dkrtddn|||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|jjd}nd}t}|dkr_|j}nxe|dkrytj|}Wntt fk rnX|dkrb|sPn|jd}qbqbW|st ddn|j |t t |d|}|j} |jt|| |jt|| |jt|| |dkr|j} | jd} | jd} | jd} | dks| dks| dkrtd |\} } } qnt||\} } } |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|jWntk r!nXdS(N(tstarttKeyboardInterrupt(R3R((s1/usr/lib64/python2.7/site-packages/pynche/Main.pytruns c Csy5tjtjdddddddg\}}Wn#tjk rZ}td|nXt|dkrvd}n)t|dkr|d}n tdt}d}tj j d }x|D]\}}|dkrtdq|dkrdt GHtj dq|dkr&|}q|dkr;t }q|dkr|}qqWtd|d|d|d|\} } t| | | jdS(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.pytmainsB "               t__main__(RR*R RCR>RRRRRRR?tPROGRAMtAUTHNAMEt AUTHEMAILRDtjoinR$RR RRR8R;RMt__name__(((s1/usr/lib64/python2.7/site-packages/pynche/Main.pyt/s2          3  -