a
    §cÜ
  ć                   @   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   ś\/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/pyface/ui/qt4/image_cache.pyŚ__init__"   s    zImageCache.__init__c                 C   sh   t j |”}|d urB|  |”}||urdt j |” t j ||” n"t  |”}|  |”}t j ||” |S r   )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ks| ” | jkr,| | j| j”}|S )z& Scales the given image if necessary. )r   r	   r   r
   r   )r   r   r   r   r   r   D   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   