
    hVf                     8    d dl Z G d de      Z G d de      Zy)    Nc                   "    e Zd ZdZd Zd Zd Zy)	IconCachezzMaintain a cache of icons.  If an icon is used more than once by a GUI
    then ensure that only one copy is created.
    c                 <    || _         || _        d| _        g | _        y)zInitialise the cache. N)_object_factory_qtgui_module	_base_dir_cache)selfobject_factoryqtgui_modules      ]/var/www/html/software/conda/envs/catlas/lib/python3.12/site-packages/PyQt5/uic/icon_cache.py__init__zIconCache.__init__   s"      .)    c                     || _         y)z? Set the base directory to be used for all relative filenames. N)r	   )r   base_dirs     r   set_base_dirzIconCache.set_base_dir'   s     "r   c                    |j                   j                  d      }|9| j                  j                  dd| j                  j	                  |      fd      S |j
                  yt        || j                        }	 | j                  j                  |      }|dk\  r| j                  |   }|j                   S d}t        | j                        }|dkD  r|t        |      z  }| j                  j                  d	|d
d      }|j                  || j                         | j                  j                  |       |j                   S # t        $ r d}Y w xY w)z2Return an icon described by the given iconset tag.themeNzQIcon.fromThemeiconF)is_attributer   QIcon )attribgetr   createQObjectasStringtext_IconSetr	   r
   index
ValueErrorlenstrset_iconr   appendr   )r   iconsetr   isetidxnamer   s          r   get_iconzIconCache.get_icon,   sJ    ""7+''556GT11::5AD!& 6 ( (
 <<0	++##D)C !8;;s#D yy Ddkk"CQwC ''55gtR!& 6 (DMM$ 2 23KKt$yy'  	C	s   ;E EEN)__name__
__module____qualname____doc__r   r   r+   r   r   r   r   r      s    "
%r   r   c                   2    e Zd ZdZd Zed        Zd Zd Zy)r    zAAn icon set, ie. the mode and state and the pixmap used for each.c                     | j                  |j                  |      | _        d| _        i | _        |D ]B  }|j                  }|| j                  ||      }|| j                  |j
                  <   d| _        D d| _        y)z(Initialise the icon set from an XML tag.TNF)
_file_namer   	_fallback_use_fallback_rolestagr   )r   r'   r   i	file_names        r   r   z_IconSet.__init__W   s|     x@!  	'AI$ OOIx@	!*DKK!&D	' 	r   c                     | j                  dd      } |dk7  rG| d   dk7  r?t        j                  j                  |       s t        j                  j	                  ||       } | S )z: Convert a relative filename if we have a base directory. \z\\r   r   :)replaceospathisabsjoin)fnamer   s     r   r2   z_IconSet._file_namel   sM     dF+r>eAh#obggmmE6JGGLL51Er   c                 >   | j                   r#|j                  | j                         || _        y| j                  j	                         D ]  \  }}|j                  d      r|dd }|j                  j                  }n.|j                  d      r|dd }|j                  j                  }nat        |j                  |j                               }|r#|j                  |j                  |      ||       |j                  |j                         ||        || _        y)z%Save the icon and set its attributes.offNon)r4   addFiler3   r5   itemsendswithr   OffOngetattrtitle	addPixmapQPixmapr   )r   r   r   rolepixmapmodestates          r   r%   z_IconSet.set_iconw   s     LL(& 	# !% 1 1 3 Hf=='9D(..22E]]4(9D(..11E|114::<@NN<#7#7#?uMNN<#7#7#94GH" 	r   c                     t        |t        |             st        S | j                  r&|j                  r| j                  |j                  k(  S y|j                  ry| j
                  |j
                  k(  S )z#Compare two icon sets for equality.F)
isinstancetypeNotImplementedr4   r3   r5   )r   others     r   __eq__z_IconSet.__eq__   s_     %d,!!""~~88{{ell**r   N)	r,   r-   r.   r/   r   staticmethodr2   r%   rY   r   r   r   r    r    T   s(    K*  2+r   r    )os.pathr=   objectr   r    r   r   r   <module>r]      s%   . 7 7tK+v K+r   