B 0îïæ)Ú¼…ã@sÖdZdZddlZddlZddlZddlZddlmZddlmZddlmZddl m Z ddl m Z ej dZ d Z d Zd d ej ejdd ¡gZdd„Zddd„Zdd„Zddd„Zdd„Zdd„ZedkrÒeƒdS)aPynche -- 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 z1.4.1éN)Ú PyncheWidget)Ú Switchboard)Ú StripViewer)Ú ChipViewer)Ú TypeinViewerz Barry Warsawzbarry@python.orgz/usr/openwin/lib/rgb.txtz/usr/lib/X11/rgb.txtz X/rgb.txtcCs ttƒS)N)Ú__doc__Úglobals©r r ú6/opt/alt/python37/lib64/python3.7/Tools/pynche/Main.pyÚ docstringSsr ÚcCs$ttƒƒ|rt|ƒt |¡dS)N)Úprintr ÚsysÚexit)ÚcodeÚmsgr r r ÚusageWs rcCsp|fdd„}||ƒ\}}}|dkr4|d|ƒ\}}}|dkrTtd|ƒ|dƒ\}}}|dkrftddƒ|||fS)Nc Ssby| |¡\}}}WnBtjk rVyt |¡\}}}Wntjk rPdSXYnX|||fS)N)NNN)Z find_bynameÚColorDBZBadColorZrrggbb_to_triplet)ÚsÚcolordbÚrÚgÚbr r r Ú scan_coloras z!initial_color..scan_colorú#z Bad initial color, using gray50:Zgray50éz#Cannot find an initial color to use)r r)rrrrrrr r r Ú initial_color_s   rc Csvt| o |ƒ}|dkr$| ¡ d¡}d}tdd…}|dkrD| ¡}xL|dkryt |¡}Wnttfk rtYnX|dkrF|s„P| d¡}qFW|s t ddƒ|  |¡t t ||d}|  ¡} | t|| ƒ¡| t|| ƒ¡| t|| ƒ¡|dkrP| ¡} |  d¡} |  d¡} |  d¡} | dks>| dks>| dkr`td |ƒ\} } } nt||ƒ\} } } | | | | ¡||fS) NZDBFILErrz0No color database file found, see the -d option.)ÚmasterZREDZGREENZBLUEZgrey50)rÚoptiondbÚgetÚRGB_TXTÚpoprZ get_colordbÚKeyErrorÚIOErrorrZ set_colordbrÚ __version__ZwindowZadd_viewrrrrZ update_views)rÚ initialcolorÚinitfileÚignoreÚdbfilerrÚfilesÚappÚwrZredZgreenZbluer r r Úbuild{sD        r,cCs&y | ¡Wntk r YnXdS)N)ÚstartÚKeyboardInterrupt)r*rr r r Úrun¯s r/c Cs6y*t tjdd…ddddddg¡\}}Wn.tjk rX}ztd|ƒWdd}~XYnXt|ƒdkrld}nt|ƒdkr‚|d}ntdƒd }d}tj d ¡}xl|D]d\}}|d kr¾tdƒq¤|d kràt d t ƒƒt  d¡q¤|dkrî|}q¤|dkrüd}q¤|dkr¤|}q¤Wt ||||d\} } t | | ƒ|  ¡dS)Nrzhd:i:Xvz database=z initfile=r'ÚhelpÚversionrFz ~/.pynche)z-hz--help)z-vz --versionzxPynche -- The PYthon Natural Color and Hue Editor. Contact: %(AUTHNAME)s Email: %(AUTHEMAIL)s Version: %(__version__)s)z-dz --database)z-Xz--ignoreT)z-iz --initfile)r%r&r'r()ÚgetoptrÚargvÚerrorrÚlenÚosÚpathÚ expanduserr rrr,r/Z save_views) ZoptsÚargsrr%r'r(r&ZoptÚargr*Zsbr r r Úmain·sD          r;Ú__main__)r )NNNNN)rr$rr6r2rrrrrrr3ZPROGRAMZAUTHNAMEZ AUTHEMAILr7Újoinr r rrr,r/r;Ú__name__r r r r Ú/s2        3-