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__/PyncheWidget.cpython-34.pyo

�
e fw)�@s�dZddlZddlZddlTddlmZmZddlZdZGdd�d�ZGdd	�d	�Z	ddl
Z
e
jGd
d�d��Zdd
�Z
dS)z�Main Pynche (Pythonically Natural Color and Hue Editor) widget.

This window provides the basic decorations, primarily including the menubar.
It is used to bring up other windows.
�N)�*)�
messagebox�
filedialogi�c@s�eZdZdgdd�Zddd�Zddd�Zddd	�Zdd
d�Zdd
�Zdd�Z	dd�Z
ddd�Zddd�Zddd�Z
dd�Zdd�ZdS)�PyncheWidgetNcCs�||_||_d|_d|_d|_d|_i|_|}|_|r�t|dd�|_	}|j
�|j�ned}y!ddlm
}|}|_	Wntk
r�YnX|s�tdd�}|_	n|j�t|�}|_t|dd�}	|_|	jddd	|jd
d�|sb|	jddd	|jdd
d
d�nt|j|j	|�}
t|dd�}x9|
D]1}|jd|j�d	|jd
|j��q�Wt|dddd�}
|
jddd	|jd
d�|
jddd	|jd
d�|jddd|	d
d�|jddd|d
d�|jddd|
d
d�t|ddd|�}|_|jd|r�|jp�|j�|j d|�|j!d�|s|j"d|j�|j"d|j�n�t#|dddt$�}|j%ddddd d!d"d#d$d%�t&|d&d'd	|j'�}|j(d(t)d)d�t&|d&d*d	|j*�}|j(d(t)d)d�dS)+N�class_�Pyncher)�
_default_rootZ	classNameZtearoffZlabelzLoad palette...�command�	underlineZQuitZacceleratorzAlt-Q�name�helpzAbout Pynche...zHelp...ZFileZmenuZViewZHelp�WM_DELETE_WINDOWz	Pynche %sz<Alt-q>z<Alt-Q>Zborderwidth��relief�row��columnZ
columnspan�ZstickyZEWZipady��textZOkay�side�expandZCancel)+�_PyncheWidget__sbZ_PyncheWidget__versionZ_PyncheWidget__textwinZ_PyncheWidget__listwinZ_PyncheWidget__detailswin�_PyncheWidget__helpwinZ_PyncheWidget__dialogstate�_PyncheWidget__modal�Toplevel�_PyncheWidget__tkrootZgrab_set�withdrawZTkinterr�ImportErrorZTkZMenuZ_PyncheWidget__menubarZ_PyncheWidget__filemenuZadd_command�_PyncheWidget__load�_PyncheWidget__quit�make_view_popups�menutext�popupr
�_PyncheWidget__popup_about�_PyncheWidget__popup_usageZadd_cascade�_PyncheWidget__root�protocol�_PyncheWidget__bell�title�iconname�bindZFrameZRAISEDZgridZButton�_PyncheWidget__okay�packZLEFT�_PyncheWidget__cancel)�self�version�switchboard�master�	extrapathZmodalZtkrootrZmenubarZfilemenuZviewsZviewmenu�vZhelpmenu�rootZbframeZokayZcancel�r6�>/opt/alt/python34/lib64/python3.4/Tools/pynche/PyncheWidget.py�__init__s�							



		

				
		zPyncheWidget.__init__cCs|jj�dS)N)r�quit)r/�eventr6r6r7Z__quitzszPyncheWidget.__quitcCs|jj�dS)N)rZbell)r/r:r6r6r7Z__bell}szPyncheWidget.__bellcCs(|jj�|jj�|j�dS)N)rZwithdraw_viewsrZgrab_releaser )r/r:r6r6r7Z__okay�s

zPyncheWidget.__okaycCs|jj�|j�dS)N)rZcanceledr,)r/r:r6r6r7Z__cancel�s
zPyncheWidget.__cancelcCs|jjjt|j�dS)N)rZtkZcreatetimerhandler�KEEPALIVE_TIMER�_PyncheWidget__keepalive)r/r6r6r7Z__keepalive�szPyncheWidget.__keepalivecCs'|js|j�n|jj�dS)N)rr<rZmainloop)r/r6r6r7�start�s	
zPyncheWidget.startcCs|jS)N)r&)r/r6r6r7�window�szPyncheWidget.windowcCs,ddlm}tjd|d|�dS)Nr)�__version__z
About Pynche z}Pynche %s
The PYthonically Natural
Color and Hue Editor

