HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //usr/lib/python3/dist-packages/twisted/conch/insults/__pycache__/client.cpython-38.pyc
U


W[��@s2dZddlmZddlmZGdd�dej�ZdS)zC
You don't really want to use this module. Try insults.py instead.
�)�print_function)�protocolc@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd S)!�
InsultsClientg�������?cCs(d|_|_d|_|_g|_d|_dS)Nr�)�width�height�xpos�ypos�commandQueue�inEscape��self�r�>/usr/lib/python3/dist-packages/twisted/conch/insults/client.py�__init__
szInsultsClient.__init__cCs*d}|jrd}||_||_|r&|��dS)Nr�)rr�windowSizeChanged)r
rr�callrrr�setSizeszInsultsClient.setSizecCs�ddlm}|D]�}|dkrN|jr4|�|�d|_q�||_|�|j|j�|_q|dkr�|jr�d|_|j��|dkr�|�d�q�|dkr�|�d	�q�|d
kr�|�d�q�|dkr�|�d
�q|jr�|j|7_q|�|�qdS)Nr)�reactor�rZABCD�Az<Up>�Bz<Down>�Cz<Right>�Dz<Left>)	�twisted.internetrr�keyReceivedZ	callLater�
escapeTimeout�	endEscapeZ
escapeCallZcancel)r
�datar�chrrr�dataReceiveds0
�
zInsultsClient.dataReceivedcCs|j}d|_|�|�dS)Nr)rr�r
r rrrr7szInsultsClient.endEscapecCs|j�d�dS)Nz=[?1h)�	transport�writerrrr�
initScreen<szInsultsClient.initScreencCs"||_||_|j�d||f�dS)z(Go to a position on the screen.
        �gotoxyN)rr	r
�append)r
�x�yrrr�gotoXY?szInsultsClient.gotoXYcCs2|j|jdkr.|j�d|f�|jd7_dS)zdWrite a character to the screen.  If we're at the end of the row,
        ignore the write.
        rr$N)rrr
r'r"rrr�writeChFszInsultsClient.writeChcCsn|d|j|j�}d|kr.|d|�d��}d|krH|d|�d��}|j�d|f�|jt|�7_dS)ztWrite a string to the screen.  This does not wrap a the edge of the
        screen, and stops at \r and \n.
        N�
�
r$)rr�findr
r'�len)r
�srrr�writeStrNszInsultsClient.writeStrcCs|j�d�dS)z@Erase from the current position to the end of the line.
        )�eraseeolN�r
r'rrrr�eraseToLineZszInsultsClient.eraseToLinecCs|j�d�dS)zBErase from the current position to the end of the screen.
        )�eraseeosNr3rrrr�
eraseToScreen_szInsultsClient.eraseToScreencCsdg|_d|_|_dS)z9Clear the screen, and return the cursor to 0, 0.
        )�clsrN)r
rr	rrrr�clearScreendszInsultsClient.clearScreencGs|j�d|f�dS)z6Set the attributes for drawing on the screen.
        �
attributesNr3)r
Zattrsrrr�
setAttributesjszInsultsClient.setAttributesc	Cs�d}|jD]�}|ddkr<|d|dd|ddf7}q
|ddkrV||d7}q
|ddkrl|d	7}q
|dd
kr�|d7}q
|ddkr�|d
7}q
|ddkr�|dd�tt|d��7}q
t|�q
g|_|j�|�dS)zRedraw the screen.
        rrr&z[%i;%iH�rr$r2zr5zJr7zr9z[%sm�;N)r
�join�map�str�printr#r$)r
ZredrawZcommandrrr�refreshos"
"



zInsultsClient.refreshcCsdS)zpCalled when the size of the window changes.
        Might want to redraw the screen here, or something.
        Nrrrrrr�szInsultsClient.windowSizeChangedcCsdS)z)Called when the user hits a key.
        Nr)r
�keyrrrr�szInsultsClient.keyReceivedN)�__name__�
__module__�__qualname__rrrr!rr%r*r+r1r4r6r8r:rArrrrrrr	s 	rN)�__doc__Z
__future__rrrZProtocolrrrrr�<module>s