Your IP : 216.73.216.213
B
� fw) � @ s| d Z ddlZddlZddlT ddlmZmZ ddlZdZG dd� d�ZG dd � d �Z ddl
Z
e
jG d
d� d��Zdd
� 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� e Zd Zdg fdd�Zddd�Zddd�Zddd �Zdd
d�Zdd
� Zdd� Z dd� Z
d dd�Zd!dd�Zd"dd�Z
dd� Zdd� ZdS )#�PyncheWidgetNc C sp || _ || _d | _d | _d | _d | _i | _| }| _|r`t|dd� | _ }|�
� |�� nPd }yddlm
} | }| _ W n tk
r� Y nX |s�tdd� }| _ |�� t|� }| _t|dd� } | _| jd| jdd� |s�| jd | jd
dd� t| j | j |�}
t|dd�}x(|
D ] }|j|�� |j|�� d� �qW t|ddd
�}
|
jd| jdd� |
jd| jdd� |jd| dd� |jd|dd� |jd|
dd� t|d|d� }| _|�d|�r�| j�p�| j� |� d| � |�!d� |�s|�"d| j� |�"d| j� n^t#|dt$d�}|j%dddddd� t&|d | j'd!�}|j(t)dd"� t&|d#| j*d!�}|j(t)dd"� d S )$N�Pynche)�class_r )�
_default_root)Z className)�tearoffzLoad palette...)�label�command� underlineZQuitzAlt-Q)r
r Zacceleratorr �help)�namer zAbout Pynche...zHelp...ZFile)r
�menur ZViewZHelp)r r �WM_DELETE_WINDOWz Pynche %sz<Alt-q>z<Alt-Q>� )Zborderwidth�relief� � ZEW� )�row�columnZ
columnspanZstickyZipadyZOkay)�textr )�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� extrapathZmodalZtkrootr ZmenubarZfilemenuZviewsZviewmenu�vZhelpmenu�rootZbframeZokayZcancel� r9 �>/opt/alt/python37/lib64/python3.7/Tools/pynche/PyncheWidget.py�__init__ s�
zPyncheWidget.__init__c C s | j �� d S )N)r �quit)r2 �eventr9 r9 r: Z__quitz s zPyncheWidget.__quitc C s | j �� d S )N)r Zbell)r2 r= r9 r9 r: Z__bell} s zPyncheWidget.__bellc C s | j �� | j�� | �� d S )N)r Zwithdraw_viewsr Zgrab_releaser# )r2 r= r9 r9 r: Z__okay� s
zPyncheWidget.__okayc C s | j �� | �� d S )N)r Zcanceledr/ )r2 r= r9 r9 r: Z__cancel� s
zPyncheWidget.__cancelc C s | j j�t| j� d S )N)r ZtkZcreatetimerhandler�KEEPALIVE_TIMER�_PyncheWidget__keepalive)r2 r9 r9 r: Z__keepalive� s zPyncheWidget.__keepalivec C s | j s| �� | j�� d S )N)r r? r Zmainloop)r2 r9 r9 r: �start� s zPyncheWidget.startc C s | j S )N)r) )r2 r9 r9 r: �window� s zPyncheWidget.windowc C s$ ddl m} t�d| d| � d S )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)�MainrB r Zshowinfo)r2 r= rB r9 r9 r: Z
__popup_about� s
zPyncheWidget.__popup_aboutc C s$ | j st| j| j�| _ | j �� d S )N)r �Helpwinr) r# � deiconify)r2 r= r9 r9 r: Z
__popup_usage� s zPyncheWidget.__popup_usagec C s� x�t j�| j�� �� �\}}tjddg||d�}|s8d S yt� |�}W n& t
k
rl t�dd| � wY nX |d kr�t�dd| � qP qW | j�
|� d S )N)z
Text filesz*.txt)z All filesr )Z filetypesZ
initialdirZinitialfilez
Read errorz#Could not open file for reading:
%szUnrecognized color file typez(Unrecognized color file type in file:
%s)�os�path�splitr �colordb�filenamer Zaskopenfilename�ColorDBZget_colordb�IOErrorr Z showerrorZset_colordb)r2 r= ZidirZifile�filerI r9 r9 r: Z__load� s*
zPyncheWidget.__loadc C s | j �� d S )N)r) r )r2 r9 r9 r: r � s zPyncheWidget.withdrawc C s | j �� d S )N)r) rE )r2 r9 r9 r: rE � s zPyncheWidget.deiconify)N)N)N)N)N)N)N)�__name__�
__module__�__qualname__r; r# r+ r/ r1 r? r@ rA r'