ó {fc@s‚ddlZddlmZddlZddlZddlZddlZddlZddlTddlZddl Z ddl m Z ddl m Z y#ddl Z e je jdƒWnee jfk rÙnXejƒZdZejdkr3y!e jƒd ZejeƒWnek r/nXn½yDe je jƒZeekp]edkridZnejeƒWnveeefk rïyBe jƒd Zeekp¸edkrÄdZnejeƒWneefk rënXnXejƒZej d ƒZ!ej d ƒZ"d e fd „ƒYZ#d„Z$dfd„ƒYZ%d„Z&e'dkr~ddl(m)Z)e)e&ƒndS(iÿÿÿÿN(tBOM_UTF8(t*(t SimpleDialog(tidleConfttasciitwin32is&^[ \t\f]*#.*?coding[:=][ \t]*([-\w.]+)s^[ \t\f]*(?:[#\r\n]|$)tEncodingMessagecBs)eZdZd„Zd„Zd„ZRS(s3Inform user that an encoding declaration is needed.c CsÅt|_t|ƒ|_}|jd|jƒ|jd|jƒ|jd|jƒ|j dƒ|j dƒ||_ t |ddƒ}|j dtdtƒt|d d ƒ}|jd d |ƒ|j dtdtd tƒt |dd|ƒ}|j dtdtƒt|ƒ}|j dtd tƒd |_|_t|ddddd|jƒ}|j dtd tddƒt|ddd|jƒ} | j dtd tddƒ|j|ƒdS(NsstWM_DELETE_WINDOWs I/O Warningttexts:Non-ASCII found, yet no encoding declared. Add a line liketsidetanchortfonttcourieris# -*- coding: %s -*-tfills•to your file See Language Reference, 2.1.4 Encoding declarations. Choose OK to save this file as %s Edit your general options to silence this warningtOktdefaulttactivetcommandtexpandis Edit my file(tFalset should_edittTopleveltroottbindt return_eventtdo_oktprotocoltwm_delete_windowtwm_titlet wm_iconnamettoptLabeltpacktTOPtWtEntrytinserttXtFrameRtcanceltButtontLEFTtBOTHtdo_editt_set_transient( tselftmastertencRtl1tl2tl3tbuttonstb1tb2((s)/usr/lib64/python2.7/idlelib/IOBinding.pyt__init__Js6           cCs|jdƒdS(Ni(tdone(R.((s)/usr/lib64/python2.7/idlelib/IOBinding.pyRqscCs|jdƒdS(Ni(R8(R.((s)/usr/lib64/python2.7/idlelib/IOBinding.pyR,ts(t__name__t __module__t__doc__R7RR,(((s)/usr/lib64/python2.7/idlelib/IOBinding.pyRHs ' cCs®|jddƒd }xD|D]8}tj|ƒ}|dk rBPntj|ƒsdSqWdS|jdƒ}ddl}y|j|ƒWntk r©td|‚nX|S(szReturn the encoding declaration according to PEP 263. Raise LookupError if the encoding is declared but unknown. s iiiÿÿÿÿNsUnknown encoding ( tsplitt coding_retmatchtNonetblank_retgrouptcodecstlookupt LookupError(tstrtlsttlineR>tnameRB((s)/usr/lib64/python2.7/idlelib/IOBinding.pyt coding_specws    t IOBindingcBs=eZd„Zd„Zd„Zd„Zd„Zd"Zd„Z d"Z d"Z d„Z d"d"d„Z dZejeƒZejZd „Zd „Zd „Zd „Zd „Zd„Zd„Zd„Zd„Zd„Zd"Zd"Z d#d$d%gZ!e"j#dkrdndZ$d„Z%dd„Z&d „Z'd!„Z(RS(&cCs©||_|j|_|jjd|jƒ|_|jjd|jƒ|_|jjd|jƒ|_|jjd|j ƒ|_ d|_ |jjd|j ƒ|_dS(Ns<>s<>s<>s<>s<>(teditwinR Rtopent_IOBinding__id_opentsavet_IOBinding__id_savetsave_ast_IOBinding__id_saveast save_a_copyt_IOBinding__id_savecopyR?t fileencodingt print_windowt_IOBinding__id_print(R.RK((s)/usr/lib64/python2.7/idlelib/IOBinding.pyR7’s     cCs�|jjd|jƒ|jjd|jƒ|jjd|jƒ|jjd|jƒ|jjd|jƒd|_d|_d|_ dS(Ns<>s<>s<>s<>s<>( R tunbindRMRORQRSRVR?RKtfilename_change_hook(R.((s)/usr/lib64/python2.7/idlelib/IOBinding.pytclosežs  cCs |jjƒS(N(RKt get_saved(R.((s)/usr/lib64/python2.7/idlelib/IOBinding.pyRZªscCs|jj|ƒdS(N(RKt set_saved(R.tflag((s)/usr/lib64/python2.7/idlelib/IOBinding.pyR[­scCs|jjƒdS(N(RKt reset_undo(R.((s)/usr/lib64/python2.7/idlelib/IOBinding.pyR]°scCs ||_dS(N(RX(R.thook((s)/usr/lib64/python2.7/idlelib/IOBinding.pytset_filename_change_hookµscCsf|r-tjj|ƒr-d|_||_n5||_d|_|jdƒ|jrb|jƒndS(Ni(tostpathtisdirR?tfilenametdirnameR[RX(R.Rc((s)/usr/lib64/python2.7/idlelib/IOBinding.pyt set_filename»s      cCs%|jj}|r«|s'|jƒ}n|}|rŽ|jr~t|jddƒ r~|j r~|jƒr~|j||jƒq§|j|ƒn|j r§|j j ƒndS|jƒrã|j ƒ}|dkrã|j j ƒdSn|sø|jƒ}n|}|r|j|ƒn |j j ƒdS(NtinterptbreakR(( RKtflistt askopenfiletgetattrR?RcRZRLtloadfileR t focus_sett maybesave(R.teventteditFileRhRctreply((s)/usr/lib64/python2.7/idlelib/IOBinding.pyRLÆs6          s (\r\n)|\n|\rcCsWy(t|dƒ�}|jƒ}WdQXWn3tk r]}tjdt|ƒd|jƒtSX|j|ƒ}|j j |ƒ}|rÙ|j dƒ|_ t |j tƒrÁ|j jdƒ|_ n|j jd|ƒ}n|jjddƒ|jdƒ|jjd|ƒ|jƒ|j|ƒ|jjd dƒ|jjd ƒ|j|ƒtS( Ntrbs I/O ErrortparentiRs\ns1.0tendR%(RLtreadtIOErrort tkMessageBoxt showerrorRER Rtdecodeteol_retsearchRAteol_conventiont isinstancetunicodetencodetsubtdeleteReR?R%R]tmark_settyviewtupdaterecentfileslisttTrue(R.Rctftcharstmsgtfirsteol((s)/usr/lib64/python2.7/idlelib/IOBinding.pyRkös,    cCs!|jtƒrKy|djdƒ}Wntk r:|SXt|_|Snyt|ƒ}Wn<tk r™}tjdddd|d|j ƒd }nX|rÈyt ||ƒSWqÈtk rÄqÈXnyt |dƒSWntk rìnXyt |t ƒ}t |_Wntk rnX|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 correctlyRrRN( t startswithRRxt UnicodeErrorRTRIRDRvRwR R?R}tencoding(R.R†R0RH((s)/usr/lib64/python2.7/idlelib/IOBinding.pyRxs>         c Csª|jƒrdSd|jpd}tjddd|dtjd|jƒ}|r~d}|jdƒ|jƒs™d }q™n|dkr“d }nd }|jjƒ|S( Ntyess&Do you want to save %s before closing?sthis untitled documentR‰s Save On CloseRŠRRrR(tno( RZRcRvtaskyesnocanceltYESR RNR?Rl(R.RŠtconfirmRp((s)/usr/lib64/python2.7/idlelib/IOBinding.pyRmAs&          cCsq|js|j|ƒnG|j|jƒr`|jtƒy|jjƒWq`tk r\q`Xn|jj ƒdS(NRg( RcRPt writefileR[R„RKtstore_file_breakstAttributeErrorR Rl(R.Rn((s)/usr/lib64/python2.7/idlelib/IOBinding.pyRNWs    cCs„|jƒ}|rf|j|ƒrf|j|ƒ|jdƒy|jjƒWqctk r_qcXqfn|jjƒ|j |ƒdS(NiRg( t asksavefileR“ReR[RKR”R•R RlRƒ(R.RnRc((s)/usr/lib64/python2.7/idlelib/IOBinding.pyRPds       cCs@|jƒ}|r"|j|ƒn|jjƒ|j|ƒdS(NRg(R–R“R RlRƒ(R.RnRc((s)/usr/lib64/python2.7/idlelib/IOBinding.pyRRrs    cCsÓ|jƒ|j|jjddƒƒ}|jdkrO|jd|jƒ}nyJt|dƒ�1}|j|ƒ|jƒt j |j ƒƒWdQXt SWn3t k rÎ}tjdt|ƒd|jƒtSXdS(Ns1.0send-1cs twbs I/O ErrorRr(t fixlastlineR~R tgetR{treplaceRLtwritetflushR`tfsynctfilenoR„RuRvRwRER(R.RcR†R…R‡((s)/usr/lib64/python2.7/idlelib/IOBinding.pyR“zs    c Cs˜t|tƒr|Sy|jdƒSWntk r7nXyt|ƒ}d}Wntk ro}|}d}nX|r¨y|j|ƒSWq¨tk r¤d|}q¨Xn|rÎtjdd|d|j ƒn|j t ksã|rôt |jdƒS|j rVy|j|j ƒSWqVtk rRtjdd|j d|j ƒt |jdƒSXnt j dd d ƒ}|dkrˆt |jdƒSt}y.|jtƒ}t}|d kr»t}nWn*tk rèt |jdƒ}d}nX|só|St|jj|ƒ}|jƒ|jd kr”d |}|j jddƒ} | jdƒre|j jd|ƒn|j jd|ƒ|j|j jddƒƒS|S(NRsInvalid encoding '%s's I/O Errors%s. Saving as UTF-8Rrsutf-8s1Cannot save this as '%s' anymore. Saving as UTF-8tmaint EditorWindowR�tlocaleis# -*- coding: %s -*- s1.0s2.0s#!send-1c(R|RER~RŒRIR?RDRvRwR RTRRt GetOptionR„R�RRRKRtgotnumR™R‹R%( R.R†R0tfailedR‡tconfig_encodingtask_usertdialogtenclinet firstline((s)/usr/lib64/python2.7/idlelib/IOBinding.pyR~Šsv                    cCs8|jjdƒ}|dkr4|jjddƒndS(Nsend-2cs send-1c(R R™R%(R.tc((s)/usr/lib64/python2.7/idlelib/IOBinding.pyR˜Ôs c Cstjdddddtjd|jƒ}|sA|jjƒdSd}|jƒ}|re|j}n| sx|dkrÆtj dd ƒ\}}|}t j |ƒ|j |ƒsÆt j |ƒdSnt j}t}|d krtjd d d ƒ} | d} n*|dkr'tjd d dƒ} nt}|rÆ| tj|ƒ} t j| dƒ} | jƒjƒ} | j ƒ} | r�d| | } n| rédt| ƒ| } tjd| d|jƒqén#d|} tjd| d|jƒ|rÿt j |ƒndS(NR‰tPrintRŠsPrint to Default PrinterRRrRgtprefixt IDLE_tmp_tposixRŸtGeneralsprint-command-posixs 2>&1tntsprint-command-wintrs#Printing failed (exit status 0x%x) sPrinting command: %s s Print statuss-Printing is not enabled for this platform: %s(Rvt askokcanceltOKR RlR?RZRcttempfiletmkstempR`RYR“tunlinkRHR„RR¢RtpipestquotetpopenRttstriptreprRwtshowinfo(R.RnR’t tempfilenametsavedRcttfdtplatformt printPlatformRtpipetoutputtstatusRŠ((s)/usr/lib64/python2.7/idlelib/IOBinding.pyRUÙsX                s Python filess *.py *.pywtTEXTs Text filess*.txts All filesRtdarwins.pyRcCs‚|jdƒ\}}|jsBtjd|jd|jƒ|_n|jjd|d|ƒ}t|tƒr~|j t ƒ}n|S(NRLRrt filetypest initialdirt initialfile( tdefaultfilenamet opendialogt tkFileDialogtOpenR RÈtshowR|R}R~tfilesystemencoding(R.tdirtbaseRc((s)/usr/lib64/python2.7/idlelib/IOBinding.pyRis RLcCsm|jrtjj|jƒS|jr2|jdfSytjƒ}Wntjk r^d}nX|dfSdS(NR(RcR`RaR<Rdtgetcwdterror(R.tmodetpwd((s)/usr/lib64/python2.7/idlelib/IOBinding.pyRË s    cCs‹|jdƒ\}}|jsKtjd|jd|jd|jƒ|_n|jjd|d|ƒ}t|t ƒr‡|j t ƒ}n|S(NRNRrRÈtdefaultextensionRÉRÊ( RËt savedialogRÍtSaveAsR RÈR×RÏR|R}R~RÐ(R.RÑRÒRc((s)/usr/lib64/python2.7/idlelib/IOBinding.pyR–,s    cCs|jj|ƒdS(s-Update recent file list on all editor windowsN(RKtupdate_recent_files_list(R.Rc((s)/usr/lib64/python2.7/idlelib/IOBinding.pyRƒ8sN(s Python filess *.py *.pywRÆ(s Text filess*.txtRÆ(s All filesR()R9R:R7RYRZR[R]R?RXR_RcRdReRLteoltretcompileRyR`tlinesepR{RkRxRmRNRPRRR“R~R˜RURÌRØRÈtsysRÁR×RiRËR–Rƒ(((s)/usr/lib64/python2.7/idlelib/IOBinding.pyRJ�sD     ,   -     J  2  c CsÊddlm}m}||ƒ}|jdƒttttjd|j ƒƒƒƒ\}}}}|j d||dfƒdd d„ƒY}||ƒ} | j ƒ| j ƒ|| ƒ} t | ƒdS( Niÿÿÿÿ(RtTextsTest IOBindings[x+]s+%d+%di–t MyEditWincBsbeZd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z d „Z RS( cSs„||_d|_|jjd|jƒ|jjd|jƒ|jjd|jƒ|jjd|jƒ|jjd|jƒdS(Ns s s ss ( R R?RhRRLtprinterRNtsaveastsavecopy(R.R ((s)/usr/lib64/python2.7/idlelib/IOBinding.pyR7Es  cSsdS(Ni((R.((s)/usr/lib64/python2.7/idlelib/IOBinding.pyRZMRcSsdS(N((R.R\((s)/usr/lib64/python2.7/idlelib/IOBinding.pyR[NRcSsdS(N((R.((s)/usr/lib64/python2.7/idlelib/IOBinding.pyR]ORcSsdS(N((R.Rc((s)/usr/lib64/python2.7/idlelib/IOBinding.pyRÚPRcSs|jjdƒdS(Ns<>(R tevent_generate(R.Rn((s)/usr/lib64/python2.7/idlelib/IOBinding.pyRLQscSs|jjdƒdS(Ns<>(R Rå(R.Rn((s)/usr/lib64/python2.7/idlelib/IOBinding.pyRâSscSs|jjdƒdS(Ns<>(R Rå(R.Rn((s)/usr/lib64/python2.7/idlelib/IOBinding.pyRNUscSs|jjdƒdS(Ns<>(R Rå(R.Rn((s)/usr/lib64/python2.7/idlelib/IOBinding.pyRãWscSs|jjdƒdS(Ns<>(R Rå(R.Rn((s)/usr/lib64/python2.7/idlelib/IOBinding.pyRäYs( R9R:R7RZR[R]RÚRLRâRNRãRä(((s)/usr/lib64/python2.7/idlelib/IOBinding.pyRáDs         (( tTkinterRRàR‰tlisttmaptintRÜR<tgeometryR!RlRJ( RrRRàRtwidththeighttxtyRáR RK((s)/usr/lib64/python2.7/idlelib/IOBinding.pyt _io_binding=s  3    t__main__(trun(*RBRR`R¸RÜRßRµRæRÍRvRtidlelib.configHandlerRR¡t setlocaletLC_CTYPEt ImportErrortErrortgetfilesystemencodingRÐR�RÁtgetdefaultlocaleRCRDt nl_langinfotCODESETR?t NameErrorR•t ValueErrortlowerRÝR=R@RRIRJRïR9tidlelib.idle_test.htestRñ(((s)/usr/lib64/python2.7/idlelib/IOBinding.pyts`               / ÿ® %