^c@s9dZddlTddlZdZdddYZdS(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 dZd dZd dZd dZd dZd dZd dZ dZ dZ RS( c CsB||_|j}t|dd}|_|jd|j|jd|jd|jd|j |jd|j |jd|j|jd|jt |d t d |j d d d |j dddddd|_ |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 jt|_|jj|j d d!t|_|jj|j d"d!t|d#d$d%|jd td&|j|_ |j jd't!d(t"t#|} |_$| jg|_%d)} xVd6D]N} t&| d#| }|j'd-| d.d!d/t(|j%j)|| d07} qWd0}xPd7D]H} t&| d#| }|j'd-d0d.||j%j)||d07}qEWg|_*xd8D]}xd9D]~} | d4kr|d0krqnt+| d%|jd5| d)d)|d0d&|j,}|j'd-| d.||j*j)|qWqW|jdS(:Ntclass_tPynchetWM_DELETE_WINDOWsPynche Text Windowsssstrelieft backgroundtTEXTBGtblackt foregroundtTEXTFGtwhitetwidthi#theightitTEXT_SFGtselectforegroundtTEXT_SBGtselectbackgroundtTEXT_IBGtinsertbackgroundgtTEXTsInsert 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|jjdS(N(R'tquit(RQtevent((s7/usr/lib64/python2.7/site-packages/pynche/TextViewer.pyt__quitvscCs|jjdS(N(R'R)(RQR`((s7/usr/lib64/python2.7/site-packages/pynche/TextViewer.pyR)yscCs|jjdS(N(R't deiconify(RQR`((s7/usr/lib64/python2.7/site-packages/pynche/TextViewer.pyRb|scCs|jjdS(N(R$tupdate_views_current(RQR`((s7/usr/lib64/python2.7/site-packages/pynche/TextViewer.pyt __forceupdatescCs|jjr)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 __toggletrackscCs|jj}|j}|dkr1|d}nd|dkrJ|d}nK|dkrc|d}n2|dkr||d}n|d kr|d }nytj|\}}}Wn5tjk r|jjj|\}}}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_colors"           %cCs|jjrtj|||f}|jj}|j}|dkr^|jd|q|dkr}|jd|q|dkr|jd|q|dkr|jd|q|d kr|jd |qndS( NiR iRiRiRiR(R=R0Rkttriplet_to_rrggbbR@R1R2(RQRsRtRut colornameRqR((s7/usr/lib64/python2.7/site-packages/pynche/TextViewer.pytupdate_yourselfs      cCs|jj|d<|jj|d<|jjdd|d<|jjtdd!|d<|jjt|d <|jd |d <|jd |d <|jd|d<|jd|d<|jd|ds