Your IP : 52.15.92.58


Current Path : /opt/alt/python35/lib64/python3.5/idlelib/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/idlelib/__pycache__/configHelpSourceEdit.cpython-35.pyc



��Yf��@s�dZddlZddlZddlTddljZddljZ	Gdd�de
�Zedkr�ddl
Z
e
jddd	d
d�ddlmZee�dS)
zKDialog to specify or edit the parameters for a user configured help source.�N)�*c@sseZdZddddd�Zdd�Zdd�Zd	d
�Zdd�Zd
dd�Zd
dd�Z	d
S)�GetHelpSourceDialog�FcCsOtj||�|jdd�|jdtdt�|j|�|j|�|j�|jd|j	�||_
d|_|j�|j
j|�|jj|�|j�|j�|jd|j�|j�d|j�d|j�|s|j�d|j�dnd	f�|j�|jd
|j�|j�dS)a2Get menu entry and url/ local file location for Additional Help

        User selects a name for the Help resource and provides a web url
        or a local file as its source.  The user can enter a url or browse
        for the file.

        _htest - bool, change box location when running htest
        �borderwidth�Zheight�widthZWM_DELETE_WINDOWNz+%d+%d��z<Return>)�Toplevel�__init__Z	configureZ	resizableZFALSE�titleZ	transientZgrab_setZprotocol�cancel�parent�result�create_widgets�menu�set�pathZwithdrawZupdate_idletasksZgeometryZwinfo_rootxZwinfo_widthZwinfo_reqwidthZwinfo_rootyZwinfo_heightZwinfo_reqheightZ	deiconifyZbind�okZwait_window)�selfrrZmenuItemZfilePathZ_htest�r�A/opt/alt/python35/lib64/python3.5/idlelib/configHelpSourceEdit.pyrs.	


		


		0
zGetHelpSourceDialog.__init__c
Csmt|�|_t|�|_t|�|_t|dddt�|_|jjdtdt	dt
�t|jdtdt
d	d
�}t|jd|jdd
�|_|jj�t|jdtdt
d	d�}t|jd|jdd�|_|jj�|jdtdddd�|jjdtdddd�|jdtdddd�|jjdtdddd�t|jd	dddd|j�}|jdd�t|�}|jdtdt�t|d	ddddtd|j�|_|jjdddddddd�t|d	dddd|j�|_|jjdddddddd�dS)NrrZreliefZside�expandZfillZanchorZjustify�textz
Menu Item:Ztextvariabler�z,Help File Path: Enter URL or browse for file�(ZpadxrZpady�ZBrowse�ZcommandZOK�default�rowr�columnZCancel�)Z	StringVarrrZfontSizeZFrameZGROOVEZ	frameMainZpackZTOPZTRUEZBOTHZLabel�WZLEFTZEntry�	entryMenu�	focus_set�	entryPathZButton�browse_fileZBOTTOM�XZACTIVErZbuttonOkZgridr
ZbuttonCancel)rZ	labelMenuZ	labelPathZbrowseButtonZframeButtonsrrrr/s<	
	
%z"GetHelpSourceDialog.create_widgetscCs�dddddg}|jj�}|rEtjj|�\}}npd}tjdd�d
kr�tjjtjjtj�d�}tjj	|�s�tj
�}ntj
�}tjd|d|�}|j
d|d|�}|r�|jj|�dS)N�
HTML Files�*.htm *.html�TEXT�	PDF Files�*.pdf�Windows Help Files�*.chm�
Text Files�*.txt�	All Filesrr�winZDocr�	filetypesZ
initialdirZinitialfile)r(r)r*)r+r,r*)r-r.)r/r0r*)r1r)r�get�os�split�sys�platform�join�dirname�
executable�isdir�getcwd�tkFileDialogZOpenZshowr)rr3r�dir�baseZ
opendialog�filerrrr&Os$	$zGetHelpSourceDialog.browse_filecCs�d}|jj�}|j�|sWtjddddd|�|jj�d}nAt|�dkr�tjdddd	d|�|jj�d}|S)
z3Simple validity check for a sensible menu item nameTrzMenu Item Error�messagezNo menu item specifiedrFrz(Menu item too long:
Limit 30 characters.)rr4�strip�tkMessageBox�	showerrorr#r$�len)r�menu_okrrrrrGfs 

	
zGetHelpSourceDialog.menu_okcCs�d}|jj�}|j�|sWtjddddd|�|jj�d}ny|jd�ring|d
d�dkr�|dd
�}tjj	|�s�tjdddd
d|�|jj�d}|S)z(Simple validity check for menu file pathTrzFile Path ErrorrBzNo help file path specified.rF�www.�httpNrzfile:zHelp file path does not exist.)rHrI)
rr4rCrDrEr%r$�
startswithr5�exists)r�path_okrrrrrLzs(

	
zGetHelpSourceDialog.path_okNcCs�|j�r�|j�r�|jj�j�|jj�j�f|_tjdkr�|jd}|j	d�rsn#t
|j�|_d||jd<|j�dS)	N�darwinr!�www�file:�http:�https:zfile://)rNrOrPrQ)rGrLrr4rCrrr7r8rJ�list�destroy)r�eventrrrrr�s
zGetHelpSourceDialog.okcCsd|_|j�dS)N)rrS)rrTrrrr
�s	zGetHelpSourceDialog.cancel)
�__name__�
__module__�__qualname__rrr&rGrLrr
rrrrr
s$ r�__main__z"idlelib.idle_test.test_config_help�	verbosityr�exitF)�run)�__doc__r5r7ZtkinterZtkinter.messageboxZ
messageboxrDZtkinter.filedialogZ
filedialogr>r
rrUZunittest�mainZidlelib.idle_test.htestr[rrrr�<module>s
�


?>