HOME


Mini Shell 1.0
DIR: /snap/core20/2571/usr/share/subiquity/subiquitycore/__pycache__/
Upload File :
Current File : //snap/core20/2571/usr/share/subiquity/subiquitycore/__pycache__/screen.cpython-38.pyc
U

K��^��@s�ddlZddlZddlZddlZddlZddlZddlmZmZe�	d�Z
dZdZdZ
d\ZZZGdd	�d	ejj�ZGd
d�de�ZGdd
�d
e�Zdadd�Zddd�ZdS)�N)�COLORS�
urwid_8_nameszsubiquitycore.screeni3KipKiqK)���T� cs(eZdZ�fdd�Z�fdd�Z�ZS)�SubiquityScreencs<t���t�|tjj�|j��}t�	|�r8t
�|�dS�N)�super�start�urwid�emit_signal�display_common�INPUT_DESCRIPTORS_CHANGED�_term_input_file�fileno�os�isatty�ttyZsetraw)�self�fd��	__class__��,/usr/share/subiquity/subiquitycore/screen.pyr
8s



zSubiquityScreen.startcst���t�|tjj�dSr)r	�stoprrr
r�rrrrr@s
zSubiquityScreen.stop)�__name__�
__module__�__qualname__r
r�
__classcell__rrrrr$srcs4eZdZ�fdd�Z�fdd�Z�fdd�Z�ZS)�LinuxScreencs||_t�jf|�dSr)�_colorsr	�__init__�r�colors�kwargsrrrr"GszLinuxScreen.__init__cs�td�|_t�tj��t|j�|j��}t	d�D]0}t	d�D]"}|j
|d|||d|<q>q2t�|j��t|�t
���dS)N�0���)�	bytearray�curpal�fcntl�ioctl�sys�stdoutr�GIO_CMAP�copy�ranger!r�PIO_CMAPr	r
)rZnewpal�i�jrrrr
Ks

"zLinuxScreen.startcs$t�|j��t|j�t���dSr)r,r-rrr3r+r	rrrrrrUszLinuxScreen.stop)rrrr"r
rrrrrrr Es
r cs,eZdZ�fdd�Zdd�Zdd�Z�ZS)�TwentyFourBitScreencs*�fdd�tt�D�|_t�jf|�dS)Ncsi|]\}}|�|d�qS)r)r)�.0r4�n�r$rr�
<dictcomp>]sz0TwentyFourBitScreen.__init__.<locals>.<dictcomp>)�	enumerater�_urwid_name_to_rgbr	r"r#rr9rr"\s
�zTwentyFourBitScreen.__init__cCs8|dkrdS|dkrdS|dkr$dSdj|j|�SdS)	a0Return the "SGR" parameter for selecting color.

        See https://en.wikipedia.org/wiki/ANSI_escape_code#SGR for an
        explanation.  We use the basic codes for black/white/default for
        maximum compatibility; they are the only colors used when the
        mono palette is selected.
        Zwhite�7Zblack�0�default�9z8;2;{};{};{}N)�formatr<)rZcolorrrr�_ccaszTwentyFourBitScreen._cccCsd�|�|j�|�|j��S)Nz[0;3{};4{}m)rArBZ
foregroundZ
background)r�arrr�_attrspec_to_escapeus

�z'TwentyFourBitScreen._attrspec_to_escape)rrrr"rBrDrrrrrr6Zsr6c
Csttdkrpzt�tj��td�}Wn4tk
rT}zt�	d|�WY�dSd}~XYnXt�	d||dk�|dkatS)N� zKDGKBTYPE failed %rFz&KDGKBTYPE returned %r, is_linux_tty %s�)
�
_is_linux_ttyr,r-r.r/r�	KDGKBTYPE�IOError�log�debug)�r�errr�is_linux_tty~srNFcCsR|dkrtj}|dkrtj}t�r0tt||d�S|r@t||d�Stt||d�SdS)rEN)�input�output)r.�stdinr/rNr rrr6)�asciiZinputfZoutputfrrr�make_screen�srS)FNN)r,Zloggingrr.rrZsubiquitycore.paletterrZ	getLoggerrJrHr0r3ZUO_RZUO_GZUO_BZraw_displayZScreenrr r6rGrNrSrrrr�<module>s"

!!