ok

Mini Shell

Direktori : /opt/alt/python36/lib64/python3.6/idlelib/__pycache__/
Upload File :
Current File : //opt/alt/python36/lib64/python3.6/idlelib/__pycache__/query.cpython-36.opt-2.pyc

3

��2a�0�@s�ddlZddlZddlmZmZddlmZmZmZm	Z	m
Z
ddlmZm
Z
mZmZddlmZddlmZGdd�de�ZGd	d
�d
e�ZGdd�de�ZGd
d�de�Zedkr�ddlmZedddd�ddlmZeee�dS)�N)�
executable�platform)�Toplevel�	StringVar�W�E�S)�Frame�Button�Entry�Label)�
filedialog)�Fontcs^eZdZdiddd�dd�Zdd�Zdd	d
�Zdd�Zdd
d�Zddd�Z�fdd�Z	�Z
S)�Query�F)�text0�
used_names�_htest�_utestc	
CsXtj||�|j�||_|j|�||_||_||_|j|�|j	�|j
jdd�}|dkr�y|j
jdd|jdd�WnYnX|j
d|j�|j
d	|j�|jd
|j�|j
d|j�|j
d|j�|jd
d
d�|j�|j�|jd|j�|j�d|j�d|j�|�s2|j�d|j�dndf�|�sT|j�|j�dS)N�tk�windowingsystemZaquaz!::tk::unsupported::MacWindowStyleZstyleZ
moveableModalrz<Command-.>z<Key-Escape>ZWM_DELETE_WINDOWz<Key-Return>z
<KP_Enter>F)Zheight�widthz+%d+%d��)r�__init__Zwithdraw�parent�title�messagerrZ	transientZgrab_setrZcallZ_wZbind�cancelZprotocol�okZ	resizable�create_widgetsZupdate_idletasksZgeometryZwinfo_rootxZwinfo_widthZwinfo_reqwidthZwinfo_rootyZwinfo_heightZwinfo_reqheightZ	deiconifyZwait_window)	�selfrrrrrrrr�r"�*/opt/alt/python36/lib64/python3.6/query.pyr%sB


*zQuery.__init__cCs.t|dd�|_}|jdddd�|jddd�t|dd	|jd
�}t||j�|_t	|d|jd�|_
|j
j�td
d|j
d�|_t|dd|jd�|_t|dd|jd�|_t|d|jd�|_|jddddtd�|j
jddddttddgd�|jjddddttd�|jjdddd�|jjdddd�dS)N�
)ZpaddingrZnews)�column�row�sticky�)Zweight�w�left)�anchor�justify�text�)r�textvariableZ
TkCaptionFontT)�name�exists�root� �red)r-�
foreground�fontZOKZactive)r-�default�commandZCancel)r-r8��)r%r&�
columnspan�padxr')r%r&r;r<r'�padyr�c)r%r&r<)r	�frame�gridZgrid_columnconfigurerrrrZentryvarr�entry�	focus_setrr�
error_font�entry_errorr
rZ	button_okrZ
button_cancelrr)r!r?Z
entrylabelr"r"r#r Ws.

zQuery.create_widgetsNcCsd||p|jd<dS)NzERROR: r-)rD)r!rZwidgetr"r"r#�	showerrorsszQuery.showerrorcCs.d|jd<|jj�j�}|s*|jd�dS|S)Nrr-zblank line.)rDrA�get�striprE)r!rAr"r"r#�entry_okws

zQuery.entry_okcCs.|j�}|dk	r ||_|j�n
|jj�dS)N)rH�result�destroyrArB)r!�eventrAr"r"r#r�s

zQuery.okcCsd|_|j�dS)N)rIrJ)r!rKr"r"r#r�szQuery.cancelcs|j�t�j�dS)N)Zgrab_release�superrJ)r!)�	__class__r"r#rJ�sz
Query.destroy)N)N)N)�__name__�
__module__�__qualname__rr rErHrrrJ�
__classcell__r"r")rMr#r s1
	

rcs,eZdZddd��fdd�
Zdd�Z�ZS)�SectionNameF)rrcst�j||||||d�dS)N)rrr)rLr)r!rrrrrr)rMr"r#r�szSectionName.__init__cCs`d|jd<|jj�j�}|s*|jd�dSt|�dkrD|jd�dS||jkr\|jd�dS|S)Nrr-zno name specified.r.z"name is longer than 30 characters.zname is already in use.)rDrArFrGrE�lenr)r!r0r"r"r#rH�s




