Your IP : 216.73.216.213


Current Path : /opt/alt/python34/lib64/python3.4/Tools/pynche/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib64/python3.4/Tools/pynche/__pycache__/Main.cpython-34.pyo

�
e f�@s>dZdZddlZddlZddlZddlZddlmZddlmZddlmZddl	m	Z	ddl
m
Z
ejdZd	Z
d
Zddejjejdd
�gZdd�Zddd�Zdd�Zddddddd�Zdd�Zdd�Zedkr:e�ndS)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.txtcCstt�S)N)�__doc__�globals�r	r	�6/opt/alt/python34/lib64/python3.4/Tools/pynche/Main.py�	docstringSsr�cCs1tt��|r t|�ntj|�dS)N)�printr�sys�exit)�code�msgr	r	r
�usageWs

rcCs�|dd�}||�\}}}|dkrL|d|�\}}}n|dkr}td|�|d�\}}}n|dkr�tdd�n|||fS)NcSsyy|j|�\}}}WnMtjk
rkytj|�\}}}Wntjk
rfdSYnXYnX|||fS)N)NNN)Zfind_byname�ColorDBZBadColorZrrggbb_to_triplet)�s�colordb�r�g�br	r	r
�
scan_colorasz!initial_color.<locals>.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Cst|o
|�}|dkr7|j�jd�}nd}tdd�}|dkrh|j�}nxf|dkr�ytj|�}Wnttfk
r�YnX|dkrk|s�Pn|jd�}qkqkW|s�t	dd�n|j
|�tt|d|�}|j
�}	|jt||	��|jt||	��|jt||	��|dkr�|j�}
|
jd�}|
jd�}|
jd�}
|dks�|
dks�|dkr�td	|�\}}}
q�nt||�\}}}
|j|||
�||fS)
NZDBFILErrz0No color database file found, see the -d option.�masterZREDZGREENZBLUEZgrey50)r�optiondb�get�RGB_TXT�poprZget_colordb�KeyError�IOErrorrZset_colordbr�__version__ZwindowZadd_viewrrrrZupdate_views)r�initialcolor�initfile�ignore�dbfilerr�files�app�wrZredZgreenZbluer	r	r
�build{sD
$r,cCs'y|j�Wntk
r"YnXdS)N)�start�KeyboardInterrupt)r*rr	r	r
�run�s
r/cCs�y;tjtjdd�ddddddg�\}}Wn5tjk
rr}ztd|�WYdd}~XnXt|�dkr�d}n)t|�dkr�|d}n
td�d	}d}tjjd
�}x�|D]�\}}|dkrtd�q�|dkr.t	dt
��tjd�q�|dkrC|}q�|dkrXd}q�|dkr�|}q�q�Wtd|d|d|d|�\}	}
t
|	|
�|
j�dS)Nrzhd:i:Xvz	database=z	initfile=r'�help�versionrFz	~/.pynche�-h�--help�-v�	--versionzxPynche -- The PYthon Natural Color and Hue Editor.
Contact: %(AUTHNAME)s
Email:   %(AUTHEMAIL)s
Version: %(__version__)s�-d�
--database�-X�--ignoreT�-i�
--initfiler%r&r()r2r3)r4r5)r6r7)r8r9)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" 	


		

rE�__main__)rr$rr@r<rrrrrrr=ZPROGRAMZAUTHNAMEZ	AUTHEMAILrA�joinr rrrr,r/rE�__name__r	r	r	r
�<module>/s2
3-