Your IP : 3.145.108.87


Current Path : /opt/alt/python310/lib64/python3.10/curses/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/curses/__pycache__/textpad.cpython-310.opt-2.pyc

o

6��f��@sX	ddlZddlZdd�ZGdd�d�Zedkr*dd�Ze�e�Zed	e	e��dSdS)
�NcCs�	|�|d|tj||d�|�||dtj||d�|�||dtj||d�|�|d|tj||d�|�||tj�|�||tj�|�||tj�|�||tj	�dS�N�)
Zvline�cursesZ	ACS_VLINEZhlineZ	ACS_HLINE�addchZACS_ULCORNERZACS_URCORNERZACS_LRCORNERZACS_LLCORNER)�win�uly�ulxZlryZlrx�r	�5/opt/alt/python310/lib64/python3.10/curses/textpad.py�	rectanglesrc@sJeZdZ	ddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zddd�Z	dS)�TextboxFcCs.||_||_|��d|_d|_|�d�dSr)r�insert_mode�_update_max_yx�stripspaces�lastcmdZkeypad)�selfrr
r	r	r
�__init__+szTextbox.__init__cCs&|j��\}}|d|_|d|_dSr)rZgetmaxyx�maxy�maxx)rrrr	r	r
r3s
zTextbox._update_max_yxcCs^	|��|j}	tj�|j�||��tjjkr#t|j|d�}	|S|dkr*	|S|d}q	)NTrr)rrr�asciir�inchZSP�min)r�yZlastr	r	r
�_end_of_line8s���zTextbox._end_of_linecCs�|��|j��\}}d}||jks||jkrW|jr|j��}z|j�|�Wn
tj	y1Ynw|jr;tj
�|�s<n|}|j��\}}|durM||f}||jks||jks|durc|jj|�dSdS�N)
rr�getyxrrr
rrr�errorr�isprint�move)r�chr�xZbackyxZoldchr	r	r
�_insert_printable_charFs*
���zTextbox._insert_printable_charcCsR	|��|j��\}}||_tj�|�r&||jks||jkr$|�	|�dS|tjj
kr5|j�|d�dS|tjjtj
tjjtjfvr�|dkrQ|j�||d�n!|dkrVn|jrh|j�|d|�|d��n
|j�|d|j�|tjjtjfvr�|j��dS|tjjkr�|j��dS|tjjkr�|jr�|j�||�|��dS|j�||j�dS|tjjtjfvr�||jkr�|j�||d�dS||jkr�	dS|j�|dd�dS|tjjkr�dS|tjjkr�|jdkr�dS||jkr�|j�|dd�dS|tjjk�r(|dk�r|�|�dk�r|j��dS|j�||�|j��dS|tjjk�r6|j��dS|tjjtjfv�ri||jk�rg|j�|d|�||�|d�k�rg|j�|d|�|d��dS|tjj k�rw|j�!�dS|tjj"tj#fv�r�|dk�r�|j�|d|�||�|d�k�r�|j�|d|�|d��dS)Nrr)$rrrrrrrrrr!ZSOHrZSTXZKEY_LEFTZBSZ
KEY_BACKSPACErrZdelchZEOTZENQZACKZ	KEY_RIGHTZBEL�NLZVTZdeletelnZclrtoeolZFF�refreshZSOZKEY_DOWNZSIZinsertlnZDLEZKEY_UP)rrrr r	r	r
�
do_command_s�
8�6�
+�
)�&�$�
!
���

�
�
�

��
�
zTextbox.do_commandc
Cs�	d}|��t|jd�D]A}|j�|d�|�|�}|dkr$|jr$qt|jd�D]}|jr6||kr6n|tt	j
�
|j�||���}q+|jdkrO|d}q|S)N�rr�
)r�rangerrrrrr�chrrrr)r�resultr�stopr r	r	r
�gather�s 
 
�zTextbox.gatherNcCs@		|j��}|r
||�}|sq|�|�s	|��S|j��qr)rZgetchr$r#r+)rZvalidaterr	r	r
�edit�s


��zTextbox.edit)Fr)
�__name__�
__module__�__qualname__rrrr!r$r+r,r	r	r	r
rs
Ar�__main__cCsfd\}}d\}}|�|d|d�t�||||�}t||d|d||||�|��t|���S)N)�	�)���zUse Ctrl-G to end editing.r)ZaddstrrZnewwinrr#rr,)ZstdscrZncolsZnlinesrrrr	r	r
�test_editbox�s r6zContents of text box:)
rZcurses.asciirrr-r6�wrapper�str�print�reprr	r	r	r
�<module>s
,
	�

?>