a
    ø£Beà  ã                   @   sd   d dl Z d dlmZmZmZmZmZmZmZ d dl	m
Z
 d dlmZ d dlmZ G dd„ deƒZdS )é    N)Ú	HasTraitsÚDictÚUnicodeÚListÚBoolÚobserveÚdefault)Újupyter_path)Ú_i18n)Úurl_path_joinc                       s^  e Zd Zeddedƒd�Zededƒd�Zededƒd�Zedddd�Z	e
dƒd	d
„ ƒZeeƒ ddd�Zedd„ ƒZeeƒ edƒd�Zedƒdd„ ƒZeeƒ dedƒd�Zedd„ ƒZeeƒ dedƒd�Zedd„ ƒZedddd�Ze‡ fdd„ƒZedƒdd„ ƒZe
dƒd d!„ ƒZed"ded#ƒd�Ze
d$ƒd%d&„ ƒZeddd'd�Zei ded(ƒd�Z‡  Z S ))ÚNotebookAppTraitsFTzXDeprecated: Use minified JS file or not, mainly use during dev to avoid JS recompilation)ÚconfigÚhelpz@Supply extra arguments that will be passed to Jinja environment.z<Extra variables to supply to jinja templates when rendering.ak  Whether to enable MathJax for typesetting math/TeX

        MathJax is the javascript library Jupyter uses to render math/LaTeX. It is
        very large, so you may want to disable it if you have a slow internet
        connection, or for offline use of the notebook.

        When disabled, equations etc. will appear as their untransformed TeX source.
        Úenable_mathjaxc                 C   s   |d sd| _ dS )z/set mathjax url to empty if mathjax is disabledÚnewÚ N)Úmathjax_url©ÚselfÚchange© r   úW/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/notebook_shim/traits.pyÚ_update_enable_mathjax'   s    z(NotebookAppTraits._update_enable_mathjaxzÂExtra paths to search for serving static files.

        This allows adding javascript/css to be available from the notebook server machine,
        or overriding individual files in the IPythonc                 C   s   | j S )z)return extra paths + the default location)Úextra_static_paths©r   r   r   r   Ústatic_file_path4   s    z"NotebookAppTraits.static_file_pathz!Path to search for custom.js, css)r   Ústatic_custom_pathc                 C   s   t j | jd¡gS )NZcustom)ÚosÚpathÚjoinZ
config_dirr   r   r   r   Ú_default_static_custom_path>   s    ÿz-NotebookAppTraits._default_static_custom_pathzvExtra paths to search for serving jinja templates.

        Can be used to override templates from notebook.templates.c                 C   s   | j S )z*return extra paths + the default locations)Úextra_template_pathsr   r   r   r   Útemplate_file_pathJ   s    z$NotebookAppTraits.template_file_pathz6extra paths to look for Javascript notebook extensionsc                 C   sL   | j tdƒ }zddlm} W n ty0   Y n0 | tj |ƒ d¡¡ |S )z3The path to look for Javascript notebook extensionsZnbextensionsr   )Úget_ipython_dir)	Úextra_nbextensions_pathr	   ZIPython.pathsr#   ÚImportErrorÚappendr   r   r   )r   r   r#   r   r   r   Únbextensions_pathT   s    z#NotebookAppTraits.nbextensions_pathr   z£A custom url for MathJax.js.
        Should be in the form of a case-sensitive url to MathJax,
        for example:  /static/components/MathJax/MathJax.js
        c                    s   t t| ƒjS )z3Get the static url prefix for serving static files.)Úsuperr   Ústatic_url_prefixr   ©Ú	__class__r   r   r)   h   s    z#NotebookAppTraits.static_url_prefixr   c                 C   s   | j s
dS | j}t|dddƒS )Nr   Ú
componentsZMathJaxz
MathJax.js)r   r)   r   )r   r)   r   r   r   Ú_default_mathjax_urlm   s    z&NotebookAppTraits._default_mathjax_urlc                 C   s0   |d }|r| j sd| _n| j tdƒ|¡ d S )Nr   r   zUsing MathJax: %s)r   r   ÚlogÚinfor
   )r   r   r   r   r   r   Ú_update_mathjax_urlt   s    
z%NotebookAppTraits._update_mathjax_urlzTeX-AMS-MML_HTMLorMML-full,Safez5The MathJax.js configuration file that is to be used.Úmathjax_configc                 C   s   | j  tdƒ|d ¡ d S )Nz$Using MathJax configuration file: %sr   )r.   r/   r
   r   r   r   r   Ú_update_mathjax_config‚   s    ÿz(NotebookAppTraits._update_mathjax_configzZIf True, display a button in the dashboard to quit
        (shutdown the notebook server).z¾Dict of Python modules to load as notebook server extensions.Entry values can be used to enable and disable the loading ofthe extensions. The extensions will be loaded in alphabetical order.)!Ú__name__Ú
__module__Ú__qualname__r   r
   Zignore_minified_jsr   Zjinja_environment_optionsZjinja_template_varsr   r   r   r   r   r   Úpropertyr   r   r   r    r!   r"   r$   r'   r   r)   r-   r0   r1   r2   Zquit_buttonZnbserver_extensionsÚ__classcell__r   r   r*   r   r      s„   ÿþÿÿþÿ
ÿ
ÿÿ
ÿ
ÿÿ
ÿ

ÿÿ
ÿÿr   )r   Z	traitletsr   r   r   r   r   r   r   Zjupyter_core.pathsr	   Zjupyter_server.transutilsr
   Zjupyter_server.utilsr   r   r   r   r   r   Ú<module>   s
   $