ó f Qc@s9dZddlTddlZdZddd„ƒYZdS(s(TextViewer class. The TextViewer allows you to see how the selected color would affect various characteristics of a Tk text widget. This is an output viewer only. In the top part of the window is a standard text widget with some sample text in it. You are free to edit this text in any way you want (BAW: allow you to change font characteristics). If you want changes in other viewers to update text characteristics, turn on Track color changes. To select which characteristic tracks the change, select one of the radio buttons in the window below. Text foreground and background affect the text in the window above. The Selection is what you see when you click the middle button and drag it through some text. The Insertion is the insertion cursor in the text window (which only has a background). iÿÿÿÿ(t*NsText Window...t TextViewercBsneZd d„Zd d„Zd d„Zd d„Zd d„Zd d„Zd d„Z d„Z d„Z RS( c CsB||_|jƒ}t|ddƒ}|_|jd|jƒ|jdƒ|jdƒ|jd|j ƒ|jd|j ƒ|jd|jƒ|jd|jƒt |d t d |j d d ƒd |j ddƒddddƒ|_ |j dƒ}|r|j jd|ƒn|j dƒ}|rB|j jd|ƒn|j dƒ}|rm|j jd|ƒn|j jƒ|j jd|j ddƒƒ|j dƒ}|rÄ|j jt|ƒny8|j ddtfƒ\} } |j jt| | ƒWntk rnX|j jƒtƒ|_|jj|j d d!ƒƒtƒ|_|jj|j d"d!ƒƒt|d#d$d%|jd td&|jƒ|_ |j jd't!d(t"ƒt#|ƒ} |_$| jƒg|_%d)} xVd6D]N} t&| d#| ƒ}|j'd-| d.d!d/t(ƒ|j%j)|ƒ| d07} qæWd0}xPd7D]H} t&| d#| ƒ}|j'd-d0d.|ƒ|j%j)|ƒ|d07}qEWg|_*x—d8D]}x†d9D]~} | d4krÒ|d0krÒq®nt+| d%|jd5| d)d)|d0d&|j,ƒ}|j'd-| d.|ƒ|j*j)|ƒq®Wq¡W|jƒdS(:Ntclass_tPynchetWM_DELETE_WINDOWsPynche Text Windowsssstrelieft backgroundtTEXTBGtblackt foregroundtTEXTFGtwhitetwidthi#theightitTEXT_SFGtselectforegroundtTEXT_SBGtselectbackgroundtTEXT_IBGtinsertbackgroundgtTEXTsÄInsert some stuff here and play with the buttons below to see how the colors interact in textual displays. See how the selection can also be affected by tickling the buttons and choosing a color.tTEXTINStTEXTSELg@tTRACKPitWHICHttextsTrack color changestvariabletcommandtfilltexpandisText:s Selection:s Insertion:trowtcolumntstickyit Foregroundt Backgroundiitvalue(sText:s Selection:s Insertion:(R!R"(ii(iii(-t_TextViewer__sbtoptiondbtToplevelt_TextViewer__roottprotocoltwithdrawttitleticonnametbindt_TextViewer__quittTexttSUNKENtgett_TextViewer__textt configuretpacktinserttmark_settINSERTtENDttag_addtSELt ValueErrort focus_sett BooleanVart_TextViewer__trackptsettIntVart_TextViewer__whicht CheckbuttontGROOVEt_TextViewer__toggletrackt_TextViewer__ttXtYEStFramet_TextViewer__framet_TextViewer__labelstLabeltgridtEtappendt_TextViewer__radiost Radiobuttont_TextViewer__set_color(tselft switchboardtmasterR%troottsfgtsbgtibgR4tstarttendtframeRRtltcoltr((s7/usr/lib64/python2.7/site-packages/pynche/TextViewer.pyt__init__sŒ                   cCs|jjƒdS(N(R'tquit(RQtevent((s7/usr/lib64/python2.7/site-packages/pynche/TextViewer.pyt__quitvscCs|jjƒdS(N(R'R)(RQR`((s7/usr/lib64/python2.7/site-packages/pynche/TextViewer.pyR)yscCs|jjƒdS(N(R't deiconify(RQR`((s7/usr/lib64/python2.7/site-packages/pynche/TextViewer.pyRb|scCs|jjƒdS(N(R$tupdate_views_current(RQR`((s7/usr/lib64/python2.7/site-packages/pynche/TextViewer.pyt __forceupdatescCsŒ|jjƒr)t}|jdd}nt}|jdd}x!|jD]}|jd|ƒqJWx!|jD]}|jd|ƒqnWdS(NiR tdisabledforegroundtstate(R=R0tNORMALRNtDISABLEDR2RI(RQR`RftfgR]R[((s7/usr/lib64/python2.7/site-packages/pynche/TextViewer.pyt __toggletrack‚scCs|jjƒ}|j}|dkr1|d}nd|dkrJ|d}nK|dkrc|d}n2|dkr||d}n|d kr•|d }nytj|ƒ\}}}Wn5tjk rè|jjƒj|ƒ\}}}nX|jj |||ƒdS( NiR iRiRiRiR( R@R0R1tColorDBtrrggbb_to_triplettBadColorR$tcolordbt find_bynamet update_views(RQR`twhichRtcolortredtgreentblue((s7/usr/lib64/python2.7/site-packages/pynche/TextViewer.pyt __set_colorŽs"           %cCsá|jjƒrÝtj|||fƒ}|jjƒ}|j}|dkr^|jd|ƒqÝ|dkr}|jd|ƒqÝ|dkrœ|jd|ƒqÝ|dkr»|jd|ƒqÝ|d krÝ|jd |ƒqÝndS( NiR iRiRiRiR(R=R0Rkttriplet_to_rrggbbR@R1R2(RQRsRtRut colornameRqR((s7/usr/lib64/python2.7/site-packages/pynche/TextViewer.pytupdate_yourself¢s      cCsË|jjƒ|d<|jjƒ|d<|jjddƒ|d<|jjtƒdd!|d<|jjtƒ|d <|jd |d <|jd |d <|jd|d<|jd|d<|jd|ds