3
7ßL]ù
  ã               @   sJ   d dl mZ d dlmZmZ d dlmZmZ eeƒG dd„ deeƒƒZdS )é    )ÚQtGui)Ú	HasTraitsÚprovides)ÚIImageCacheÚMImageCachec               @   s,   e Zd ZdZdd„ Zdd„ ZeZdd„ ZdS )	Ú
ImageCachezy The toolkit specific implementation of an ImageCache.  See the
    IImageCache interface for the API documentation.
    c             C   s   || _ || _d S )N)Ú_widthÚ_height)ÚselfÚwidthÚheight© r   ú=/tmp/pip-install-5sebvq2j/pyface/pyface/ui/qt4/image_cache.pyÚ__init__#   s    zImageCache.__init__c             C   sh   t jj|ƒ}|d k	rB| j|ƒ}||k	rdt jj|ƒ t jj||ƒ n"t j|ƒ}| j|ƒ}t jj||ƒ |S )N)r   ZQPixmapCacheÚfindÚ
_qt4_scaleÚremoveÚinsertZQPixmap)r
   ÚfilenameÚimageÚscaledr   r   r   Ú	get_image+   s    


zImageCache.get_imagec             C   s0   |j ƒ | jks|jƒ | jkr,|j| j| jƒ}|S )z& Scales the given image if necessary. )r   r   r   r	   r   )r
   r   r   r   r   r   E   s    zImageCache._qt4_scaleN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   Z
get_bitmapr   r   r   r   r   r      s
   r   N)	Z	pyface.qtr   Z
traits.apir   r   Zpyface.i_image_cacher   r   r   r   r   r   r   Ú<module>   s   