\dHdZddlmZmZmZmZmZmZmZm Z m Z m Z m Z ddl mZmZmZddlmZddlmZGddeZGdd eZGd d eZGd d eZddZ ddZedkr'ddlmZedddddlmZeedSdS)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|dkst|dkr|n|t||dS)Ngg?)floatgrid grid_removesuperset)selflohi __class__s !..\python\lib\idlelib\textview.pyrzAutoHideScrollbar.sets_ 99s??eBii#oo IIKKKK        Bc :t|jjd)Nz does not support "pack"rr__name__rkwargss rpackzAutoHideScrollbar.packs$.1KKKLLLr c :t|jjd)Nz does not support "place"r"r$s rplacezAutoHideScrollbar.places$.1LLLMMMr )r# __module__ __qualname____doc__rr&r( __classcell__rs@rrr sjMMMNNNNNNNr rc&eZdZdZeffd ZxZS)ScrollableTextFramezDisplay text with scrollbar(s).c vtj|fi|t||x}|_|ddt |dd|ddt|td|j |_ |j ddt|j j |d<|tkrUt|td|j|_|jddt$|jj |d <d Sd |_d S) 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__"sJ **6***40000ty a$ /// q+++ !!!A!...)h3815===  a"555!%!1  4<<,T*7<59ZAAADL L  !Ab  9 9 9%)\%5D! " " "DLLLr )r#r)r*r+r r=r,r-s@rr/r/sF))$(# # # # # # # # # # r r/c,eZdZdZdfd ZddZxZS) ViewFramez#Display TextFrame and Close button.wordcht|||_|d|j|d|jt |t d|_|jjx}|_| d|| |ddt|| t|d |jd x|_}|jd d d|ddS)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)rTN)rr=parentbindokr/r textframer>insert configurer focus_setr button_okr&)rrXcontentsr2r>r_rs rr=zViewFrame.__init__Js$      *dg&&& *dg&&&,T&MMM>..ty E8$$$ DQjIIIT %+7DGu&F&F&F F t&AAAH%%%%%r Nc8|jdSzDismiss text viewer dialog.N)rXdestroyrevents rrZz ViewFrame.okds r )rHN)r#r)r*r+r=rZr,r-s@rrGrGHsW))&&&&&&4r rGc8eZdZdZdefdddfd ZddZxZS) ViewWindowz%A simple text viewer dialog for IDLE.TF)_htest_utestct|d|d<|dz}||sdndz} |d|d| ||t ||||_|d|j t|d |j d x|_ } |j d d d||_ |j rA||||s|dSdSdS)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_WINDOWrOFrPrQTrRrSN)rr= winfo_rootx winfo_rootygeometrytitlerG viewframeprotocolrZrr_r&is_modal transientgrab_set wait_window) rrXrur`modalr2rirjxyr_rs rr=zViewWindow.__init__lsk    ]    2 %    f$=BB# > )!))a))*** 5"4=== ($'222%+Dw48Gu&N&N&N N t&AAA = # NN6 " " " MMOOO #  """""  # # # #r Ncd|jr||dSrb)rx grab_releasercrds rrZz ViewWindow.oks/ =       r rf)r#r)r*r+r r=rZr,r-s@rrhrhisl++6:!# !#!#!#!#!#!#!#Fr rhTrHFc,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)rXrur`r|r2rjs r view_textrs feXu4 O O OOr cZ t||5}|}dddn #1swxYwYt||||||S#t$rt dd|d|Yn5t $r)} t dt | |Yd} ~ nd} ~ wwxYwdS) 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 .)rumessagerXzUnicode Decode Error)openreadrOSErrorrUnicodeDecodeErrorstr) rXrufilenamerr|r2rjfiler`errs r view_filersO ( (X . . . #$yy{{H # # # # # # # # # # # # # # #%d &((( ( !!!)???? ! ! ! ! ! ! !!!.c(( ! ! ! ! ! ! ! ! !! 4s8A4 A8A8A B(6 B(?B##B(__main__)mainzidlelib.idle_test.test_textview) verbosityexit)runN)TrHF) r+tkinterrrrrrrr r r r r tkinter.ttkrrrtkinter.messageboxridlelib.colorizerrrr/rGrhrrr#unittestridlelib.idle_test.htestrr rrs;;;;;;;;;;;;;;;;;;;;;;;;;;0000000000((((((******NNNNN NNN&& & & & & %& & & RB********Z P P P PCI0 zD *aeDDDD++++++C OOOOO r