a „oeºNã@s®ddlZddlZddlZddlZddlZddlZddlZddlZddlm Z m Z ddl m Z m Z dadd„ZddlmZeej_Gd d „d e jƒZGd d „d e jƒZeƒZdS) éN)ÚafxresÚdialogé)ÚappÚ dbgcommandsú.pycCs8| ¡}ddlm}| |¡ddlm}| |¡dS)Nr©Útoolmenu©Úhelp)Z GetSharedMenuÚpywin.frameworkr Ú SetToolsMenur ÚSetHelpMenuOtherHelp)ÚselfZ sharedMenur r ©rúCC:\Program Files\Certbot\pkgs\pythonwin\pywin\framework\intpyapp.pyÚ_SetupSharedMenu_s    r)Údocviewc@s,eZdZdd„Zdd„Zdd„Zdd„Zd S) Ú MainFramecCsàd|_tj ||¡dkrdStjtjBtjBtj Btj B}|  tj ¡t  ||tjB¡}| dtj¡| t j¡|  tj ¡| d¡| |¡ddlm}||ƒ| ¡}ddlm}| |d¡ddlm}| |¡dS) NréÿÿÿÿZStandard)ÚPrepareControlBarsrrér ) ÚclosingrrÚOnCreateÚwin32conZWS_CHILDrZCBRS_SIZE_DYNAMICZCBRS_TOPZ CBRS_TOOLTIPSZ CBRS_FLYBYZ EnableDockingZCBRS_ALIGN_ANYÚwin32uiZ CreateToolBarZ WS_VISIBLEZ ModifyStyleÚcommctrlZ TBSTYLE_FLATZ LoadToolBarZ IDR_MAINFRAMEZ SetWindowTextZDockControlBarZpywin.debugger.debuggerrZGetMenuÚr r r r r)rZ createStructZstyleÚtbrZmenur r rrrr$s6ÿþýüÿ         zMainFrame.OnCreatecCs¶zPddl}|jjdurN|jjjrNz|jj d¡Wnt ¡Yn0WdSWntjydYn0d|_ |  d¡|  d¡ddl m }| ¡| tj¡| tj¡|j ¡S)NrrÚToolbarDefaultr )Úpywin.debuggerZdebuggerZcurrentDebuggerZpumpingÚcloseÚ tracebackÚ print_excrÚerrorrZ SaveBarStateZ SetActiveViewr r Z FinalizeHelpÚDestroyControlBarrZAFX_IDW_TOOLBARÚID_VIEW_TOOLBAR_DBGÚ_obj_ÚOnClose)rZpywinr rrrr(Hs* ÿþ      zMainFrame.OnClosecCs2z| |¡}Wntjy$YdS0| ¡dS©N)Z GetControlBarrr$Z DestroyWindow)rÚidZbarrrrr%ds zMainFrame.DestroyControlBarc CsFz| ¡}| ||¡rWdSWntjtfy6Yn0|j ||¡S©Nr)Z GetActiveViewÚ OnCommandrr$ÚAttributeErrorr')rZwparamZlparamÚvrrrr,ksÿ  zMainFrame.OnCommandN)Ú__name__Ú __module__Ú __qualname__rr(r%r,rrrrr#s$rc@sØeZdZdd„Zdd„Zdd„Zdd„Zd d „Zd d „Zd d„Z d4dd„Z dd„Z d5dd„Z dd„Z dd„Zdd„Zdd„Zdd„Zd d!„Zd"d#„Zd$d%„Zd&d'„Zd(d)„Zd*d+„Zd,d-„Zd.d/„Zd0d1„Zd2d3„ZdS)6ÚInteractivePythonAppcCsìtj |¡t ¡ ¡| |jtj¡| |j tj ¡| |j tj ¡|  |jtj ¡| |jtj¡| |jtj¡| |jtj¡|  |jtj¡| |jtj¡| |jtj¡| |jtj¡| |jtj¡|  |jtj¡dSr)) rÚCAppÚ HookCommandsrZDebuggerCommandHandlerZ HookCommandÚ OnViewBrowserZID_VIEW_BROWSEÚ OnFileImportZID_FILE_IMPORTÚ OnFileCheckZ ID_FILE_CHECKZHookCommandUpdateÚOnUpdateFileCheckÚ OnFileRunZ ID_FILE_RUNÚ OnFileLocateZID_FILE_LOCATEÚOnInteractiveWindowZID_VIEW_INTERACTIVEÚOnUpdateInteractiveWindowÚ OnViewOptionsZID_VIEW_OPTIONSÚ OnHelpIndexrZ ID_HELP_INDEXÚ OnFileSaveAllZID_FILE_SAVE_ALLÚOnViewToolbarDbgr&ÚOnUpdateViewToolbarDbg©rrrrr4‚s"  ÿz!InteractivePythonApp.HookCommandscCstƒSr))rrBrrrÚCreateMainFrame•sz$InteractivePythonApp.CreateMainFramecCs`zddlm}Wnty$YdS0| |j¡}z| dd¡|WS|jyZYdS0dS)Nr©ÚintpyddeÚ PythonwinZSystem)rrEÚ ImportErrorZCreateConversationÚ ddeServerZ ConnectTor$)rrEÚconvrrrÚMakeExistingDDEConnection˜s   z.InteractivePythonApp.MakeExistingDDEConnectioncCs¬zddlm}Wnty,d|_d}Yn0|dur¨| |¡|_|j d|j¡z6| ¡}|dur†| d¡|  t j |¡dur†WdSWnt   t  ¡d¡YdS0dS)NrrDrFzself.Activate()z+ - error in DDE conversation with Pythonwin)rrErGrHZ DDEServerZCreateZCBF_FAIL_SELFCONNECTIONSrJÚExecÚ ProcessArgsÚsysÚargvrÚDisplayTracebackÚexc_info)rrEZ connectionrrrÚInitDDE§s&     ÿzInteractivePythonApp.InitDDEcCsædtjvr6dtjvr6dtjvr6dtjvr6| ¡rÿþýü ÿ  ÿz!InteractivePythonApp.InitInstancecCsTt ¡zddlm}| ¡Wn Yn0|jdurH|j ¡d|_tj  |¡S©NrrV) rZDestroyDebuggerThreadrrWZDestroyInteractiveWindowrHZShutdownrr3Ú ExitInstancer]rrrr_ús    z!InteractivePythonApp.ExitInstancecCs2t ¡}| ¡| ¡dtjkr.| tj¡dSr+)rÚ GetMainFrameZSetForegroundWindowZGetWindowPlacementrZSW_SHOWMINIMIZEDZ ShowWindowZ SW_RESTORE)rr\rrrÚActivateszInteractivePythonApp.ActivateNc Cs�t|ƒdks|dsdSd}|t|ƒk�rŒ||}|d7}| d¡rTd|dd…}| d¡sxt ddd¡ ¡}|d8}|t|ƒkrŒ||pŽd}|d vršq| d ¡rút|td ƒd…ƒ}|rÌ| d |¡n,dd lm}|  ¡}|rø|  |  |d¡¡q|dk�rl|d7}t   |¡} tj | ¡�sBt d | t  ¡fdtj¡q|�r\| dt| ƒ¡nt ¡ |¡q|dk�rÐ|�r¢| d|d ||dd…¡f¡n*dd lm}| |d ||dd…¡¡dS|dk�r6|�r| d|d ||dd…¡f¡n,dd lm}| |d ||dd…¡d¡dS|dk�rJtdƒ‚q|dk�r~|du�rj| |¡n t d¡|d7}qtd|ƒ‚qdS)Nrrú-ú/ÚPythonzDefault Arg Typez/editÚMISSING)rRrSrTrUz/goto:zvfrom pywin.framework import scriptutils ed = scriptutils.GetActiveEditControl() if ed: ed.SetSel(ed.LineIndex(%s - 1))©Ú scriptutilsz"No such file: %s Command Line: %szOpen file for editz%win32ui.GetApp().OpenDocumentFile(%s)z/rundlgzHfrom pywin.framework import scriptutils;scriptutils.RunScript(%r, %r, 1)ú z/runzHfrom pywin.framework import scriptutils;scriptutils.RunScript(%r, %r, 0)z/appz6/app only supported for new instances of Pythonwin.exez/ddezDThe /dde command can only be used when Pythonwin is already runningz(Command line argument not recognised: %s)ÚlenÚ startswithrÚ GetProfileValÚlowerÚintrKrrgZGetActiveEditControlZSetSelZ LineIndexÚwin32apiZGetFullPathNameÚosÚpathÚisfileÚ MessageBoxZGetCommandLinerZ MB_ICONERRORÚreprÚGetAppÚOpenDocumentFileÚjoinÚ RunScriptÚ RuntimeErrorÚ ValueError) rÚargsZddeÚiZargTypeZparZgotolinergZedÚfnamerrrrLsœ ÿÿ  ÿ þÿ    ÿü ÿÿ  ÿÿ   ÿ   ÿ z InteractivePythonApp.ProcessArgscCs| d¡dS)Nz,pywin.framework.editor,pywin.framework.stdin)Ú DoLoadModulesrBrrrrZosz&InteractivePythonApp.LoadSystemModulescCs(|durd}t dd|¡}| |¡dS)Nz6pywin.framework.sgrepmdi,pywin.framework.mdi_pycheckerrdzStartup Modules)rrkr})rÚ moduleNamesÚdefaultrrrr[rsz$InteractivePythonApp.LoadUserModulescCs\|sdS| d¡}|D]@}z t|ƒWqt ¡d|}t|ƒt |¡Yq0qdS)Nú,z)Startup import of user module "%s" failed)ÚsplitÚ __import__r"r#Úprintrrr)rr~ÚmodulesÚmoduleÚmsgrrrr}ys  z"InteractivePythonApp.DoLoadModulescCs6zt|dƒWn td|ƒt ¡‚Yn0dS)NÚ zERROR executing DDE command: )Úexecrƒr"r#)rZcommandrrrÚ OnDDECommand‰s  z!InteractivePythonApp.OnDDECommandcCs˜ddlm}t ddd¡}|dur&dSz| t|tjtjƒ¡WnRty\t   d¡Yn8t yvt   d¡Ynt   ¡t   d ¡Yn0dS) z*Called when ViewBrowse message is receivedr)ÚbrowserZObjectÚ __builtins__zBrowse Python ObjectNz This is no object with this namez(The object has no attribute of that namezThis object can not be browsed)Z pywin.toolsrŠrÚGetSimpleInputZBrowseÚevalÚ__main__Ú__dict__Ú NameErrorrrrr-r"r#)rr*ÚcoderŠZobNamerrrr5”s   z!InteractivePythonApp.OnViewBrowsecCsddlm}| ¡dS)zRCalled when a FileImport message is received. Import the current or specified filerrfN)rrgZ ImportFile©rr*r‘rgrrrr6¥s z!InteractivePythonApp.OnFileImportcCsddlm}| ¡dS)zDCalled when a FileCheck message is received. Check the current file.rrfN)rrgZ CheckFiler’rrrr7«s z InteractivePythonApp.OnFileCheckcCs$ddlm}| | d¡du¡dS)Nrrfr)rrgÚEnableZGetActiveFileName)rÚcmduirgrrrr8±s z&InteractivePythonApp.OnUpdateFileCheckcCs.ddlm}t tj¡dk}| dd|¡dS)z*Called when a FileRun message is received.rrfrN)rrgrnZ GetKeyStaterZVK_SHIFTrw)rr*r‘rgZshowDlgrrrr9¶s zInteractivePythonApp.OnFileRuncCsŠddlm}t dtd¡}|dur&dS|atdd… ¡dkrJtdd…at dd¡a| t¡}|durxt  d t¡nt  ¡  |¡dS) Nrrfz File namezLocate Python FileéýÿÿÿrÚ.ú\z The file '%s' can not be located) rrgrrŒÚlastLocateFileNamerlÚreplaceZLocatePythonFilerrrrtru)rr*r‘rgÚnameZnewNamerrrr:½s ÿ   z!InteractivePythonApp.OnFileLocatec Cst ¡t d¡}ddlm}| | ¡¡ddlm }| |  ¡¡g}|  ¡D]0}z |j }Wnt yvYqRYn0||ƒ}qRzddlm} Wntyªd} Yn0| durÂ| |  ¡¡|D]} | | ¡qÆ| ¡tjk�rt dd¡t d¡t ¡ tjdd¡t d¡dS)NzPythonwin Optionsr)Ú ideoptionsrr)Úconfiguiz!Applying configuration changes...)rZ InitRichEditrZ PropertySheetZ pywin.dialogsr›ZAddPageZOptionsPropPagerr ZToolMenuPropPageZGetDocTemplateListZGetPythonPropertyPagesr-r rœrGÚappendZDebuggerOptionsPropPageZDoModalrZIDOKÚ SetStatusTextZ DoWaitCursorr`ZSendMessageToDescendantsZWM_WININICHANGE) rr*r‘Zsheetr›r ZpagesÚtemplateÚgetterrœZpagerrrr=Ôs8             ÿz"InteractivePythonApp.OnViewOptionscCsddlm}| ¡dSr^)rrWZToggleInteractiveWindow)rr*r‘rWrrrr;ÿs z(InteractivePythonApp.OnInteractiveWindowcCsDztjd}| ¡}Wnty,d}Yn0| ¡| |¡dS)Nzpywin.framework.interactr)rMr„ZIsInteractiveWindowVisibleÚKeyErrorr“ZSetCheck)rr”rWÚstaterrrr<s    z.InteractivePythonApp.OnUpdateInteractiveWindowcCsXddlm}d}| ¡D]*}| ¡r| ¡rd}}| | ¡¡qt d|d¡dS)Nr)ÚeditorTemplaterz%d documents saved)Zpywin.framework.editorr£ZGetDocumentListZ IsModifiedZ GetPathNameZOnSaveDocumentrrž)rr*r‘r£ZnumÚdocrrrr?s  z"InteractivePythonApp.OnFileSaveAllcCs|dkrt ¡ |¡ SdS)Nr)rr`Z OnBarCheck)rr*r‘rrrr@sz%InteractivePythonApp.OnViewToolbarDbgcCst ¡ |¡| d¡dSr+)rr`ZOnUpdateControlBarMenur“)rr”rrrrAsz+InteractivePythonApp.OnUpdateViewToolbarDbgcCsddlm}| ¡dS)Nrr )rr ZSelectAndRunHelpFile)rr*r‘r rrrr>!s z InteractivePythonApp.OnHelpIndex)N)N)r/r0r1r4rCrJrQrYr_rarLrZr[r}r‰r5r6r7r8r9r:r=r;r<r?r@rAr>rrrrr2}s28  `  +  r2)rorMr"rŽrrnrrZ pywin.mfcrrrrrr˜rrZ DocTemplaterr3r2ZthisApprrrrÚs& Z1