`odZddlmZmZmZmZmZmZmZm Z m Z m Z m Z ddl mZmZmZddlmZddlmZGddeZGdd eZGd d eZGd d eZddZ ddZedk(r ddlmZedddddlmZeeyy)zSimple text browser for IDLE ) ToplevelTextTclError HORIZONTALVERTICALNSEWNSEWNONEWORDSUNKEN)Frame ScrollbarButton) showerror) color_configc.eZdZdZfdZdZdZxZS)AutoHideScrollbarzpA scrollbar that is automatically hidden when not needed. Only the grid geometry manager is supported. ct|dkDst|dkr|jn|jt|||y)Ngg?)floatgrid grid_removesuperset)selflohi __class__s 7/opt/alt/python312/lib64/python3.12/idlelib/textview.pyrzAutoHideScrollbar.sets; 9s?eBi#o IIK      Bc Ft|jjd)Nz does not support "pack"rr__name__rkwargss rpackzAutoHideScrollbar.packs $..1122JKLLr c Ft|jjd)Nz does not support "place"r"r$s rplacezAutoHideScrollbar.places $..1122KLMMr )r# __module__ __qualname____doc__rr&r( __classcell__rs@rrr sMNr rc&eZdZdZeffd ZxZS)ScrollableTextFramezDisplay text with scrollbar(s).c `t||fi|t||x}|_|j ddt |j dd|jddt|td|j|_ |jj ddt|jj|d<|tk(r^t|td|j |_|j"j ddt$|j"j|d <y d |_y ) aCreate a frame for Textview. master - master widget for this frame wrap - type of text wrapping to use ('word', 'char' or 'none') All parameters except for 'wrap' are passed to Frame.__init__(). The Text widget is accessible via the 'text' attribute. Note: Changing the wrapping mode of the text widget after instantiation is not supported. wrapr)rowcolumnsticky)weightF)orient takefocuscommandyscrollcommandxscrollcommandN)r__init__rtextrr grid_rowconfiguregrid_columnconfigurerryviewyscrollrrr rxviewxscrollr )rmasterr2r%r>rs rr=zScrollableTextFrame.__init__"s  *6*400ty a$ / q+ !!!A!.)h3815=  a"5!%!1!1  4<,T*7<59ZZADL LL  !Ab  9%)\\%5%5D! "DLr )r#r)r*r+r r=r,r-s@rr/r/s)$(# # r r/c,eZdZdZdfd ZddZxZS) ViewFramez#Display TextFrame and Close button.c,t||||_|jd|j|jd|jt |t d|_|jjx}|_|jd||j|ddt||jt|d |jd x|_}|jjd d d|jdy)aCreate a frame for viewing text with a "Close" button. parent - parent widget for this frame contents - text to display wrap - type of text wrapping to use ('word', 'char' or 'none') The Text widget is accessible via the 'text' attribute. zzi)reliefheightz1.0rdisabled)r2highlightthicknessstateCloseFr>r:r9topTbothsideexpandfillbottom)rSN)rr=parentbindokr/r textframer>insert configurer focus_setr button_okr&)rrWcontentsr2r>r^rs rr=zViewFrame.__init__Js    *dgg& *dgg&,T&M>>...ty E8$ DQjIT %+7DGGu&F F t&AH%r c8|jjyzDismiss text viewer dialog.N)rWdestroyrevents rrYz ViewFrame.okds r )wordN)r#r)r*r+r=rYr,r-s@rrGrGHs)&4r rGc8eZdZdZdefdddfd ZddZxZS) ViewWindowz%A simple text viewer dialog for IDLE.TF)_htest_utestc<t ||d|d<|jdz}|j|sdndz} |j d|d| |j |t ||||_|jd|jt|d |jd x|_ } |jjd d d||_ |jr5|j||j|s|j!yyy)aShow the given text in a scrollable window with a 'close' button. If modal is left True, users cannot interact with other windows until the textview window is closed. parent - parent of this dialog title - string which is title of popup dialog contents - text to display in dialog wrap - type of text wrapping to use ('word', 'char' or 'none') _htest - bool; change box location when running htest. _utest - bool; don't wait_window when running unittest.  borderwidth dz =750x500++r1WM_DELETE_WINDOWrNFrOrPTrQrRN)rr= winfo_rootx winfo_rootygeometrytitlerG viewframeprotocolrYrr^r&is_modal transientgrab_set wait_window) rrWrur_modalr2rirjxyr^rs rr=zViewWindow.__init__ls  ]    2 %    fB# > !AaS)* 5"4= ($''2%+Dw48GGu&N N t&A == NN6 " MMO  " r c\|jr|j|jyra)rx grab_releaserbrcs rrYz ViewWindow.oks ==     r rf)r#r)r*r+r r=rYr,r-s@rrhrhis +6:!# !#Fr rhFc$t||||||S)aCreate text viewer for given text. parent - parent of this dialog title - string which is the title of popup dialog contents - text to display in this dialog wrap - type of text wrapping to use ('word', 'char' or 'none') modal - controls if users can interact with other windows while this dialog is displayed _utest - bool; controls wait_window on unittest r2rj)rh)rWrur_r|r2rjs r view_textrs feXu4 OOr c t||5}|j}dddt|||||S#1swYxYw#t$rt dd|d|Yyt $r!} t dt | |Yd} ~ yd} ~ wwxYw) zCreate text viewer for text in filename. Return error message if file cannot be read. Otherwise calls view_text with contents of the file. )encodingNrzFile Load ErrorzUnable to load file z .)rumessagerWzUnicode Decode Error)openreadrOSErrorrUnicodeDecodeErrorstr) rWrufilenamerr|r2rjfiler_errs r view_filers ( (X .$yy{H/%d &( (/ . !)0 B? !  !.c( ! ! !s0 A9AAAB "B *BB __main__)mainzidlelib.idle_test.test_textview) verbosityexit)runN)TreF) r+tkinterrrrrrrr r r r r tkinter.ttkrrrtkinter.messageboxridlelib.colorizerrrr/rGrhrrr#unittestridlelib.idle_test.htestrr rrs;;;;00(*N N&& %& RB**Z PCI0 z *aeD+ O r