Plan 9 from Bell Labs’s /usr/web/sources/contrib/jas/root/sys/lib/python2.7/idlelib/configHelpSourceEdit.pyo

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


��Qc@s�dZddlZddlZddlTddlZddlZdefd��YZedkr�e	�Z
d�Zee
dd	d
e�j
�e
j�ndS(sKDialog to specify or edit the parameters for a user configured help source.i�N(t*tGetHelpSourceDialogcBsSeZddd�Zd�Zd�Zd�Zd�Zdd�Zdd�Z	RS(	tcCsCtj||�|jdd�|jdtdt�|j|�|j|�|j�|jd|j	�||_
d	|_|j
�|jj|�|jj|�|j�|j�|jd|j�|j�d|j�d|j�|j�d|j�df�|j�|jd|j�|j�d	S(
s�Get 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.

        tborderwidthitheighttwidthtWM_DELETE_WINDOWs+%d+%dis<Return>N(tToplevelt__init__t	configuret	resizabletFALSEttitlet	transienttgrab_settprotocoltCanceltparenttNonetresultt
CreateWidgetstmenutsettpathtwithdrawtupdate_idletaskstgeometrytwinfo_rootxtwinfo_widthtwinfo_reqwidthtwinfo_rootytwinfo_heighttwinfo_reqheightt	deiconifytbindtOktwait_window(tselfRRtmenuItemtfilePath((s2/sys/lib/python2.7/idlelib/configHelpSourceEdit.pyRs,


		


	
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(NRitrelieftsidetexpandtfilltanchortjustifyttexts
Menu Item:ttextvariableRis,Help File Path: Enter URL or browse for filei(tpadxitpadyitBrowseitcommandtOKtdefaulttrowitcolumnRi(t	StringVarRRtfontSizetFrametGROOVEt	frameMaintpacktTOPtTRUEtBOTHtLabeltWtLEFTtEntryt	entryMenut	focus_sett	entryPathtButtont
browseFiletBOTTOMtXtACTIVER#tbuttonOktgridRtbuttonCancel(R%t	labelMenut	labelPathtbrowseButtontframeButtons((s2/sys/lib/python2.7/idlelib/configHelpSourceEdit.pyR,s<	
	
%cCs�dddddg}|jj�}|rEtjj|�\}}nmd}tjd d
kr�tjjtjjtj	�d�}tjj
|�s�tj�}q�ntj�}tj
d|d|�}|jd|d|�}|r�jj|�ndS(Ns
HTML Filess*.htm *.htmltTEXTs	PDF Filess*.pdfsWindows Help Filess*.chms
Text Filess*.txts	All FilesRitwintDocRt	filetypest
initialdirtinitialfile(s
HTML Filess*.htm *.htmlRT(s	PDF Filess*.pdfRT(sWindows Help Filess*.chm(s
Text Filess*.txtRT(s	All FilesR(RtgettostsplitRtsystplatformtjointdirnamet
executabletisdirtgetcwdttkFileDialogtOpentshowR(R%RWRtdirtbaset
opendialogtfile((s2/sys/lib/python2.7/idlelib/configHelpSourceEdit.pyRILs$	$cCs�t}|jj�}|j�|sWtjddddd|�|jj�t}nDt	|�dkr�tjddddd|�|jj�t}n|S(s3Simple validity check for a sensible menu item nameRsMenu Item ErrortmessagesNo menu item specifiedRis(Menu item too long:
Limit 30 characters.(
tTrueRRZtstripttkMessageBoxt	showerrorRERFtFalsetlen(R%tmenuOkR((s2/sys/lib/python2.7/idlelib/configHelpSourceEdit.pytMenuOkcs 

	
	cCs�t}|jj�}|j�|sWtjddddd|�|jj�t}ns|j	d�rina|d d	kr�|d}nt
jj|�s�tjdddd
d|�|jj�t}n|S(s(Simple validity check for menu file pathRsFile Path ErrorRksNo help file path specified.Rswww.thttpisfile:sHelp file path does not exist.(swww.Rt(RlRRZRmRnRoRGRFRpt
startswithR[texists(R%tpathOkR((s2/sys/lib/python2.7/idlelib/configHelpSourceEdit.pytPathOkws(

	

	cCs�|j�r�|j�r�|jj�j�|jj�j�f|_tjdkr�|jd}|j	d�rsq�t
|j�|_d||jd<n|j�ndS(Ntdarwinitwwwsfile:shttp:sfile://(Rzsfile:shttp:(RsRxRRZRmRRR]R^Rutlisttdestroy(R%teventR((s2/sys/lib/python2.7/idlelib/configHelpSourceEdit.pyR#�s
cCsd|_|j�dS(N(RRR|(R%R}((s2/sys/lib/python2.7/idlelib/configHelpSourceEdit.pyR�s	N(
t__name__t
__module__RRRIRsRxRR#R(((s2/sys/lib/python2.7/idlelib/configHelpSourceEdit.pyR
s!	 			t__main__cCs!d}ttd�}|jGHdS(NRsGet Help Source(RtrootR(tkeySeqtdlg((s2/sys/lib/python2.7/idlelib/configHelpSourceEdit.pytrun�sR.tDialogR3(t__doc__R[R]tTkinterRnRdRRR~tTkR�R�RHR=tmainloop(((s2/sys/lib/python2.7/idlelib/configHelpSourceEdit.pyt<module>s
�		

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].