a
    Df                     @   s8   d Z ddlmZ dZdd Zdd Zdd	 Zd
d ZdS )zf
This module contains functionality to make any Panel component look
like it is loading and disabled.
   )configz
pn-loadingc                    s0    j s| _ n fdd|D } j |  _ d S )Nc                    s   g | ]}| j vr|qS  css_classes.0Z	css_classitemr   ]/nfs/NAS7/SABIOD/METHODE/ermites/ermites_venv/lib/python3.9/site-packages/panel/io/loading.py
<listcomp>   s   
z$_add_css_classes.<locals>.<listcomp>r   )r	   r   Znew_classesr   r   r
   _add_css_classes
   s    r   c                    s$   | j s
d S  fdd| j D | _ d S )Nc                    s   g | ]}| vr|qS r   r   r   r   r   r
   r      s   z'_remove_css_classes.<locals>.<listcomp>r   )r	   r   r   r   r
   _remove_css_classes   s    r   c                  G   s2   t dtj g}| D ]}t|drt|| qdS )a  
    Changes the appearance of the specified panel objects to indicate
    that they are loading.

    This is done by

    * adding a small spinner on top
    * graying out the panel
    * disabling the panel
    * and changing the mouse cursor to a spinner when hovering over the panel

    Arguments
    ---------
    objects: tuple
        The panels to add the loading indicator to.
    pn-r   N)LOADING_INDICATOR_CSS_CLASSr   loading_spinnerhasattrr   Zobjectsr   r	   r   r   r
   start_loading_spinner   s    
r   c                  G   s2   t dtj g}| D ]}t|drt|| qdS )z
    Removes the loading indicating from the specified panel objects.

    Arguments
    ---------
    objects: tuple
        The panels to remove the loading indicator from.
    r   r   N)r   r   r   r   r   r   r   r   r
   stop_loading_spinner0   s    	
r   N)__doc__r   r   r   r   r   r   r   r   r   r
   <module>   s   	