a
    §ˆc…  ã                   @   sH   d Z ddlZddlZddlmZ ddlZddlmZ G dd„ deƒZdS )z$ Enthought pyface package component
é    N)ÚBytesIO)ÚResourceFactoryc                   @   s"   e Zd ZdZdd„ Zddd„ZdS )ÚPyfaceResourceFactoryz2 The implementation of a shared resource manager. c                 C   s   t  |t j¡S )z; Creates an image from the data in the specified filename. )ÚwxÚImageÚBITMAP_TYPE_ANY)ÚselfÚfilename© r
   ú`/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/pyface/ui/wx/resource_manager.pyÚimage_from_file"   s    z%PyfaceResourceFactory.image_from_fileNc                 C   sX   t  t|ƒ¡S t|dƒ}| |¡ | ¡  t  |t j¡}|durTt	 |¡ t	 
|¡ |S )z+ Creates an image from the specified data. NÚwb)r   r   r   ÚtempfileÚmkstempÚopenÚwriteÚcloser   ÚosÚunlink)r   Údatar	   ÚhandleÚtfÚimager
   r
   r   Úimage_from_data)   s       



z%PyfaceResourceFactory.image_from_data)N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r
   r
   r
   r   r      s   r   )	r   r   r   Úior   r   Zpyface.resource.apir   r   r
   r
   r
   r   Ú<module>   s   