3
7ßL]h  ã               @   s4   d dl mZmZmZ d dlmZ G dd„ deƒZdS )é    )ÚQtCoreÚQtGuiÚQtSvg)Ú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   sT   |j dƒrFtj|ƒ}tj|jƒ ƒ}|jtjj	ƒ tj
|ƒ}|j|ƒ n
tj|ƒ}|S )z; Creates an image from the data in the specified filename. ú.svgú.SVG)r   r   )Úendswithr   ZQSvgRendererr   ÚQPixmapZdefaultSizeÚfillr   ZQtZtransparentZQPainterÚrender)ÚselfÚfilenameZrendererZpixmapZpainter© r   úB/tmp/pip-install-5sebvq2j/pyface/pyface/ui/qt4/resource_manager.pyÚimage_from_file   s    



z%PyfaceResourceFactory.image_from_fileNc             C   s   t jƒ }|j|ƒ |S )z+ Creates an image from the specified data. )r   r
   ZloadFromData)r   Údatar   Ú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   N)Z	pyface.qtr   r   r   Zpyface.resource.apir   r   r   r   r   r   Ú<module>   s   