§
    œ"²c˜,  ã            	       ó:  — d dl Z d dlZd dlZd dlZd dlmZ d dlmZ ddlm	Z	 g Z
d(d„Zd)d„Z G d„ d	¦  «        Z G d
„ de¦  «        Zej        dk    r ee¦  «          G d„ de¦  «        Zej        dk    r ee¦  «          G d„ de¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Zej        dvr‡ ej        d¦  «        r ee¦  «          ej        d¦  «        r ee¦  «          ej        d¦  «        r ee¦  «          ej        d ¦  «        r ee¦  «          ej        d!¦  «        r ee¦  «          G d"„ d#e¦  «        Z	 d d$lmZ  ee¦  «         n# e$ r Y nw xY wed%k    rƒ eej        ¦  «        d&k     r e d'¦  «          ej!        ¦   «           ej"        ej        d         ¦  «        5 Z# e  ee#gej        d&d…         ¢R Ž ¦  «         ddd¦  «         dS # 1 swxY w Y   dS dS )*é    N©Úquote)ÚImageé   )Ú	deprecatec                 óâ   — 	 t          | t          ¦  «        r
 | ¦   «         } n# t          $ r Y nw xY w|dk    rt                               | ¦  «         dS t                               d| ¦  «         dS )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.
    r   N)Ú
issubclassÚViewerÚ	TypeErrorÚ_viewersÚappendÚinsert)ÚviewerÚorders     ú//usr/lib/python3/dist-packages/PIL/ImageShow.pyÚregisterr      s€   € ðÝ�f�fÑ%Ô%ð 	Ø�V‘X”XˆFøøÝð ð ð Øˆðøøøàˆq‚y€yÝ�Š˜ÑÔÐÐÐå�Š˜˜6Ñ"Ô"Ð"Ð"Ð"s   ‚" ¢
/®/c                 ó@   — t           D ]} |j        | fd|i|¤Žr dS ŒdS )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   Úoptionsr   s       r   r   r   4   sE   € õ ð ð ˆØˆ6Œ;�uÐ5Ð5 EÐ5¨WÐ5Ð5ð 	Ø�4�4ð	àˆ5ó    c                   óD   — e Zd ZdZd„ ZdZ	 i Z	 d„ Zd„ Zd„ Z	d„ Z
d	d„ZdS )
r
   zBase class for viewers.c                 óÊ   — |j         dv sM| j        dk    r	|j         dv s9t          j        |j         ¦  «        }|j         |k    r|                     |¦  «        } | j        |fi |¤ŽS )zƒ
        The main function for displaying an image.
        Converts the given image to the target format and displays it.
        )Ú1ÚRGBAÚPNG)zI;16ÚLA)ÚmodeÚformatr   ÚgetmodebaseÚconvertÚ
show_image)Úselfr   r   Úbases       r   r   zViewer.showH   st   € ð ŒJ˜-Ð'Ð'Ø”˜uÒ$Ð$¨¬°~Ð)EÐ)EåÔ$ U¤ZÑ0Ô0ˆDØŒz˜TÒ!Ð!ØŸš dÑ+Ô+�àˆtŒ˜uÐ0Ð0¨Ð0Ð0Ð0r   Nc                 ó   — | j         S )z3Return format name, or ``None`` to save as PGM/PPM.)r    ©r$   r   s     r   Ú
get_formatzViewer.get_format_   s
   € àŒ{Ðr   c                 ó   — t           ‚)zj
        Returns the command used to display the file.
        Not implemented in the base class.
        )ÚNotImplementedError©r$   Úfiler   s      r   Úget_commandzViewer.get_commandc   s
   € õ
 "Ð!r   c                 óP   —  |j         dd|                      |¦  «        i| j        ¤ŽS )z+Save to temporary file and return filename.r    © )Ú_dumpr(   r   r'   s     r   Ú
