ó |G_Tc@sŸdZddlTddlZdefd„ƒYZed„Zded„Ze dkr›ddl Z e j d d d d e ƒdd l mZeeƒndS(sSimple text browser for IDLE iÿÿÿÿ(t*Nt TextViewercBs2eZdZeed„Zd„Zdd„ZRS(s*A simple text viewer dialog for IDLE cCs)tj||ƒ|jddƒ|jddd|jƒd|jƒ|sQdndfƒd|_d |_|jƒ|j |ƒ|j d |j ƒ||_ |j jƒ|jd |j ƒ|jd |j ƒ|j jd |ƒ|j jdtƒ|r%|j|ƒ|jƒ|jƒndS(sHShow the given text in a scrollable window with a 'close' button If modal option set to False, user can interact with other windows, otherwise they will be unable to interact with other windows until the textview window is closed. _htest - bool; change box location when running htest. t borderwidthis =%dx%d+%d+%diqiôi ids#ffffffs#000000tWM_DELETE_WINDOWssgtstateN(tToplevelt__init__t configuretgeometryt winfo_rootxt winfo_rootytbgtfgt CreateWidgetsttitletprotocoltOktparentttextViewt focus_settbindtinserttconfigtDISABLEDt transienttgrab_sett wait_window(tselfRRttexttmodalt_htest((s,/usr/local/lib/python2.7/idlelib/textView.pyR s(  !        c CsCt|dtddƒ}t|ƒ}t|ddd|jdtƒ|_t|dtdtd d ƒ|_t |d t d d d |j d |j ƒ|_ |jjd|j jƒ|j jd|jjƒ|jjƒ|jjdtdtƒ|j jdtdtdtƒ|jdtdtƒ|jdtdtdtƒdS(Ntrelieftheighti¼RtClosetcommandt takefocustorientthighlightthicknessitwrapR R tyscrollcommandtsidetfilltexpand(tFrametSUNKENtButtonRtFALSEtbuttonOkt ScrollbartVERTICALt scrollbarViewtTexttWORDR R RRtyviewtsettpacktRIGHTtYtLEFTtTRUEtBOTHtBOTTOMtXtTOP(Rt frameTextt frameButtons((s,/usr/local/lib/python2.7/idlelib/textView.pyR /s  cCs|jƒdS(N(tdestroy(Rtevent((s,/usr/local/lib/python2.7/idlelib/textView.pyR@sN( t__name__t __module__t__doc__tTruetFalseRR tNoneR(((s,/usr/local/lib/python2.7/idlelib/textView.pyRs# cCst||||ƒS(N(R(RRRR((s,/usr/local/lib/python2.7/idlelib/textView.pyt view_textDscCs‹y:|r*ddl}|j|dƒ}nt|dƒ}Wn1tk rmtjdddd|d|ƒnXt|||jƒ|ƒSdS(NiÿÿÿÿtrRsFile Load ErrortmessagesUnable to load file %r .R(tcodecstopentIOErrort tkMessageBoxt showerrorRJtread(RRtfilenametencodingRRMttextFile((s,/usr/local/lib/python2.7/idlelib/textView.pyt view_fileGs    t__main__sidlelib.idle_test.test_textviewt verbosityitexit(trun(RFtTkinterRPRRRGRJRIRVRDtunittesttmainRHtidlelib.idle_test.htestRZ(((s,/usr/local/lib/python2.7/idlelib/textView.pyts  <