ó <×ï[c@sddlmZddlmZddlZddlZejjdkr]ddlm Z nddl m Z gZ dd„Z dd„Zd efd „ƒYZejd krÓd efd „ƒYZe eƒnÞejdkrdefd„ƒYZe eƒn¬d„Zdefd„ƒYZdefd„ƒYZedƒrSe eƒndefd„ƒYZedƒr‚e eƒndefd„ƒYZedƒr±e eƒnedkreejƒdkréedƒejƒneeejejdƒejdŒƒndS( iÿÿÿÿ(tprint_function(tImageNi(tquoteicCsryt|tƒr|ƒ}nWntk r2nX|dkrOtj|ƒn|dkrntjd|ƒndS(Ni(t issubclasstViewert TypeErrort_viewerstappendtinsert(tviewertorder((s-/tmp/pip-build-SKekGm/pillow/PIL/ImageShow.pytregisters   cKs1x*tD]"}|j|d||rdSqWdS(s 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. ttitleii(Rtshow(timageR toptionsR ((s-/tmp/pip-build-SKekGm/pillow/PIL/ImageShow.pyR )s RcBsPeZdZd„ZdZiZd„Zd„Zd„Z d„Z d„Z RS(sBase class for viewers.cKs}|jd dkrd}ntj|jƒ}||jkrm|jdkrm|jdkrm|j|ƒ}n|j||S(NisI;16tLt1tRGBA(tmodeRt getmodebasetconvertt show_image(tselfRRtbase((s-/tmp/pip-build-SKekGm/pillow/PIL/ImageShow.pyR =s  -cCs|jS(s.Return format name, or None to save as PGM/PPM(tformat(RR((s-/tmp/pip-build-SKekGm/pillow/PIL/ImageShow.pyt get_formatRscKs t‚dS(N(tNotImplementedError(RtfileR((s-/tmp/pip-build-SKekGm/pillow/PIL/ImageShow.pyt get_commandVscCs|jd|j|ƒ|jS(s+Save to temporary file, and return filenameR(t_dumpRR(RR((s-/tmp/pip-build-SKekGm/pillow/PIL/ImageShow.pyt save_imageYscKs|j|j|ƒ|S(sDisplay given image(t show_fileR(RRR((s-/tmp/pip-build-SKekGm/pillow/PIL/ImageShow.pyR]scKstj|j||ƒdS(sDisplay given filei(tostsystemR(RRR((s-/tmp/pip-build-SKekGm/pillow/PIL/ImageShow.pyR asN( t__name__t __module__t__doc__R tNoneRRRRRRR (((s-/tmp/pip-build-SKekGm/pillow/PIL/ImageShow.pyR8s     twin32t WindowsViewercBseZdZd„ZRS(tBMPcKsd||fS(NsDstart "Pillow" /WAIT "%s" && ping -n 2 127.0.0.1 >NUL && del /f "%s"((RRR((s-/tmp/pip-build-SKekGm/pillow/PIL/ImageShow.pyRns(R#R$RR(((s-/tmp/pip-build-SKekGm/pillow/PIL/ImageShow.pyR(kstdarwint MacViewercBs$eZdZidd6Zd„ZRS(tPNGitcompress_levelcKs)d}d|t|ƒt|ƒf}|S(Ns!open -a /Applications/Preview.apps(%s %s; sleep 20; rm -f %s)&(R(RRRtcommand((s-/tmp/pip-build-SKekGm/pillow/PIL/ImageShow.pyR{s(R#R$RRR(((s-/tmp/pip-build-SKekGm/pillow/PIL/ImageShow.pyR+ws cCs}tjjdƒ}|sdSxZ|jtjƒD]F}tjj||ƒ}tjj|ƒr/tj |tj ƒr/|Sq/WdS(NtPATH( R!tenvirontgetR&tsplittpathseptpathtjointisfiletaccesstX_OK(t executableR4tdirnametfilename((s-/tmp/pip-build-SKekGm/pillow/PIL/ImageShow.pytwhich‰s't UnixViewercBs$eZdZidd6Zd„ZRS(R,iR-cKsH|j||\}}d|t|ƒt|ƒf}tj|ƒdS(Ns(%s %s; rm -f %s)&i(tget_command_exRR!R"(RRRR.R9((s-/tmp/pip-build-SKekGm/pillow/PIL/ImageShow.pyR —s  (R#R$RRR (((s-/tmp/pip-build-SKekGm/pillow/PIL/ImageShow.pyR=“s t DisplayViewercBseZd„ZRS(cKsd}}||fS(Ntdisplay((RRRR.R9((s-/tmp/pip-build-SKekGm/pillow/PIL/ImageShow.pyR>¡s (R#R$R>(((s-/tmp/pip-build-SKekGm/pillow/PIL/ImageShow.pyR? sR@t EogViewercBseZd„ZRS(cKsd}}||fS(Nteog((RRRR.R9((s-/tmp/pip-build-SKekGm/pillow/PIL/ImageShow.pyR>©s (R#R$R>(((s-/tmp/pip-build-SKekGm/pillow/PIL/ImageShow.pyRA¨sRBtXVViewercBseZdd„ZRS(cKs1d}}|r'|dt|ƒ7}n||fS(Ntxvs -name %s(R(RRR RR.R9((s-/tmp/pip-build-SKekGm/pillow/PIL/ImageShow.pyR>±s N(R#R$R&R>(((s-/tmp/pip-build-SKekGm/pillow/PIL/ImageShow.pyRC°sRDt__main__is-Syntax: python ImageShow.py imagefile [title](t __future__RtPILRR!tsyst version_infotmajortshlexRtpipesRR R&R tobjectRtplatformR(R+R<R=R?RARCR#tlentargvtprinttexittopen(((s-/tmp/pip-build-SKekGm/pillow/PIL/ImageShow.pyts@   1