ó
È4ec           @   sw   d  d l  Z  d d l m Z m Z d Z d „  Z d e j f d „  ƒ  YZ e j e j	 e e ƒ e j
 e j	 d ƒ d S(	   iÿÿÿÿNi   (   t   Imaget   TiffImagePlugins   0.1c         C   s   |  d  t  j k S(   Ni   (   t   olefilet   MAGIC(   t   prefix(    (    s<   /usr/local/lib/python2.7/dist-packages/PIL/MicImagePlugin.pyt   _accept!   s    t   MicImageFilec           B   s\   e  Z d  Z d Z e Z d „  Z e d „  ƒ Z e d „  ƒ Z	 d „  Z
 d „  Z d „  Z RS(   t   MICs   Microsoft Image Composerc         C   sÿ   y t  j |  j ƒ |  _ Wn t k
 r8 t d ƒ ‚ n Xg  |  _ xX |  j j ƒ  D]G } | d rR | d d d k rR | d d k rR |  j j | ƒ qR qR W|  j sµ t d ƒ ‚ n  |  j |  _	 d  |  _ t |  j ƒ d k rî t j |  _ n  |  j d ƒ d  S(   Ns!   not an MIC file; invalid OLE filei   i    iüÿÿÿs   .ACIR    s!   not an MIC file; no image entries(   R   t	   OleFileIOt   fpt   olet   IOErrort   SyntaxErrort   imagest   listdirt   appendt   _MicImageFile__fpt   Nonet   framet   lenR    t	   CONTAINERt   categoryt   seek(   t   selft   path(    (    s<   /usr/local/lib/python2.7/dist-packages/PIL/MicImagePlugin.pyt   _open/   s    	.		c         C   s   t  |  j ƒ S(   N(   R   R   (   R   (    (    s<   /usr/local/lib/python2.7/dist-packages/PIL/MicImagePlugin.pyt   n_framesN   s    c         C   s   t  |  j ƒ d k S(   Ni   (   R   R   (   R   (    (    s<   /usr/local/lib/python2.7/dist-packages/PIL/MicImagePlugin.pyt   is_animatedR   s    c         C   sv   |  j  | ƒ s d  Sy |  j | } Wn t k
 rC t d ƒ ‚ n X|  j j | ƒ |  _ t j j	 |  ƒ | |  _
 d  S(   Ns   no such frame(   t   _seek_checkR   t
   IndexErrort   EOFErrorR
   t
   openstreamR	   R   t   TiffImageFileR   R   (   R   R   t   filename(    (    s<   /usr/local/lib/python2.7/dist-packages/PIL/MicImagePlugin.pyR   V   s    c         C   s   |  j  S(   N(   R   (   R   (    (    s<   /usr/local/lib/python2.7/dist-packages/PIL/MicImagePlugin.pyt   telld   s    c         C   sO   z> y& |  j  |  j k r( |  j  j ƒ  n  Wn t k
 r< n XWd  d  |  _  Xd  S(   N(   R   R	   t   closet   AttributeErrorR   (   R   (    (    s<   /usr/local/lib/python2.7/dist-packages/PIL/MicImagePlugin.pyt
   _close__fpg   s     (   t   __name__t
   __module__t   formatt   format_descriptiont   Falset!   _close_exclusive_fp_after_loadingR   t   propertyR   R   R   R"   R%   (    (    (    s<   /usr/local/lib/python2.7/dist-packages/PIL/MicImagePlugin.pyR   )   s   			s   .mic(   R   t    R    R   t   __version__R   R    R   t   register_openR(   t   register_extension(    (    (    s<   /usr/local/lib/python2.7/dist-packages/PIL/MicImagePlugin.pyt   <module>   s   	K