Your IP : 18.221.236.28
�
��f�c@s~dZddlZddlZdd�ZGdd�d�Zedkrzdd �Zeje�Ze d
e
e��ndS(u:Simple textbox editing widget with Emacs-like keybindings.iNcCs�|j|d|tj||d�|j||dtj||d�|j||dtj||d�|j|d|tj||d�|j||tj�|j||tj�|j||tj�|j||tj �dS(u^Draw a rectangle with corners at the provided upper-left
and lower-right coordinates.
iN(
uvlineucursesu ACS_VLINEuhlineu ACS_HLINEuaddchuACS_ULCORNERuACS_URCORNERuACS_LRCORNERuACS_LLCORNER(uwinuulyuulxulryulrx((u3/opt/alt/python33/lib64/python3.3/curses/textpad.pyu rectangles%%%%u rectanglecBsh|EeZdZdZddd�Zdd�Zdd�Zdd �Zd
d�Z ddd
�ZdS(uTextboxudEditing widget using the interior of a window object.
Supports the following Emacs-like key bindings:
Ctrl-A Go to left edge of window.
Ctrl-B Cursor left, wrapping to previous line if appropriate.
Ctrl-D Delete character under cursor.
Ctrl-E Go to right edge (stripspaces off) or end of line (stripspaces on).
Ctrl-F Cursor right, wrapping to next line when appropriate.
Ctrl-G Terminate, returning the window contents.
Ctrl-H Delete character backward.
Ctrl-J Terminate if the window is 1 line, otherwise insert newline.
Ctrl-K If line is blank, delete it, otherwise clear to end of line.
Ctrl-L Refresh screen.
Ctrl-N Cursor down; move down one line.
Ctrl-O Insert a blank line at cursor location.
Ctrl-P Cursor up; move up one line.
Move operations do nothing if the cursor is at an edge where the movement
is not possible. The following synonyms are supported where possible:
KEY_LEFT = Ctrl-B, KEY_RIGHT = Ctrl-F, KEY_UP = Ctrl-P, KEY_DOWN = Ctrl-N
KEY_BACKSPACE = Ctrl-h
cCsm||_||_|j�\|_|_|jd|_|jd|_d|_d|_|jd�dS(Ni( uwinuinsert_modeugetmaxyxumaxyumaxxustripspacesuNoneulastcmdukeypad(uselfuwinuinsert_mode((u3/opt/alt/python33/lib64/python3.3/curses/textpad.pyu__init__+s uTextbox.__init__cCst|j}xdtjj|jj||��tjjkrSt|j|d�}Pn|dkrcPn|d}q|S(uuGo to the location of the first blank on the given line,
returning the index of the last non-blank character.ii(umaxxucursesuasciiuwinuinchuSPumin(uselfuyulast((u3/opt/alt/python33/lib64/python3.3/curses/textpad.pyu_end_of_line5s -
uTextbox._end_of_linecCs�|jj�\}}||jks3||jkr�|jrN|jj�}ny|jj|�Wntjk
ryYnX|jr�|jj�\}}tj j
|�r�|j|�|jj||�q�q�ndS(N(
uwinugetyxumaxyumaxxuinsert_modeuinchuaddchucursesuerroruasciiuisprintu_insert_printable_charumove(uselfuchuyuxuoldchubackyubackx((u3/opt/alt/python33/lib64/python3.3/curses/textpad.pyu_insert_printable_charBs
uTextbox._insert_printable_charcCse|jj�\}}||_tjj|�ra||jksN||jkra|j|�qan|tjj kr�|jj
|d�n�|tjjtjtjj
tjfkr`|dkr�|jj
||d�nY|dkr�nJ|jr|jj
|d|j|d��n|jj
|d|j�|tjj
tjfkra|jj�qan|tjjkr�|jj�n�|tjjkr�|jr�|jj
||j|��qa|jj
||j�n�|tjjtjfkrE||jkr|jj
||d�qa||jkr+qa|jj
|dd�n|tjjkr[dS|tjjkr�|jdkr�dS||jkra|jj
|dd�qan�|tjjkr|dkr�|j|�dkr�|jj�qa|jj
||�|jj�nO|tjjkr4|jj�n-|tjjtjfkr�||jkra|jj
|d|�||j|d�kr�|jj
|d|j|d��q�qan�|tjjkr�|jj �n�|tjj!tj"fkra|dkra|jj
|d|�||j|d�kr^|jj
|d|j|d��q^qandS(u!Process a single editing command.ii(#uwinugetyxulastcmducursesuasciiuisprintumaxyumaxxu_insert_printable_charuSOHumoveuSTXuKEY_LEFTuBSu
KEY_BACKSPACEustripspacesu_end_of_lineudelchuEOTuENQuACKu KEY_RIGHTuBELuNLuVTudeletelnuclrtoeoluFFurefreshuSOuKEY_DOWNuSIuinsertlnuDLEuKEY_UP(uselfuchuyux((u3/opt/alt/python33/lib64/python3.3/curses/textpad.pyu
do_commandTsp * ' !--uTextbox.do_commandc
Cs�d}x�t|jd�D]�}|jj|d�|j|�}|dkr]|jr]qnx_t|jd�D]J}|jr�||kr�Pn|ttj j |jj
||���}qqW|jdkr|d}qqW|S(u.Collect and return the contents of the window.uiiu
(urangeumaxyuwinumoveu_end_of_lineustripspacesumaxxuchrucursesuasciiuinch(uselfuresultuyustopux((u3/opt/alt/python33/lib64/python3.3/curses/textpad.pyugather�s/uTextbox.gathercCs`xS|jj�}|r'||�}n|s3qn|j|�sFPn|jj�q|j�S(u2Edit in the widget window and collect the results.(uwinugetchu
do_commandurefreshugather(uselfuvalidateuch((u3/opt/alt/python33/lib64/python3.3/curses/textpad.pyuedit�suTextbox.editNF(u__name__u
__module__u__qualname__u__doc__uFalseu__init__u_end_of_lineu_insert_printable_charu
do_commandugatheruNoneuedit(u
__locals__((u3/opt/alt/python33/lib64/python3.3/curses/textpad.pyuTextboxs
@uTextboxu__main__cCs�d\}}d \}}|j|d|d�tj||||�}t||d|d||||�|j�t|�j�S(
Ni iiiiuUse Ctrl-G to end editing.i(i i(ii(uaddstrucursesunewwinu rectangleurefreshuTextboxuedit(ustdscruncolsunlinesuulyuulxuwin((u3/opt/alt/python33/lib64/python3.3/curses/textpad.pyutest_editbox�s&
utest_editboxuContents of text box:(u__doc__ucursesucurses.asciiu rectangleuTextboxu__name__utest_editboxuwrapperustruprinturepr(((u3/opt/alt/python33/lib64/python3.3/curses/textpad.pyu<module>s
�
?>