f _@sddlmZmZmZmZmZmZmZmZm Z m Z m Z ddl m Z mZmZddlmZddlmZGdddeZGddde ZGd d d e ZGd d d eZdddZdddZedkrddlmZeddddddlmZeedS)) ToplevelTextTclError HORIZONTALVERTICALNSEWNSEWNONEWORDSUNKEN)Frame ScrollbarButton) showerror) color_configcs,eZdZfddZddZddZZS)AutoHideScrollbarcs<t|dkst|dkr"|n|t||dS)Ngg?)floatgridZ grid_removesuperset)selflohi __class__)/usr/lib64/python3.10/idlelib/textview.pyrs zAutoHideScrollbar.setcKst|jjddS)Nz does not support "pack"rr__name__rkwargsrrrpackszAutoHideScrollbar.packcKst|jjddS)Nz does not support "place"rr rrrplaceszAutoHideScrollbar.place)r __module__ __qualname__rr"r# __classcell__rrrrr s rcs eZdZeffdd ZZS)ScrollableTextFramec stj|fi|t||d}|_|jddtd|jddd|jdddt|t d|j d|_ |j jddt d|j j |d<|tkrt|td|jd|_|jjddtd|jj |d <nd|_dS) Nwrapr)rowcolumnZsticky)ZweightF)Zorient takefocuscommandZyscrollcommandZxscrollcommand)r__init__rtextrr Zgrid_rowconfigureZgrid_columnconfigurerrZyviewZyscrollrrr rZxviewZxscrollr)rZmasterr)r!r0rrrr/"s&  zScrollableTextFrame.__init__)rr$r%r r/r&rrrrr'sr'cs(eZdZdfdd ZdddZZS) ViewFramewordcst|||_|d|j|d|jt|tdd|_|jj}|_| d||j |dddt || t |d |jd d |_}|jjd d dd|jdddS)Nzzi)ZreliefZheightz1.0rdisabled)r)ZhighlightthicknessstateCloseFr0r.r-topTbothsideexpandfillZbottom)r:)rr/parentbindokr'r Z textframer0insertZ configurerZ focus_setr button_okr")rr=contentsr)r0rArrrr/Js   zViewFrame.__init__NcCs|jdSN)r=destroyreventrrrr?dsz ViewFrame.ok)r2)N)rr$r%r/r?r&rrrrr1Hsr1cs4eZdZdefdddfdd Zd ddZZS) ViewWindowTF)_htest_utestc st|d|d<|d}||s.dnd} |d|d| ||t|||d|_|d|j t |d |j d d |_ } |jj d d dd||_ |j r||||s|dS)NZ borderwidth dz =750x500++r(ZWM_DELETE_WINDOWr5Fr6r7Tr8r9)rr/Z winfo_rootxZ winfo_rootyZgeometrytitler1Z viewframeprotocolr?rrAr"is_modalZ transientZgrab_setZ wait_window) rr=rNrBmodalr)rHrIxyrArrrr/ls$     zViewWindow.__init__NcCs|jr||dSrC)rPZ grab_releaserDrErrrr?sz ViewWindow.ok)N)rr$r%r r/r?r&rrrrrGis#rGTr2FcCst||||||dS)Nr)rI)rG)r=rNrBrQr)rIrrr view_texts rUc Csz:t|d|d}|}Wdn1s.0YWn\tybtdd|d|dYnJty} ztdt| |dWYd} ~ nd} ~ 00t||||||dSdS) Nr)encodingzFile Load ErrorzUnable to load file z .)rNmessager=zUnicode Decode ErrorrT)openreadOSErrorrUnicodeDecodeErrorstrrU) r=rNfilenamerWrQr)rIfilerBerrrrr view_files"*    ra__main__)mainzidlelib.idle_test.test_textview) verbosityexit)runN)Tr2F)Tr2F)tkinterrrrrrrrr r r r Z tkinter.ttkr rrZtkinter.messageboxrZidlelib.colorizerrrr'r1rGrUrarZunittestrcZidlelib.idle_test.htestrgrrrrs4  )!-