save_imagezViewer.save_imagej   s-   € àˆuŒ{ÐIÐI $§/¢/°%Ñ"8Ô"8ÐI¸D¼LÐIÐIÐIr   c                 óD   —  | j         |                      |¦  «        fi |¤ŽS )zDisplay the given image.)Ú	show_filer1   ©r$   r   r   s      r   r#   zViewer.show_imagen   s(   € àˆtŒ~˜dŸošo¨eÑ4Ô4Ð@Ð@¸Ð@Ð@Ð@r   c                 óÂ   — |€<d|v r't          ddd¦  «         |                     d¦  «        }nd}t          |¦  «        ‚t          j         | j        |fi |¤Ž¦  «         dS )úà
        Display given file.

        Before Pillow 9.1.0, the first argument was ``file``. This is now deprecated,
        and will be removed in Pillow 10.0.0 (2023-07-01). ``path`` should be used
        instead.
        Nr,   úThe 'file' argumenté
   ú'path'ú!Missing required argument: 'path'r   )r   Úpopr   ÚosÚsystemr-   ©r$   Úpathr   Úmsgs       r   r3   zViewer.show_filer   sv   € ð ˆ<Ø˜Ð Ð ÝÐ/°°XÑ>Ô>Ð>Ø—{’{ 6Ñ*Ô*��à9�Ý ‘n”nÐ$Ý
Œ	Ð"�$Ô" 4Ð3Ð3¨7Ð3Ð3Ñ4Ô4Ð4Øˆqr   ©N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r    r   r(   r-   r1   r#   r3   r/   r   r   r
   r
   C   s‘   € € € € € Ø!Ð!ð1ð 1ð 1ð$ €FØ/Ø€GØ7ðð ð ð"ð "ð "ðJð Jð JðAð Að Aðð ð ð ð ð r   r
   c                   ó&   — e Zd ZdZdZdddœZd„ ZdS )ÚWindowsViewerzNThe default viewer on Windows is the default system application for PNG files.r   r   T©Úcompress_levelÚsave_allc                 ó   — d|› d|› d�S )Nzstart "Pillow" /WAIT "z)" && ping -n 4 127.0.0.1 >NUL && del /f "ú"r/   r+   s      r   r-   zWindowsViewer.get_commandŽ   s*   € ð" Tð "ð "àð"ð "ð "ð	
r   N)rB   rC   rD   rE   r    r   r-   r/   r   r   rG   rG   ˆ   s;   € € € € € ØXÐXà€FØ!"°Ð5Ð5€Gð
ð 
ð 
ð 
ð 
r   rG   Úwin32c                   ó.   — e Zd ZdZdZdddœZd„ Zd	d„ZdS )
Ú	MacViewerz2The default viewer on macOS using ``Preview.app``.r   r   TrH   c                 óV   — d}d|› dt          |¦  «        › dt          |¦  «        › d�}|S )Nzopen -a Preview.appú(ú z; sleep 20; rm -f z)&r   ©r$   r,   r   Úcommands       r   r-   zMacViewer.get_command    s:   € ð (ˆØN�gÐNÐN¥ d¡¤ÐNÐN½uÀT¹{¼{ÐNÐNÐNˆØˆr   Nc                 ó&  — |€<d|v r't          ddd¦  «         |                     d¦  «        }nd}t          |¦  «        ‚t          j        ddd	|g¦  «         t
          j        pt          j        d
¦  «        }|rt          j	        |dd|g¦  «         dS )r6   Nr,   r7   r8   r9   r:   Úopenz-azPreview.appÚpython3z-cz<import os, sys, time; time.sleep(20); os.remove(sys.argv[1])r   )
r   r;   r   Ú
subprocessÚcallÚsysÚ
executableÚshutilÚwhichÚPopen)r$   r?   r   r@   r[   s        r   r3   zMacViewer.show_file§   s¯   € ð ˆ<Ø˜Ð Ð ÝÐ/°°XÑ>Ô>Ð>Ø—{’{ 6Ñ*Ô*��à9�Ý ‘n”nÐ$ÝŒ˜  }°dÐ;Ñ<Ô<Ð<Ý”^Ð>¥v¤|°IÑ'>Ô'>ˆ
Øð 	ÝÔàØØRØð	ñô ð ð ˆqr   rA   )rB   rC   rD   rE   r    r   r-   r3   r/   r   r   rO   rO   š   sO   € € € € € Ø<Ð<à€FØ!"°Ð5Ð5€Gðð ð ðð ð ð ð ð r   rO   Údarwinc                   ó"   — e Zd ZdZdddœZd„ ZdS )Ú
UnixViewerr   r   TrH   c                 óT   —  | j         |fi |¤Žd         }d|› dt          |¦  «        › �S )Nr   rQ   rR   )Úget_command_exr   rS   s       r   r-   zUnixViewer.get_commandÌ   s=   € Ø%�$Ô% dÐ6Ð6¨gÐ6Ð6°qÔ9ˆØ*�7Ð*Ð*�U 4™[œ[Ð*Ð*Ð*r   N)rB   rC   rD   r    r   r-   r/   r   r   ra   ra   È   s5   € € € € € Ø€FØ!"°Ð5Ð5€Gð+ð +ð +ð +ð +r   ra   c                   ó    — e Zd ZdZd„ Zdd„ZdS )Ú	XDGViewerz3
    The freedesktop.org ``xdg-open`` command.
    c                 ó   — dx}}||fS )Núxdg-openr/   )r$   r,   r   rT   r[   s        r   rc   zXDGViewer.get_command_exÖ   s   € Ø)Ð)ˆ�*Ø˜
