Your IP : 3.149.24.49


Current Path : /opt/alt/python34/lib64/python3.4/idlelib/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib64/python3.4/idlelib/__pycache__/configHelpSourceEdit.cpython-34.pyo

�
e f�@s�dZddlZddlZddlTddljZddljZ	Gdd�de
�Zedkr�ddl
mZee�ndS)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�
CreateWidgets�menu�set�pathZwithdrawZupdate_idletasksZgeometryZwinfo_rootxZwinfo_widthZwinfo_reqwidthZwinfo_rootyZwinfo_heightZwinfo_reqheightZ	deiconifyZbind�OkZwait_window)�selfrrZmenuItemZfilePathZ_htest�r�A/opt/alt/python34/lib64/python3.4/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�columnr
�)Z	StringVarrrZfontSizeZFrameZGROOVEZ	frameMainZpackZTOPZTRUEZBOTHZLabel�WZLEFTZEntry�	entryMenu�	focus_set�	entryPathZButton�
browseFileZBOTTOM�XZACTIVErZbuttonOkZgridr
ZbuttonCancel)rZ	labelMenuZ	labelPathZbrowseButtonZframeButtonsrrrr/s<	
	
%z!GetHelpSourceDialog.CreateWidgetscCsdddddg}|jj�}|rEtjj|�\}}nsd}tjdd�d
kr�tjjtjjtj�d�}tjj	|�s�tj
�}q�ntj
�}tjd|d|�}|j
d|d|�}|r|jj|�ndS)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.browseFilecCs�d}|jj�}|j�|sWtjddddd|�|jj�d}nDt|�dkr�tjdddd	d|�|jj�d}n|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)rZmenuOkrrrr�MenuOkfs 

	
	zGetHelpSourceDialog.MenuOkcCs�d}|jj�}|j�|sWtjddddd|�|jj�d}n|jd�rinm|d
d�dkr�|dd
�}ntjj	|�s�tjdddd
d|�|jj�d}n|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)rZpathOkrrrr�PathOkzs(

	
	zGetHelpSourceDialog.PathOkNcCs�|j�r�|j�r�|jj�j�|jj�j�f|_tjdkr�|jd}|j	d�rsq�t
|j�|_d||jd<n|j�ndS)N�darwinr!�www�file:�http:zfile://)rNrOrP)rGrLrr4rCrrr7r8rJ�list�destroy)r�eventrrrrr�s
zGetHelpSourceDialog.OkcCsd|_|j�dS)N)rrR)rrSrrrr
�s	zGetHelpSourceDialog.Cancel)
�__name__�
__module__�__qualname__rrr&rGrLrr
rrrrr
s$ r�__main__)�run)�__doc__r5r7ZtkinterZtkinter.messageboxZ
messageboxrDZtkinter.filedialogZ
filedialogr>r
rrTZidlelib.idle_test.htestrXrrrr�<module>s
�

?>