
    Je                     `    d dl Z d dlmZ d dlZd dlmZ d dlmZ  G d d      Z	 e	       Z
d Zy)    N)get_module_data_path)is_dark_interfacec                   "    e Zd ZdZd Zd Zd Zy)ImagePathManagerz)Manager of the image path in the project.c                 X    i | _         | j                  t        dd             d| _        y)z)Initialize main path with all the images.spyderimages)relpath	not_foundN)IMG_PATHadd_image_pathr   default)selfs    A/usr/lib/python3/dist-packages/spyder/utils/image_path_manager.py__init__zImagePathManager.__init__   s&    08LM"    c                    t        j                  |      syt        j                  |      D ]  \  }}}t	               rt        j
                  |      dk(  r*t	               st        j
                  |      dk(  rM|D ]  }|j                  d      rt        j                  t        j
                  |            \  }}t        j                  ||      }|| j                  v rt        j                  d| d|        || j                  |<     y)z Add path to the image path list.Nlightdark.zThe icon located in z is overriding the existing )ospisdiroswalkr   basename
startswithsplitextjoinr   warningswarn)r   pathdirpath__
_filenamesfilenamenamecomplete_paths           r   r   zImagePathManager.add_image_path   s    yy')wwt} 	4#GR "s||G'<'G&(S\\'-Bf-L& 	4&&s+<<X(>?b #( ;4==(MM.}o >((,v/0 '4d#	4	4r   c                     	 | j                   |   }t        j                  |      rt        j                  |      S y# t        $ r/ t        j                  | j                   | j
                           cY S w xY w)z%Get path of the image given its name.N)r   r   isfileabspathKeyErrorr   )r   r&   	act_images      r   get_image_pathzImagePathManager.get_image_path2   s`    	<d+Izz)${{9-- % 	<;;t}}T\\:;;	<s   8< 5A43A4N)__name__
__module____qualname____doc__r   r   r-    r   r   r   r      s    3#4*<r   r   c                 ,    t         j                  |       S )zReturn absolute image path.)IMAGE_PATH_MANAGERr-   )r&   s    r   r-   r-   ?   s    ,,T22r   )r   os.pathr!   r   r   spyder.config.baser   spyder.config.guir   r   r4   r-   r2   r   r   <module>r8      s3    
   4 /$< $<N &' 3r   