
    G@d                     n    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dS )    N)get_module_data_path)is_dark_interfacec                   $    e Zd ZdZd Zd Zd ZdS )ImagePathManagerz)Manager of the image path in the project.c                 j    i | _         |                     t          dd                     d| _        dS )z)Initialize main path with all the images.spyderimages)relpath	not_foundN)IMG_PATHadd_image_pathr   default)selfs    ?lib/python3.11/site-packages/spyder/utils/image_path_manager.py__init__zImagePathManager.__init__   s6    08LLLMMM"    c                    t          j        |          sdS t          j        |          D ]\  }}}t	                      rt          j        |          dk    r-t	                      st          j        |          dk    rT|D ]}|                    d          rt          j        t          j        |                    \  }}t          j        ||          }|| j	        v rt          j        d| d|            || j	        |<   dS )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   s4   y 	F')wt}} 	4 	4#GR "" s|G'<'<'G'G&(( S\'-B-Bf-L-L& 	4 	4&&s++ <X(>(>??b #( ; ;4=((M/} / /(,/ /0 0 0 '4d##	4	4 	4r   c                     	 | j         |         }t          j        |          rt          j        |          S dS # 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   sy    	<d+Iz)$$ .{9---. . 	< 	< 	<;t}T\:;;;;;	<s   49 .A*)A*N)__name__
__module____qualname____doc__r   r   r-    r   r   r   r      sG        33# # #4 4 4*< < < < <r   r   c                 6    t                               |           S )zReturn absolute image path.)IMAGE_PATH_MANAGERr-   )r&   s    r   r-   r-   ?   s    ,,T222r   )r   os.pathr!   r   r   spyder.config.baser   spyder.config.guir   r   r4   r-   r2   r   r   <module>r8      s    
			        4 3 3 3 3 3 / / / / / /$< $< $< $< $< $< $< $<N &%'' 3 3 3 3 3r   