zSectionName.entry_ok)rNrOrPrrHrQr"r")rMr#rR�srRcs,eZdZddd��fdd�
Zdd�Z�ZS)�
ModuleNameF)rrcst�j||||||d�dS)N)rrr)rLr)r!rrrrrr)rMr"r#r�szModuleName.__init__cCs�d|jd<|jj�j�}|s*|jd�dSytjj|�}Wn2tt	fk
rl}z|jt
|��dSd}~XnX|dkr�|jd�dSt|jtj
j�s�|jd�dSy|jj|�}Wn"tk
r�|jd|d�dSX|S)Nrr-zno name specified.zmodule not foundznot a source-based modulez$loader does not support get_filename)r)rDrArFrGrE�	importlib�util�	find_spec�
ValueError�ImportError�str�
isinstance�loader�abc�SourceLoader�get_filename�AttributeError)r!r0�spec�msgZ	file_pathr"r"r#rH�s.



zModuleName.entry_ok)rNrOrPrrHrQr"r")rMr#rT�srTcs\eZdZddiddd��fdd�
Z�fdd�Zdd	�Zd
d�ZejZ	dd
�Z
dd�Z�ZS)�
HelpSourcerF)�menuitem�filepathrrrc		s(||_d}t�j|||||||d�dS)NzName for item on Help menu:)rrrr)rerLr)	r!rrrdrerrrr)rMr"r#r�s
zHelpSource.__init__cs�t�j�|j}t|dddd�}t||j�|_t||jdd�|_t	|dd|j
d	�}t|d
d|jd�|_|j
d
ddddd
gtd�|jj
d
dddttdd
gd�|j
dddttd�|jj
d
dddttd�dS)Nr)r*z,Help File Path: Enter URL or browse for file)r+r,r-�()r/rZBrowse�)r-rr8r3r4)r-r5r6rr$r9r:)r%r&r;r<r=r'�r)r%r&r;r<r'r=)r%r&r<r'�)r%r&r;r<r')rLr r?rrre�pathvarr�pathr
�browse_filerC�
path_errorr@rrr)r!r?Z	pathlabelZbrowse)rMr"r#r �s"

zHelpSource.create_widgetscCstj||d�j||d�S)N)r�	filetypes)Z
initialdirZinitialfile)r
ZOpenZshow)r!rnZinitdirZinitfiler"r"r#�askfilename�szHelpSource.askfilenamecCs�dddddg}|jj�}|r.tjj|�\}}nHd}tdd�d
krntjjtjjt�d�}tjj	|�svtj
�}ntj
�}|j|||�}|r�|jj|�dS)N�
HTML Files�*.htm *.html�TEXT�	PDF Files�*.pdf�Windows Help Files�*.chm�
Text Files�*.txt�	All Files�*r9�winZDoc)rprqrr)rsrtrr)rurv)rwrxrr)ryrz)
rjrF�osrk�splitr�join�dirnamer�isdir�getcwdro�set)r!rnrk�dir�base�filer"r"r#rls"

zHelpSource.browse_filecCs||jj�j�}|s$|jd|j�dS|jd	�sx|dd�dkrJ|dd�}tjj|�sh|jd|j�dStdkrxd|}|S)
Nzno help file path specified.�www.�httpr:zfile:zhelp file path does not exist.�darwinzfile://)r�r�)	rkrFrGrErm�
startswithr|r1r)r!rkr"r"r#�path_oks
zHelpSource.path_okcCs@d|jd<d|jd<|j�}|j�}|dks4|dkr8dS||fS)Nrr-)rDrm�item_okr�)r!r0rkr"r"r#rH*s


zHelpSource.entry_ok)rNrOrPrr rorlrRrHr�r�rQr"r")rMr#rc�src�__main__)�mainzidlelib.idle_test.test_queryrF)�	verbosity�exit)�run)rUr|�sysrrZtkinterrrrrrZtkinter.ttkr	r
rrr
Ztkinter.fontrrrRrTrcrNZunittestr�Zidlelib.idle_test.htestr�r"r"r"r#�<module>sw%^

Zerion Mini Shell 1.0