3
7ßL]}
  ã               @   sH   d Z ddlmZmZmZ ddlmZ G dd„ deƒZG dd„ deƒZdS )	z Resource references. é    )ÚAnyÚ	HasTraitsÚInstance)ÚResourceFactoryc               @   s    e Zd ZdZeeƒZdd„ ZdS )ÚResourceReferencez— Abstract base class for resource references.

    Resource references are returned from calls to 'locate_reference' on the
    resource manager.

    c             C   s   t ‚dS )z Loads the resource. N)ÚNotImplementedError)Úself© r	   úF/tmp/pip-install-5sebvq2j/pyface/pyface/resource/resource_reference.pyÚload'   s    zResourceReference.loadN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   Úresource_factoryr   r	   r	   r	   r
   r      s   r   c               @   s*   e Zd ZdZeZeZddd„Zdd„ ZdS )ÚImageReferencez# A reference to an image resource. Nc             C   s   || _ || _|| _dS )z  Creates a new image reference. N)r   ÚfilenameÚdata)r   r   r   r   r	   r	   r
   Ú__init__8   s    zImageReference.__init__c             C   s@   | j dk	r| jj| j ƒ}n"| jdk	r4| jj| jƒ}ntdƒ‚|S )z Loads the resource. Nz'Image reference has no filename OR data)r   r   Zimage_from_filer   Zimage_from_dataÚ
ValueError)r   Úimager	   r	   r
   r   E   s    

zImageReference.load)NN)	r   r   r   r   r   r   r   r   r   r	   r	   r	   r
   r   -   s
   
r   N)	r   Z
traits.apir   r   r   Z pyface.resource.resource_factoryr   r   r   r	   r	   r	   r
   Ú<module>   s   