Your IP : 3.136.19.136


Current Path : /opt/alt/python35/lib64/python3.5/curses/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/curses/__pycache__/textpad.cpython-35.opt-2.pyc



���]��@suddlZddlZdd�ZGdd�d�Zedkrqdd�Zeje�Zed	e	e��dS)
�NcCs�|j|d|tj||d�|j||dtj||d�|j||dtj||d�|j|d|tj||d�|j||tj�|j||tj�|j||tj�|j||tj	�dS)N�)
Zvline�cursesZ	ACS_VLINEZhlineZ	ACS_HLINE�addchZACS_ULCORNERZACS_URCORNERZACS_LRCORNERZACS_LLCORNER)�win�uly�ulxZlryZlrx�r�,/opt/alt/python35/lib64/python3.5/textpad.py�	rectangles%%%%r
c@sjeZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zddd�Z	dS)�TextboxFcCs?||_||_|j�d|_d|_|jd�dS)Nr)r�insert_mode�_update_max_yx�stripspaces�lastcmdZkeypad)�selfrrrrr	�__init__+s		
		zTextbox.__init__cCs3|jj�\}}|d|_|d|_dS)Nr)rZgetmaxyx�maxy�maxx)rrrrrr	r
3s
zTextbox._update_max_yxcCs||j�|j}xbtjj|jj||��tjjkr]t|j|d�}Pn
|dkrjP|d}qW|S)Nrr)r
rr�asciir�inchZSP�min)r�yZlastrrr	�_end_of_line8s
	-zTextbox._end_of_linecCs�|j�|jj�\}}d}x�||jksF||jkr�|jr^|jj�}y|jj|�Wntj	k
r�YnX|js�tj
j|�r�P|}|jj�\}}|dkr(||f}q(W|dk	r�|jj|�dS)N)
r
r�getyxrrrrrr�errorr�isprint�move)r�chr�xZbackyxZoldchrrr	�_insert_printable_charFs$
!	zTextbox._insert_printable_charcCsW|j�|jj�\}}||_tjj|�rh||jksX||jkrS|j	|�n�|tjj
kr�|jj|d�n�|tjjtj
tjjtjfkrd|dkr�|jj||d�nY|dkr�nJ|jr|jj|d|j|d��n|jj|d|j�|tjjtjfkrS|jj�n�|tjjkr�|jj�n�|tjjkr�|jr�|jj||j|��qS|jj||j�nz|tjjtjfkrI||jkr|jj||d�qS||jkr/qS|jj|dd�n
|tjjkr_dS|tjjkr�|jdkr�dS||jkrS|jj|dd�n�|tjjkr|dkr�|j|�dkr�|jj�qS|jj||�|jj�n@|tjjkr5|jj�n|tjjtjfkr�||jkrS|jj|d|�||j|d�krS|jj|d|j|d��n�|tjj kr�|jj!�n{|tjj"tj#fkrS|dkrS|jj|d|�||j|d�krS|jj|d|j|d��dS)Nrr)$r
rrrrrrrrrZSOHrZSTXZKEY_LEFTZBSZ
KEY_BACKSPACErrZdelchZEOTZENQZACKZ	KEY_RIGHTZBEL�NLZVTZdeletelnZclrtoeolZFF�refresh�SOZKEY_DOWNZSIZinsertlnZDLEZKEY_UP)rrrrrrr	�
do_command_sr
	*	'	!'$zTextbox.do_commandcCs�d}|j�x�t|jd�D]�}|jj|d�|j|�}|dkrd|jrdq$x\t|jd�D]G}|jr�||kr�P|tt	j
j
|jj||���}qxW|jdkr$|d}q$W|S)N�rr�
)r
�rangerrrrrr�chrrrr)r�resultr�stoprrrr	�gather�s
/zTextbox.gatherNcCsXxK|jj�}|r$||�}|s-q|j|�s=P|jj�qW|j�S)N)rZgetchr#r!r*)rZvalidaterrrr	�edit�szTextbox.edit)
�__name__�
__module__�__qualname__rr
rrr#r*r+rrrr	rsAr�__main__cCs�d\}}d	\}}|j|d|d�tj||||�}t||d|d||||�|j�t|�j�S)
N�	����zUse Ctrl-G to end editing.r)r0r1)r2r3)ZaddstrrZnewwinr
r!rr+)ZstdscrZncolsZnlinesrrrrrr	�test_editbox�s&
r5zContents of text box:)
rZcurses.asciir
rr,r5�wrapper�str�print�reprrrrr	�<module>s
�	

?>