Ð"Ð"r   Nc                 ó®   — |€<d|v r't          ddd¦  «         |                     d¦  «        }nd}t          |¦  «        ‚t          j        d|g¦  «         dS )	r6   Nr,   r7   r8   r9   r:   rg   r   ©r   r;   r   rX   r^   r>   s       r   r3   zXDGViewer.show_fileÚ   sf   € ð ˆ<Ø˜Ð Ð ÝÐ/°°XÑ>Ô>Ð>Ø—{’{ 6Ñ*Ô*��à9�Ý ‘n”nÐ$ÝÔ˜* dÐ+Ñ,Ô,Ð,Øˆqr   rA   ©rB   rC   rD   rE   rc   r3   r/   r   r   re   re   Ñ   sA   € € € € € ðð ð#ð #ð #ðð ð ð ð ð r   re   c                   ó"   — e Zd ZdZdd„Zdd„ZdS )ÚDisplayViewerz`
    The ImageMagick ``display`` command.
    This viewer supports the ``title`` parameter.
    Nc                 ó@   — dx}}|r|dt          |¦  «        › �z  }||fS )NÚdisplayz -title r   ©r$   r,   r   r   rT   r[   s         r   rc   zDisplayViewer.get_command_exó   s8   € Ø(Ð(ˆ�*Øð 	1ØÐ0¥%¨¡,¤,Ð0Ð0Ñ0ˆGØ˜
Ð"Ð"r   c                 ó  — |€<d|v r't          ddd¦  «         |                     d¦  «        }nd}t          |¦  «        ‚dg}|                     d¦  «        }|r|d	|gz  }|                     |¦  «         t          j        |¦  «         d
S )ú©
        Display given file.

        Before Pillow 9.1.0, the first argument was ``file``. This is now deprecated,
        and ``path`` should be used instead.
        Nr,   r7   r8   r9   r:   rn   r   z-titler   ©r   r;   r   Úgetr   rX   r^   ©r$   r?   r   r@   Úargsr   s         r   r3   zDisplayViewer.show_fileù   s¢   € ð ˆ<Ø˜Ð Ð ÝÐ/°°XÑ>Ô>Ð>Ø—{’{ 6Ñ*Ô*��à9�Ý ‘n”nÐ$Øˆ{ˆØ—’˜GÑ$Ô$ˆØð 	&Ø�X˜uÐ%Ñ%ˆDØ�Š�DÑÔÐåÔ˜ÑÔÐØˆqr   rA   rj   r/   r   r   rl   rl   í   sF   € € € € € ðð ð
#ð #ð #ð #ðð ð ð ð ð r   rl   c                   ó    — e Zd ZdZd„ Zdd„ZdS )ÚGmDisplayViewerz*The GraphicsMagick ``gm display`` command.c                 ó   — d}d}||fS )NÚgmz
gm displayr/   ©r$   r,   r   r[   rT   s        r   rc   zGmDisplayViewer.get_command_ex  s   € Øˆ
ØˆØ˜
Ð"Ð"r   Nc                 ó°   — |€<d|v r't          ddd¦  «         |                     d¦  «        }nd}t          |¦  «        ‚t          j        dd|g¦  «         d	S )
rq   Nr,   r7   r8   r9   r:   ry   rn   r   ri   r>   s       r   r3   zGmDisplayViewer.show_file  sh   € ð ˆ<Ø˜Ð Ð ÝÐ/°°XÑ>Ô>Ð>Ø—{’{ 6Ñ*Ô*��à9�Ý ‘n”nÐ$ÝÔ˜$ 	¨4Ð0Ñ1Ô1Ð1Øˆqr   rA   rj   r/   r   r   rw   rw     s=   € € € € € Ø4Ð4ð#ð #ð #ð
ð ð ð ð ð r   rw   c                   ó    — e Zd ZdZd„ Zdd„ZdS )Ú	EogViewerz'The GNOME Image Viewer ``eog`` command.c                 ó   — d}d}||fS )NÚeogzeog -nr/   rz   s        r   rc   zEogViewer.get_command_ex.  s   € Øˆ
ØˆØ˜
Ð"Ð"r   Nc                 ó°   — |€<d|v r't          ddd¦  «         |                     d¦  «        }nd}t          |¦  «        ‚t          j        dd|g¦  «         d	S )
rq   Nr,   r7   r8   r9   r:   r   z-nr   ri   r>   s       r   r3   zEogViewer.show_file3  sh   € ð ˆ<Ø˜Ð Ð ÝÐ/°°XÑ>Ô>Ð>Ø—{’{ 6Ñ*Ô*��à9�Ý ‘n”nÐ$ÝÔ˜%  tÐ,Ñ-Ô-Ð-Øˆqr   rA   rj   r/   r   r   r}   r}   +  s=   € € € € € Ø1Ð1ð#ð #ð #ð
ð ð ð ð ð r   r}   c                   ó"   — e Zd ZdZdd„Zdd„ZdS )ÚXVViewerzX
    The X Viewer ``xv`` command.
    This viewer supports the ``title`` parameter.
    Nc                 ó@   — dx}}|r|dt          |¦  «        › �z  }||fS )NÚxvz -name r   ro   s         r   rc   zXVViewer.get_command_exK  s:   € ð  $Ð#ˆ�*Øð 	0ØÐ/¥ u¡¤Ð/Ð/Ñ/ˆGØ˜
Ð"Ð"r   c                 ó  — |€<d|v r't          ddd¦  «         |                     d¦  «        }nd}t          |¦  «        ‚dg}|                     d¦  «        }|r|d	|gz  }|                     |¦  «         t          j        |¦  «         d
S )rq   Nr,   r7   r8   r9   r:   r„   r   z-namer   rr   rt   s         r   r3   zXVViewer.show_fileS  s¢   € ð ˆ<Ø˜Ð Ð ÝÐ/°°XÑ>Ô>Ð>Ø—{’{ 6Ñ*Ô*��à9�Ý ‘n”nÐ$ØˆvˆØ—’˜GÑ$Ô$ˆØð 	%Ø�W˜eÐ$Ñ$ˆDØ�Š�DÑÔÐåÔ˜ÑÔÐØˆqr   rA   rj   r/   r   r   r‚   r‚   E  sF   € € € € € ðð ð
#ð #ð #ð #ðð ð ð ð ð r   r‚   )rM   r_   rg   rn   ry   r   r„   c                   ó   — e Zd ZdZd„ ZdS )ÚIPythonViewerz!The viewer for IPython frontends.c                 ó$   — t          |¦  «         dS )Nr   )Úipython_displayr4   s      r   r#   zIPythonViewer.show_image{  s   € Ý˜ÑÔÐØˆqr   N)rB   rC   rD   rE   r#   r/   r   r   r‡   r‡   x  s)   € € € € € Ø+Ð+ðð ð ð ð r   r‡   )rn   Ú__main__é   z.Syntax: python3 ImageShow.py imagefile [title])r   rA   )$r<   r\   rX   rZ   Úshlexr   ÚPILr   Ú
_deprecater   r   r   r   r
   rG   ÚplatformrO   ra   re   rl   rw   r}   r‚   r]   r‡   ÚIPython.displayrn   r‰   ÚImportErrorrB   ÚlenÚargvÚprintÚexitrV   Úimr/   r   r   ú<module>r—      st  ðð 
€	€	€	Ø €€€Ø Ð Ð Ð Ø 
€
€
€
Ø Ð Ð Ð Ð Ð à Ð Ð Ð Ð Ð à !Ð !Ð !Ð !Ð !Ð !à€ð#ð #ð #ð #ð2ð ð ð ð?ð ?ð ?ð ?ð ?ñ ?ô ?ð ?ðJ
ð 
ð 
ð 
ð 
�Fñ 
ô 
ð 
ð „<�7ÒÐØ€Hˆ]ÑÔÐð'ð 'ð 'ð 'ð '�ñ 'ô 'ð 'ðT „<�8ÒÐØ€HˆYÑÔÐð+ð +ð +ð +ð +�ñ +ô +ð +ðð ð ð ð �
ñ ô ð ð8!ð !ð !ð !ð !�Jñ !ô !ð !ðHð ð ð ð �jñ ô ð ð4ð ð ð ð �
ñ ô ð ð4#ð #ð #ð #ð #ˆzñ #ô #ð #ðL „<Ð*Ð*Ð*Ø€v„|�JÑÔð Øˆ�ÑÔÐØ€v„|�IÑÔð  Øˆ�ÑÔÐØ€v„|�DÑÔð "Øˆ�Ñ!Ô!Ð!Ø€v„|�EÑÔð Øˆ�ÑÔÐØ€v„|�DÑÔð Øˆ�ÑÔÐðð ð ð ð �Fñ ô ð ðØ:Ð:Ð:Ð:Ð:Ð:ð €Hˆ]ÑÔÐÐøð ð 	ð 	ð 	Ø€Dð	øøøð ˆzÒÐà
€sˆ3Œ8�}„}�qÒÐØˆÐ>Ñ?Ô?Ð?ØˆŒ‰
Œ
ˆ
à	ˆŒ�C”H˜Q”KÑ	 Ô	 ð ' BØˆˆdˆd�2Ð%˜œ   œÐ%Ð%Ð%Ñ&Ô&Ð&ð'ð 'ð 'ñ 'ô 'ð 'ð 'ð 'ð 'ð 'ð 'ð 'øøøð 'ð 'ð 'ð 'ð 'ð 'ð Ðs$   Å5F ÆFÆFÇ! HÈHÈH