a
    §ˆc»  ã                   @   sj   d dl Z d dlmZ d dlmZmZmZmZmZ d dlm	Z	 d dl
mZmZ eeƒG dd„ deeƒƒZdS )é    N)ÚQtGui)ÚAnyÚ	HasTraitsÚListÚPropertyÚprovides)ÚStr)ÚIImageResourceÚMImageResourcec                   @   sJ   e Zd ZdZeƒ ZeeƒZeƒ Z	e
ƒ ZejZd	dd„Zdd„ Zdd„ ZdS )
ÚImageResourcez The toolkit specific implementation of an ImageResource.  See the
    IImageResource interface for the API documentation.
    Nc                 C   s.   |   |¡}|d ur| ¡ }n|  ¡ }t |¡S ©N)Ú_get_refÚloadZ_get_image_not_found_imager   ZQIcon)ÚselfÚsizeÚrefÚimage© r   ú_/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/pyface/ui/qt4/image_resource.pyÚcreate_icon6   s
    

zImageResource.create_iconc                 C   s   |  ¡ }| ¡ | ¡ fS )a   Get the size of a toolkit image

        Parameters
        ----------
        image : toolkit image
            A toolkit image to compute the size of.

        Returns
        -------
        size : tuple
            The (width, height) tuple giving the size of the image.
        )r   ÚwidthÚheight)Úclsr   r   r   r   r   Ú
image_size@   s    zImageResource.image_sizec                 C   s0   |   ¡ }|d ur"tj | jj¡}n
|  ¡ j}|S r   )r   ÚosÚpathÚabspathÚ_refÚfilenameZ_get_image_not_foundÚabsolute_path)r   r   r   r   r   r   Ú_get_absolute_pathT   s
    
z ImageResource._get_absolute_path)N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   Únamer   Úsearch_pathr
   Zcreate_imageZcreate_bitmapr   r   r    r   r   r   r   r      s   

r   )r   Z	pyface.qtr   Z
traits.apir   r   r   r   r   r   Zpyface.i_image_resourcer	   r
   r   r   r   r   r   Ú<module>   s   