]@sddlZddlZddlTddljZddljZGddde Z e dkrddl Z e j dddd d dd lmZee dS) N)*c@sseZdZdddddZddZddZd d Zd d Zd ddZd ddZ d S)GetHelpSourceDialogFcCsOtj|||jdd|jdtdt|j||j||j|jd|j ||_ d|_ |j |j j||jj||j|j|jd|j|jd|jd|j|s|jd|jdndf|j|jd |j|jdS) N borderwidthZheightwidthZWM_DELETE_WINDOWz+%d+%dz)Toplevel__init__Z configureZ resizableFALSEtitleZ transientZgrab_setprotocolcancelparentresultcreate_widgetsmenusetpathZwithdrawZupdate_idletasksZgeometryZ winfo_rootxZ winfo_widthZwinfo_reqwidthZ winfo_rootyZ winfo_heightZwinfo_reqheightZ deiconifybindokZ wait_window)selfrr ZmenuItemZfilePathZ_htestr9/opt/alt/python35/lib64/python3.5/configHelpSourceEdit.pyr s.           0 zGetHelpSourceDialog.__init__c Csmt||_t||_t||_t|dddt|_|jjdtdt dt t |jdt dt d d }t|jd |jd d |_|jjt |jdt dt d d}t|jd |jd d|_|jj|jdt dddd|jjdt dddd|jdt dddd|jjdt ddddt|jd dd dd|j}|jddt|}|jdtdtt|d dd ddtd|j|_|jjddddddddt|d dd dd|j|_|jjdddddddddS)NrrZreliefZsideexpandfillZanchorZjustifytextz Menu Item:Z textvariablerz,Help File Path: Enter URL or browse for file(ZpadxrZpadyZBrowseZcommandZOKdefaultrowrcolumnZCancel)Z StringVarrrZfontSizeZFrameZGROOVEZ frameMainpackZTOPTRUEZBOTHZLabelWZLEFTZEntry entryMenu focus_set entryPathZButton browse_fileZBOTTOMXZACTIVErZbuttonOkZgridrZ buttonCancel)rZ labelMenuZ labelPathZ browseButtonZ frameButtonsrrrr/s<        %z"GetHelpSourceDialog.create_widgetscCsdddddg}|jj}|rEtjj|\}}npd}tjdd d krtjjtjjtjd}tjj |stj }n tj }t j d|d|}|j d|d|}|r|jj|dS)N HTML Files *.htm *.htmlTEXT PDF Files*.pdfWindows Help Files*.chm Text Files*.txt All Filesrr winZDocr filetypesZ initialdirZ initialfile)r.r/r0)r1r2r0)r3r4)r5r6r0)r7r)rgetossplitsysplatformjoindirname executableisdirgetcwd tkFileDialogZOpenZshowr)rr9rdirbaseZ opendialogfilerrrr,Os$ $ zGetHelpSourceDialog.browse_filecCsd}|jj}|j|sWtjddddd||jjd}nAt|dkrtjdddd d||jjd}|S) NTr zMenu Item ErrormessagezNo menu item specifiedrFrz(Menu item too long: Limit 30 characters.)rr:strip tkMessageBox showerrorr)r*len)rmenu_okrrrrrMfs     zGetHelpSourceDialog.menu_okcCsd}|jj}|j|sWtjddddd||jjd}ny|jd ring|dd d kr|d d}tjj |stjdddd d||jjd}|S)NTr zFile Path ErrorrHzNo help file path specified.rFwww.httprzfile:zHelp file path does not exist.)rNrO) rr:rIrJrKr+r* startswithr;exists)rpath_okrrrrrRzs(    zGetHelpSourceDialog.path_okNcCs|jr|jr|jjj|jjjf|_tjdkr|jd}|j drsn#t |j|_d||jd<|j dS) Ndarwinr%wwwfile:http:https:zfile://)rTrUrVrW) rMrRrr:rIrrr=r>rPlistdestroy)reventrrrrrs zGetHelpSourceDialog.okcCsd|_|jdS)N)rrY)rrZrrrrs zGetHelpSourceDialog.cancel) __name__ __module__ __qualname__r rr,rMrRrrrrrrr s $   r__main__z"idlelib.idle_test.test_config_help verbosityrexitF)run)r;r=tkinterZtkinter.messageboxZ messageboxrJZtkinter.filedialogZ filedialogrDr rr[ZunittestmainZidlelib.idle_test.htestrarrrrs