m &UIc@s_dkZdkZdkZdkZdkZdkZdkZdkZdkTdk l Z dk l Z ydkl Z Wne j o dZ nXy dkZeieidWne eifj onXdZeidjo;y!eid ZeieWnej onXnyGeieiZeejp edjo dZneieWn}eeefj ohyEeid Zeejp edjo dZneieWneefj onXnXeiZeid Zd e fd YZ d Z!dfdYZ"dZ#e$djo e#ndS(N(t*(s SimpleDialog(sidleConf(sBOM_UTF8sttasciitwin32iscoding[:=]\s*([-\w_.]+)tEncodingMessagecBs)tZdZdZdZdZRS(s3Inform user that an encoding declaration is needed.c Cst|_t||_}|id|i|id|i |i d|i |i d|i d||_t|dd}|idtdtt|d d }|id d ||idtdtd tt|dd|}|idtdtt|}|idtd td |_|_t|ddddd|i } | idtd t ddt|ddd|i!}|idtd t dd|i#|dS(NsstWM_DELETE_WINDOWs I/O Warningttexts:Non-ASCII found, yet no encoding declared. Add a line liketsidetanchortfonttcourieris# -*- coding: %s -*-tfills`to your file Choose OK to save this file as %s Edit your general options to silence this warningtOktdefaulttactivetcommandtexpandis Edit my file($tFalsetselft should_edittTopleveltmastertrootttoptbindt return_eventtdo_oktprotocoltwm_delete_windowtwm_titlet wm_iconnametLabeltl1tpacktTOPtWtEntrytl2tinserttenctXtl3tFrametbuttonsR tcanceltButtontb1tLEFTtBOTHtdo_edittb2t_set_transient( RRR'R+R2R)R R%RR.((t./data/zmath/lib/python2.4/idlelib/IOBinding.pyt__init__Js4       cCs|iddS(Ni(Rtdone(R((R4RpscCs|iddS(Ni(RR6(R((R4R1ss(t__name__t __module__t__doc__R5RR1(((R4RHs  & cCs|idd }di|}ti|}|pdSn|id}dk }y|i |Wn t j ot d|nX|S(szReturn the encoding declaration according to PEP 263. Raise LookupError if the encoding is declared but unknown. s iiNsUnknown encoding ( tstrtsplittjoint coding_retsearchtmatchtNonetgrouptnametcodecstlookupt LookupError(R:RBRCR?((R4t coding_specvs t IOBindingcBs"tZdZdZdZdZdZdZdZ dZ dZ dZ dddZ d ZeieZeiZd Zd Zd Zd ZdZdZdZdZdZdZdZdZ dd d!gZ!dZ"ddZ#dZ$dZ%RS("NcCs||_|i|_|iid|i|_|iid|i|_|iid|i|_ |iid|i |_ d|_ |iid|i|_dS(Ns<>s<>s<>s<>s<>(teditwinRRRtopent_IOBinding__id_opentsavet_IOBinding__id_savetsave_ast_IOBinding__id_saveast save_a_copyt_IOBinding__id_savecopyR@t fileencodingt print_windowt_IOBinding__id_print(RRH((R4R5s     cCs|iid|i|iid|i|iid|i|iid|i|iid|id|_ d|_d|_ dS(Ns<>s<>s<>s<>s<>( RRtunbindRJRLRNRPRSR@RHtfilename_change_hook(R((R4tcloses  cCs |iiS(N(RRHt get_saved(R((R4RWscCs|ii|dS(N(RRHt set_savedtflag(RRY((R4RXscCs|iidS(N(RRHt reset_undo(R((R4RZscCs ||_dS(N(thookRRU(RR[((R4tset_filename_change_hookscCsk|o)tii|od|_||_n8||_d|_|id|io|indS(Ni( tfilenametostpathtisdirR@RtdirnameRXRU(RR]((R4t set_filenames      cCs?|iio|p|i}n|}|oty|ii}Wn d}nX|i o2|io%| o|iii ||i q|iii |n|i i dSn|io2|i }|djo|i i dSqn|p|i}n|}|o|i |n|i i dS(NtbreakR,(RRHtflistteditFilet askopenfileR]tinterpR@RWRItloadfileRt focus_sett maybesavetreply(RteventReRgR]Rk((R4RIs4          s (\r\n)|\n|\rcCsay)t|d}|i}|iWn8tj o,}ti dt |d|i t SnX|i|}|ii|}|oW|id|_t|ito|iid|_n|iid|}n|i idd|id|i id||i|i||i id d|i id |i|t S( Ntrbs I/O ErrorRiRs\ns1.0tendR&(!RIR]tftreadtcharsRVtIOErrortmsgt tkMessageBoxt showerrorR:RRRtdecodeteol_reR>tfirsteolRAteol_conventiont isinstancetunicodetencodetsubtdeleteRbR@R&RZtmark_settseetupdaterecentfileslisttTrue(RR]RoRxRsRq((R4Rhs.      cCs2|itoBy|did}Wntj o |SqRXt|_|Snyt|}Wn>t j o2}t i dddd|d|i d }nX|o+yt||SWqtj oqXnyt|dSWntj onXyt|t}t|_Wntj onX|S( sMCreate a Unicode string If that fails, let Tcl try its best isutf-8ttitlesError loading the filetmessages^The encoding '%s' is not known to this Python installation. The file may not display correctlyRRN(Rqt startswithtBOM_UTF8Rvt UnicodeErrorRRQRFR'RERBRtRuRR@R{tencoding(RRqR'RB((R4Rvs<        c Cs|iodSnd|ipd}tiddd|dtidtid |i}|i }|djo(|i d|ip d }qn|ii|S( Ntyess&Do you want to save %s before closing?sthis untitled documentRs Save On CloseRticonttypeRR,(RRWR]RRttMessagetQUESTIONt YESNOCANCELRtmtshowRkRKR@Ri(RRRkR((R4Rj;s         cCsw|ip|i|nL|i|io8|idy|iiWqftj oqfXn|i i dS(NiRc( RR]RMRlt writefileRXRHtstore_file_breakstAttributeErrorRRi(RRl((R4RKNs    cCs|i}|oY|i|oE|i||idy|iiWqhtj oqhXqln|i i |i |dS(NiRc( Rt asksavefileR]RRbRXRHRRRRiR(RRlR]((R4RM[s      cCsB|i}|o|i|n|ii|i|dS(NRc(RRR]RRRiR(RRlR]((R4ROis    cCs|i|i|iidd}|idjo|id|i}ny8t|d}|i ||i |i tSWn8tj o,}tidt|d|itSnXdS(Ns1.0send-1cs twbs I/O ErrorR(Rt fixlastlineR|RtgetRqRytreplaceRIR]RotwritetflushRVRRrRsRtRuR:R(RR]RoRsRq((R4Rqs     c Cst|tio|Sny|idSWntj onXyt|}d}Wn!t j o}|}d}nX|o5y|i|SWqtj od|}qXn|o!t i dd|d|in|itjp|ot|idSn|io_y|i|iSWqutj o8t i dd|id|it|idSquXntidd d }|djot|idSnt}y0|it}t}|d jo t}nWn,tj o t|id}d}nX|p|Snt|ii|}|i|id joyd |} |ii dd}|i"do|ii#d| n|ii#d| |i|ii ddSn|S(NRsInvalid encoding '%s's I/O Errors%s. Saving as UTF-8Rsutf-8s1Cannot save this as '%s' anymore. Saving as UTF-8tmaint EditorWindowRtlocaleis# -*- coding: %s -*- s1.0s2.0s#!send-1c($RzRqttypest StringTypeR|RRFR'R@tfailedRERsRtRuRRRQRtidleConft GetOptiontconfig_encodingRtask_userRRRRHRtdialogtgotnumtenclineRt firstlineRR&( RRqRR'RRsRRRR((R4R|sp                cCs:|iid}|djo|iiddndS(Nsend-2cs send-1c(RRRtcR&(RR((R4Rs c Csd}|i} | o |i}n| p |djoTtidd\}}|}t i ||i |pt i |dSqnt i }d} |djo#tiddd}|d }n-|d jotiddd }nd } | o||}t i|d }|ii} |i }|od|| } n| o1dt|| } tid| d|iqn$d|} tid| d|i|ot i |ndS(Ntprefixt IDLE_tmp_RcitposixRtGeneralsprint-command-posixs 2>&1tntsprint-command-winitrs#Printing failed (exit status 0x%x) sPrinting command: %s s Print statusRs-Printing is not enabled for this platform: %s(R@t tempfilenameRRWtsavedR]ttempfiletmkstempttfdR^RVRtunlinkRBtplatformt printPlatformRRRtpopentpipeRptstriptoutputtstatustreprRtRuRRtshowinfo( RRlRRRRR]RRRRRR((R4RRsF            ! sPython and text filess*.py *.pyw *.txttTEXTsAll text filesRs All filescCs]|id\}}|ip%tid|id|i|_n|ii d|d|S(NRIRt filetypest initialdirt initialfile( Rtdefaultfilenametdirtbaset opendialogt tkFileDialogtOpenRRR(RRR((R4Rfs  RIcCsy|iotii|iSnU|io|idfSn:yti}Wntij o d}nX|dfSdS(NR( RR]R^R_R;Ratgetcwdtpwdterror(RtmodeR((R4R s   cCs]|id\}}|ip%tid|id|i|_n|ii d|d|S(NRKRRRR( RRRRt savedialogRtSaveAsRRR(RRR((R4Rs  cCs|ii|dS(s-Update recent file list on all editor windowsN(RRHtupdate_recent_files_listR](RR]((R4Rs(sPython and text filess*.py *.pyw *.txtR(sAll text filesRR(s All filesR(&R7R8R5RVRWRXRZR@RUR\R]RaRbRIteoltretcompileRwR^tlinesepRyRhRvRjRKRMRORR|RRRRRRRfRRR(((R4RGs>     (   -     J  +  cCsbt}dfdY}t|}|i|i||}t|}|i dS(Nt MyEditWincBsPtZdZdZdZdZdZdZdZdZ RS( NcCsn||_d|_|iid|i|iid|i|iid|i|iid|idS(Ns s ss( RRR@RdRRIRKRMRO(RR((R4R5%s   cCsdS(Ni((R((R4RW,scCsdS(N((RRY((R4RX-scCsdS(N((R((R4RZ.scCs|iiddS(Ns<>(RRtevent_generate(RRl((R4RI/scCs|iiddS(Ns<>(RRR(RRl((R4RK1scCs|iiddS(Ns<>(RRR(RRl((R4RM3scCs|iiddS(Ns<>(RRR(RRl((R4RO5s( R7R8R5RWRXRZRIRKRMRO(((R4R$s       ( tTkRRtTextRR!RiRHRGtiotmainloop(RRRHRR((R4ttest"s      t__main__(%R^RtsysRCRRRtRtTkintert SimpleDialogt configHandlerRRt ImportErrorRt setlocaletLC_CTYPEtErrorRRtgetdefaultlocaleRDREt nl_langinfotCODESETR@t NameErrorRt ValueErrortlowerRR=RRFRGRR7(RRRRRFRRRRRRCRRR^RRtRGR=((R4t?s`                 .