For information
contact: Barry A. Warsaw
email:   bwarsaw@python.org)�Mainr?rZshowinfo)r/r:r?r6r6r7Z
__popup_about�s
zPyncheWidget.__popup_aboutcCs5|js$t|j|j�|_n|jj�dS)N)r�Helpwinr&r �	deiconify)r/r:r6r6r7Z
__popup_usage�s	zPyncheWidget.__popup_usagecCs�x�tjj|jj�j��\}}tjddd
gd|d|�}|sXdSytj	|�}Wn)t
k
r�tjdd	|�wYnX|dkr�tjd
d|�qnPqW|jj
|�dS)NZ	filetypes�
Text files�*.txt�	All filesrZ
initialdirZinitialfilez
Read errorz#Could not open file for reading:
%szUnrecognized color file typez(Unrecognized color file type in file:
%s)rCrD)rEr)�os�path�splitr�colordb�filenamerZaskopenfilename�ColorDBZget_colordb�IOErrorrZ	showerrorZset_colordb)r/r:ZidirZifile�filerIr6r6r7Z__load�s*'			
		zPyncheWidget.__loadcCs|jj�dS)N)r&r)r/r6r6r7r�szPyncheWidget.withdrawcCs|jj�dS)N)r&rB)r/r6r6r7rB�szPyncheWidget.deiconify)�__name__�
__module__�__qualname__r8r r(r,r.r<r=r>r$r%rrrBr6r6r6r7rsgrc@s7eZdZdd�Zddd�Zdd�ZdS)rAcCsddlm}t|dd�|_}|jd|j�|jd�|jd�|jd|�|jd|�|jd	|j�|jd
|j�t	j
jtj
dd�}yqd}zPt
|�}|j�}|jd�}|dkr|d|�j�}nWd|r'|j�nXWn+tk
rVtjjd
�|�}YnXt|dtdddd�|_}	|jj�|	jd|�t|�}
|
jdtdt�|	jdtdt�|	j d|
df�|
j d|	df�dS)Nr)�	docstringrrr
zPynche Help Windowz<Alt-q>z<Alt-Q>z<Alt-w>z<Alt-W>ZREADME�z8Couldn't open Pynche's README, using docstring instead.
r�width�PZheight�gZfillrrZyscrollcommand�setr	Zyview)!r@rQr�_Helpwin__rootr'�_Helpwin__withdrawr)r*r+rFrG�join�sys�open�read�rfind�rstrip�closerL�stderr�writeZTextZSUNKENZ_Helpwin__textZ	focus_set�insertZ	Scrollbarr-�YZRIGHTZBOTHZYESZ	configure)r/r2ZquitfuncrQr5Z
readmefile�fp�contents�irZ	scrollbarr6r6r7r8�s@



zHelpwin.__init__NcCs|jj�dS)N)rWr)r/r:r6r6r7Z
__withdraw�szHelpwin.__withdrawcCs|jj�dS)N)rWrB)r/r6r6r7rB�szHelpwin.deiconify)rNrOrPr8rXrBr6r6r6r7rA�s(rAc@s[eZdZdd�Zdd�Zdd�Zddd	�Zd
d�Zdd
�ZdS)�PopupViewercCs�||_||_||_||_|j|_|jjd�}|dkrWd}n|jjddd�|_||_d|_	dS)N�%rr����)
�_PopupViewer__m�_PopupViewer__name�_PopupViewer__sb�_PopupViewer__root�	ADDTOVIEW�_PopupViewer__menutext�find�replace�_PopupViewer__underline�_PopupViewer__window)r/�modulerr1r5r
r6r6r7r8�s						zPopupViewer.__init__cCs|jS)N)rp)r/r6r6r7r"
szPopupViewer.menutextcCs|jS)N)rs)r/r6r6r7r
szPopupViewer.underlineNcCs]|jsLt|j|j�}||j|j�|_|jj|j�n|jj�dS)N)rt�getattrrkrlrmrnZadd_viewrB)r/r:rr6r6r7r#s
	zPopupViewer.popupcCs|j|jkS)N)rp)r/�otherr6r6r7�__eq__szPopupViewer.__eq__cCs|j|jkS)N)rp)r/rwr6r6r7�__lt__szPopupViewer.__lt__)	rNrOrPr8r"r
r#rxryr6r6r6r7rg�srgcCsg}tjjt�g|}x�|D]�}|dkrAd}nx�tj|�D]�}|dd�dkrQ|dd	�}yt|�}Wn1tk
r�td|�}	t|	|�}YnXt|d�r|j	rt
||||�}
|j|
�qqQqQWq&W|j�|S)
Nri�.�	z	Viewer.py�zpynche.roi�������)
rFrG�dirname�__file__�listdir�
__import__rrv�hasattrrorg�append�sort)r1r5r3Zviewers�dirs�dirrMrruZpkgr4r6r6r7r!"s$
	

r!)�__doc__rZrFZtkinterrrrKr;rrA�	functools�total_orderingrgr!r6r6r6r7�<module>s
�1&