a
    §ˆcª‡  ã                   @   s¬  d Z ddlZddlZddlmZ ddlZddlZddlmZ ddlm	Z	m
Z
mZmZmZmZmZmZmZ ddlZddlZddlZddlZddlmZ ddlmZ ddlmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z& dd	l'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z:m;Z;m<Z<m=Z=m>Z> d
Z?dZ@dd„ ZAdd„ ZBdd„ ZCdkdd„ZDejEdd„ ƒZFG dd„ de*ƒZGeGƒ ZHG dd„ de!ƒZIG dd„ de!ƒZJG dd„ deJƒZKG d d!„ d!e9ƒZLG d"d#„ d#eLƒZMG d$d%„ d%eMƒZNd&ZOG d'd(„ d(eMƒZPG d)d*„ d*eMƒZQG d+d,„ d,eLƒZRe=e;d-d.e.d/d0d1�d2�d3d4d5�ZSe=e-e;d-d.e.d/d0d1�d2�e>e<e;d6d7d8�e,e5e;d9ƒd:d;�ƒe6e1d<d.e)d=d>d?�d@d=dA�e1dBe4d/dC�dDd=dE�e;dFd7d/dG�ƒdHdI�ƒdJeHd4dK�ZTe=e6e;d-d.e.d/d0d1�d2�ƒeHd4dL�ZUe8e3eRgdMeSdN�e3eNgdMeTdN�e3ePgdMeUdN�e3eQgdMeUdN�gdOdP�ZVe(dQedRƒdSdTdUdV�ZWe(dWedXƒdSdYdZdV�ZXe(d[ed\ƒdSd]d^dV�ZYG d_d`„ d`e2ƒZZdldadb„Z[dmdcdd„Z\dndedf„Z]dodjdF„Z^dS )paF   A Traits UI demo that borrows heavily from the design of the wxPython demo.

This copy of the demo application will only be maintained until ``ets-demo``
is released and distributed. This allows other ETS packages to continue to be
able to import the demo application until ``ets-demo`` is released.
(enthought/traitsui#950)
é    N)ÚStringIO)Úlistdir)	ÚabspathÚbasenameÚdirnameÚexistsÚisabsÚisdirÚjoinÚsplitÚsplitext)Ú	ConfigObj)ÚImageResource)ÚAnyÚBoolÚButtonÚcached_propertyÚCodeÚDictÚHasPrivateTraitsÚ	HasTraitsÚHTMLÚInstanceÚPropertyÚStr)ÚActionÚ
CodeEditorÚHandlerÚHeadingÚHGroupÚHSplitÚ
HTMLEditorÚIncludeÚInstanceEditorÚItemÚ	ModelViewÚObjectTreeNodeÚShellEditorÚspringÚTabbedÚToolBarÚ
TreeEditorÚTreeNodeObjectÚUIInfoÚUItemÚVGroupÚViewÚVSplitzfrom traits.api import *

z	index.rstc                 C   s(   |   dd¡} | d d…  ¡ | dd …  S )NÚ_ú é   )ÚreplaceÚupper)Úname© r8   ú_/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/traitsui/extras/_demo_legacy.pyÚuser_name_forg   s    r:   c                 C   s¾   t | ƒ}t |j¡}|D ]0\}}}}}tj| }|dkr|d dkr qVqd|  ¡ fS |  ¡ }	td 	|	|d d |d … ¡ƒ}
|	d|d d … |	|d d…  }	d 	|	¡} |  ¡ } |
| fS )a:  Return module docstring and source code from python source code.

    Parameters
    ----------
    source : Str
        Python source code.

    Returns
    -------
    docstring : str
        The first module-level string; i.e. the module docstring.
    source : str
        The source code, sans docstring.
    ÚSTRINGr4   r   Ú Ú
N)
r   ÚtokenizeÚgenerate_tokensÚreadlineÚtokenÚtok_nameÚstripÚ
splitlinesÚevalr
   )ÚsourceÚfZpython_tokensÚttypeZtstringZtstartÚtendZtlineZ
token_nameZsource_linesÚ	docstringr8   r8   r9   Úextract_docstring_from_sourcer   s    
"$
rK   c                 C   sH   zt | ƒ}t|ƒW S  tyB   t ¡ }d}| |¡}|df Y S 0 dS )zîReturn module docstring and source code from python source file.

    Returns
    -------
    docstring : str
        The first module-level string; i.e. the module docstring.
    source : str
        The source code, sans docstring.
    z Sorry, something went wrong.

{}r<   N)Ú
_read_filerK   Ú	ExceptionÚ	tracebackÚ
format_excÚformat)Ú	file_nameZsource_codeZtraceback_textÚ	error_fmtÚ	error_msgr8   r8   r9   Úparse_source˜   s    


rT   ÚrÚutf8c                 C   s:   t | ||d��}| ¡ }W d  ƒ n1 s,0    Y  |S )z.Returns the contents of a specified text file.©ÚencodingN)ÚopenÚread)ÚpathÚmoderX   ÚfhÚresultr8   r8   r9   rL   ®   s    &rL   c              	   c   sH   t jt j }}z$|  t _t _| V  W || t _t _n|| t _t _0 d S ©N)ÚsysÚstdoutÚstderr)Zstd_outra   rb   r8   r8   r9   Ú_set_stdoutº   s
    rc   c                   @   sL   e Zd Zeedƒdd�ZeeƒZdd„ Z	dd„ Z
dd	„ Zd
d„ Zdd„ ZdS )ÚDemoFileHandlerÚrunZRun)ÚimageÚlabelc                 C   s<   | j j}t| ƒ� | ¡  W d   ƒ n1 s.0    Y  d S r_   )ÚinfoÚobjectrc   Úrun_code)ÚselfÚ	demo_filer8   r8   r9   Ú_run_button_changedÐ   s    
z#DemoFileHandler._run_button_changedc                 C   s@   || _ |j}t| ƒ� | ¡  W d   ƒ n1 s20    Y  dS ©NT)rh   ri   rc   Úinit)rk   rh   rl   r8   r8   r9   ro   Õ   s
    
&zDemoFileHandler.initc                 C   s   |j }t|dƒrd|_dS )zCloses the view.ÚdemoN)ri   Úhasattrrp   )rk   rh   Zis_okrl   r8   r8   r9   ÚclosedÝ   s    
zDemoFileHandler.closedc                 C   s   | j j}| j|7  _d S r_   )rh   ri   Úlog)rk   Útextrl   r8   r8   r9   Úwriteç   s    zDemoFileHandler.writec                 C   s   d S r_   r8   ©rk   r8   r8   r9   Úflushë   s    zDemoFileHandler.flushN)Ú__name__Ú
__module__Ú__qualname__r   r   Z
run_buttonr   r-   rh   rm   ro   rr   ru   rw   r8   r8   r8   r9   rd   Ä   s   
rd   c                   @   s.   e Zd Zeƒ Zeeedƒedddd�ƒƒZ	dS )Ú	DemoErrorzError in source fileÚmsgÚcustomF)ÚstyleÚ
show_labelN)
rx   ry   rz   r   r|   r0   r/   r   r$   Útraits_viewr8   r8   r8   r9   r{   ó   s   þÿr{   c                   @   sR   e Zd ZeeƒZeddeddd�d�Ze	e
e
edƒdƒeeed	ƒeƒƒd
d�ZdS )Ú
DemoButtonrp   FúRun demo...Zlive©rg   Úkind©r   Úeditorz!Click the button to run the demo:Z20Ú	demo_itemT)Ú	resizableN)rx   ry   rz   r   r   rp   r$   r#   r‡   r0   r/   r   r   r(   r"   r€   r8   r8   r8   r9   r�     s   
ý
þûr�   c                   @   s"   e Zd Zeddeddd�d�ZdS )ÚModalDemoButtonrp   Fr‚   Úmodalrƒ   r…   N)rx   ry   rz   r$   r#   r‡   r8   r8   r8   r9   r‰   %  s
   
ýr‰   c                   @   sB   e Zd Zeƒ Zeƒ Zdd„ Zddd„Zdd„ Zdd	„ Z	d
d„ Z
dS )ÚDemoTreeNodeObjectc                 C   s   | j S )z:Returns whether chidren of this object are allowed or not.)Úallows_children©rk   Únoder8   r8   r9   Útno_allows_childrenC  s    z&DemoTreeNodeObject.tno_allows_childrenNc                 C   s   | j du r|  ¡ | _ | j S ©ú/Returns whether or not the object has children.N)Ú_has_childrenÚhas_childrenr�   r8   r8   r9   Útno_has_childrenK  s    

z#DemoTreeNodeObject.tno_has_childrenc                 C   s   | j du r|  ¡ | _ | j S ©úGets the object's children.N)Ú_get_childrenÚget_childrenr�   r8   r8   r9   Útno_get_childrenV  s    

z#DemoTreeNodeObject.tno_get_childrenc                 C   s   t ‚dS r�   ©ÚNotImplementedErrorr�   r8   r8   r9   r“   a  s    zDemoTreeNodeObject.has_childrenc                 C   s   t ‚dS r•   rš   rv   r8   r8   r9   r˜   i  s    zDemoTreeNodeObject.get_children)N)rx   ry   rz   r   r’   r—   r�   r”   r™   r“   r˜   r8   r8   r8   r9   r‹   3  s   
r‹   c                   @   sŒ   e Zd Zeƒ Zedd�Zeƒ Zeƒ Z	e
dƒZeƒ Zedd�ZedƒZeƒ Zeƒ Zdd„ Zdd	„ Zd
d„ Zdd„ Zdd„ Zdd„ Zdd„ ZdS )ÚDemoFileBaseúparent.path,name©ZobserveFr[   údefault.cssc                 C   s
   d| _ d S )Nr<   )rs   rv   r8   r8   r9   ro   Œ  s    zDemoFileBase.initc                 C   s   t | jj| jƒS r_   )r
   Úparentr[   r7   rv   r8   r8   r9   Ú	_get_path“  s    zDemoFileBase._get_pathc                 C   s    t | jƒr| j}n
t| jƒ}|S r_   ©r	   r[   r   ©rk   Úbase_dirr8   r8   r9   Ú_get_base_url–  s    

zDemoFileBase._get_base_urlc                 C   s$   | j st| jƒ\}}t|ƒ| _ | j S r_   )Ú
_nice_namer   r7   r:   )rk   r7   Úextr8   r8   r9   Ú_get_nice_name¡  s    
zDemoFileBase._get_nice_namec                 C   s   | j }|| _|  d||¡ d S ©NÚ	nice_name©rª   r¦   Ztrait_property_changed©rk   ÚvalueÚoldr8   r8   r9   Ú_set_nice_name§  s    zDemoFileBase._set_nice_namec                 C   s   dS )r‘   Fr8   rv   r8   r8   r9   r“   °  s    zDemoFileBase.has_childrenc                 C   s   g S )zGets the demo file's children.r8   rv   r8   r8   r9   r˜   ´  s    zDemoFileBase.get_childrenN)rx   ry   rz   r   r    r   r[   r   r7   rª   r   rŒ   r   ÚdescriptionÚbase_urlÚcss_filenamer   rs   r¦   ro   r¡   r¥   r¨   r¯   r“   r˜   r8   r8   r8   r9   rœ   n  s"   

	rœ   c                       sD   e Zd Zeƒ ZeeƒZee	e
ƒZ‡ fdd„Zdd„ Zdd„ Z‡  ZS )ÚDemoFilec                    s8   t ƒ  ¡  t| jƒ\}}t|| jƒ| _|| _|  ¡  d S r_   )	Úsuperro   rT   r[   Úpublish_html_strr²   r°   rF   rj   )rk   r°   rF   ©Ú	__class__r8   r9   ro   Ä  s
    
zDemoFile.initc                 C   s²   z†| j j}d|d< | j|d< | jtjd _t| j||ƒ |  d|¡}|durXt	|d�}n,|  d|¡}|durxt
|d�}n|  d	|¡}W n ty    t ¡  Y n0 || _|| _dS )
z-Runs the code associated with this demo file.Z
___main___rx   Ú__file__Ú__main__Zmodal_popupN)rp   Zpopuprp   )r    Úinit_dicr[   r`   Úmodulesr¸   ÚexecrF   Ú_get_objectr‰   r�   rM   rN   Ú	print_excrp   Úlocals)rk   r¿   rp   r8   r8   r9   rj   Ë  s"    
zDemoFile.run_codec                 C   s^   |  |¡p|  | ¡ ¡}|d urZtt|ƒtƒrLz
|ƒ }W n tyJ   Y n0 t|tƒrZ|S d S r_   )ÚgetÚ
capitalizeÚ
isinstanceÚtyperM   r   )rk   r7   Zdicri   r8   r8   r9   r½   é  s    

zDemoFile._get_object)rx   ry   rz   r   rF   r   r   rp   r   r   r   r¿   ro   rj   r½   Ú__classcell__r8   r8   r¶   r9   r³   ¹  s   
r³   zn<html>
<head>
<link rel="stylesheet" type="text/css" href="{}">
</head>
<body>
<img src="{}">
</body>
</html>
c                       s   e Zd Z‡ fdd„Z‡  ZS )ÚDemoContentFilec                    s&   t ƒ  ¡  t| jƒ}t|| jƒ| _d S r_   )r´   ro   rL   r[   rµ   r²   r°   )rk   Zfile_strr¶   r8   r9   ro     s    

zDemoContentFile.init©rx   ry   rz   ro   rÄ   r8   r8   r¶   r9   rÅ     s   rÅ   c                       s   e Zd Z‡ fdd„Z‡  ZS )ÚDemoImageFilec                    s    t ƒ  ¡  t | j| j¡| _d S r_   )r´   ro   Ú_image_templaterP   r²   r[   r°   rv   r¶   r8   r9   ro     s    
zDemoImageFile.initrÆ   r8   r8   r¶   r9   rÇ     s   rÇ   c                   @   sò   e Zd ZdZeƒ Zedd�Zeedd�Z	edd�Z
edƒZeƒ Zeƒ Zeƒ ZedƒZedƒZeƒ Zeƒ ZedƒZeƒ Zeƒ Zeƒ Zdd	„ Zd
d„ Zdd„ Zdd„ Zdd„ Zedd„ ƒZdd„ Z dd„ Z!dd„ Z"dd„ Z#dd„ Z$dd„ Z%d d!„ Z&d"S )#ÚDemoPathz"This class represents a directory.r�   rž   zpath,css_filenamer[   rŸ   Tc              	   C   s   t t ttttt t dœS )N)z.htmz.htmlz.jpegz.jpgz.pngú.pyz.rstz.txt)rÅ   rÇ   r³   rv   r8   r8   r9   Z__file_factory_defaultI  s    øzDemoPath.__file_factory_defaultc                 C   s&   | j d urt| j j| jƒ}n| j}|S r_   )r    r
   r[   r7   )rk   r[   r8   r8   r9   r¡   Y  s    
zDemoPath._get_pathc                 C   s    t | jƒr| j}n
t| jƒ}|S r_   r¢   r£   r8   r8   r9   r¥   a  s    

zDemoPath._get_base_urlc                 C   s   | j st| jƒ| _ | j S r_   )r¦   r:   r7   rv   r8   r8   r9   r¨   l  s    zDemoPath._get_nice_namec                 C   s   | j }|| _|  d||¡ d S r©   r«   r¬   r8   r8   r9   r¯   u  s    zDemoPath._set_nice_namec                 C   sx   t j | jt¡}t j |¡rTt|ddd��}| ¡ }W d   ƒ qX1 sH0    Y  nd}| jrlt|| jƒ}nt|ƒ}|S )NrU   zutf-8rW   r<   )	Úosr[   r
   ÚDESCRIPTION_RST_FILENAMEr   rY   rZ   r²   rµ   )rk   Z	index_rstrG   r°   r^   r8   r8   r9   Ú_get_description~  s    (zDemoPath._get_descriptionc                 C   s*   i }t t| jdƒƒ\}}tt| |ƒ |S )Nú__init__.py)rT   r
   r[   r¼   Úexec_str)rk   rº   r°   rF   r8   r8   r9   Ú_get_init_dic‘  s    zDemoPath._get_init_dicc                 C   sh   | j }t|ƒD ]T}t||ƒ}t|ƒr* dS | jrt|ƒ\}}|dkrR|dkrR dS || jv r dS qdS )r‘   TrÊ   Ú__init__F)r[   r   r
   r	   Ú	use_filesr   Ú_file_factory©rk   r[   r7   Úcur_pathr§   r8   r8   r9   r“   ›  s    

zDemoPath.has_childrenc                 C   s"   | j s| jr|  ¡ }n|  ¡ }|S )r–   )Úconfig_dictÚconfig_filenameÚget_children_from_configÚget_children_from_datastructure)rk   Úchildrenr8   r8   r9   r˜   °  s    
zDemoPath.get_childrenc              	   C   sÂ   g }g }| j }t|ƒD ]€}t||ƒ}t|ƒrT|  |¡r–| t| |td| jƒd�¡ q| jr|dkrz |  	|¡}| j|_| |¡ W q t
y”   Y q0 qt d¡}|j|d� |j|d� || S )z=Gets the object's children based on the filesystem structure.ú..©r    r7   r²   rÎ   r7   ©Úkey)r[   r   r
   r	   Úhas_py_filesÚappendrÉ   r²   rÒ   Ú_handle_fileÚKeyErrorÚoperatorÚ
attrgetterÚsort)rk   ÚdirsÚfilesr[   r7   rÕ   rl   Úsort_keyr8   r8   r9   rÙ   »  s4    


ýÿ

z(DemoPath.get_children_from_datastructurec              	   C   sØ  | j s4t| jƒr4zt| jƒ| _ W n ty2   Y n0 | j sB|  ¡ S g }g }| j  ¡ D �]V\}}| d¡sT| dd¡}|durªt	| |t
d| jƒd�}||_||_ | |¡ qTg }| dg ¡}t|tƒsÊ|g}|D ]6}	t
| j|	ƒ}	t |	¡D ]}
t|
ƒdkrè| |
¡ qèqÎt|ƒdk�rji }|D ]}
d|
i|t|
ƒ< �qt	| d	d
�}||_||_ tj 
d| j¡|_| |¡ qTt|ƒdkrTz |  |
¡}| |¡ | j|_W qT t�yª   Y qT0 qTt d¡}|j|d� |j|d� || S )zj
        Gets the object's children as specified in its configuration file or
        dictionary.
        Zno_demoÚ	sourcedirNrÛ   rÜ   rç   rÎ   r4   r<   ©r    r7   rª   rÝ   )rÖ   r   r×   r   rM   rÙ   ÚitemsrÀ   ÚpoprÉ   r
   r²   rª   rà   rÂ   Úlistr[   ÚglobÚiglobr   ÚlenrË   rá   râ   rã   rä   rå   )rk   ræ   rç   Úkeywordr­   ré   ZdemoobjÚnamesÚ	filenamesÚfilenamer7   rÖ   rl   rè   r8   r8   r9   rØ   à  sj    


ý
ÿ


z!DemoPath.get_children_from_configc                 C   sP   t |ƒD ]B}t||ƒ}t|ƒr0|  |¡rJ dS qt|ƒ\}}|dkr dS qdS )NTrÊ   F)r   r
   r	   rß   r   rÔ   r8   r8   r9   rß   %  s    

zDemoPath.has_py_filesc                 C   s&   t |ƒ\}}| j| }|| |d�}|S )z&Process a file based on its extension.rê   )r   rÓ   )rk   rô   r2   r§   Zfile_factoryrl   r8   r8   r9   rá   3  s    
zDemoPath._handle_fileN)'rx   ry   rz   Ú__doc__r   r    r   r[   r   r°   r±   r   r²   r7   rª   rº   r   rÒ   rŒ   r   rÖ   r×   Z_descriptionr¦   rÓ   Z_DemoPath__file_factory_defaultr¡   r¥   r¨   r¯   r   rÍ   rÐ   r“   r˜   rÙ   rØ   rß   rá   r8   r8   r8   r9   rÉ     s>   

		

%ErÉ   r°   ÚreadonlyTr±   )Zformat_textZbase_url_name)r~   r†   Údemo_path_viewZsubpanel)Úidr„   rF   r}   )r~   zhandler.run_buttonzsource is not None)Zvisible_whenrs   Fiÿÿÿ )Zshow_line_numbersZselected_colorZOutput)r~   r†   rg   r   r¿   )ZshareZShell)r†   rg   r   rp   )r~   rˆ   Z
horizontal)ZdockÚdemo_file_view)rø   Úhandlerr„   )rú   r„   rª   )Znode_forrg   ÚviewÚselected_node)ÚnodesÚselectedZNextÚnextzGo to next fileÚdo_nextz_next_node is not None)r7   rf   ZtooltipÚactionZenabled_whenZPreviousÚpreviousÚdo_previousz_previous_node is not NoneZParentr    Ú	do_parentzI(selected_node is not None) and (object.selected_node.parent is not None)c                   @   sp   e Zd ZeeƒZeƒ Zeƒ Z	eƒ Z
eƒ Zeƒ Zddd„Zddd„Zddd„Zdd	„ Zd
d„ Zdd„ Zdd„ ZdS )ÚDemoNc                 C   s   | j | _d S r_   )Ú
_next_noderü   ©rk   Úeventr8   r8   r9   r   Ò  s    zDemo.do_nextc                 C   s   | j | _d S r_   )Ú_previous_noderü   r  r8   r8   r9   r  Õ  s    zDemo.do_previousc                 C   s   | j d ur| j j}|| _ d S r_   )rü   r    )rk   r  r    r8   r8   r9   r  Ø  s    
zDemo.do_parentc                 C   s   | j |j_ dS rn   )ÚtitleZui)rk   rh   r8   r8   r9   ro   Ý  s    
z	Demo.initc                 C   s|   d }| j }| |¡}t|ƒdkr*|d }nN|j}|d urx| |¡}| |¡}|t|ƒd k rj||d  }qx|j| }}q0|S )Nr   r4   )rü   r™   rð   r    Úindex)rk   rÿ   rŽ   rÚ   r    Úsiblingsr  r8   r8   r9   Ú_get__next_nodeá  s    



zDemo._get__next_nodec                 C   st   d }| j }|j}|d urp| |¡}| |¡}|dkrl||d  }| |¡}t|ƒdkrp|d }| |¡}qJn|}|S )Nr   r4   éÿÿÿÿ)rü   r    r™   r  rð   )rk   r  rŽ   r    r  r  Zprevious_childrenr8   r8   r9   Ú_get__previous_nodeõ  s    


zDemo._get__previous_nodec              	   C   s,   t tdddtd�dttttdd�dddd	�S )
NÚmodelF)r7   rø   r   r†   ztraitsui.demos.demo.DemoT)Zshow_tool_namesi°  i¼  )rø   Ztoolbarrˆ   ÚwidthÚheight)r0   r$   Údemo_tree_editorr*   Úprevious_toolÚparent_toolÚ	next_toolrv   r8   r8   r9   Údefault_traits_view  s    üÿózDemo.default_traits_view)N)N)N)rx   ry   rz   r   rÉ   r  r   r[   r   rü   r
  r   r  r	  r   r  r  ro   r  r  r  r8   r8   r8   r9   r  À  s   


r  c                 C   s,   ddi}| dur(| |d< d|d< d|d< |S )zàHelper function to make settings dictionary
    consumable by docutils

    Parameters
    ----------
    css_path: string or None (default)
        If not None, use the CSS stylesheet.

    Returns
    -------
    dict
    Úoutput_encodingÚunicodeNZstylesheet_pathFZembed_stylesheetZ
stylesheetr8   )Úcss_pathÚsettingsr8   r8   r9   Ú_get_settings$  s    r  c                 C   s>   zddl m} W n ty&   |  Y S 0 t|ƒ}|| d|d�S )a-  Format RST string to html using `docutils` if available.
    Otherwise, return the input `rst_str`.

    Parameters
    ----------
    rst_str: string
        reStructuredText

    css_path: string or None (default)
        If not None, use the CSS stylesheet.

    Returns
    -------
    string
    r   )Úpublish_stringÚhtml)Úwriter_nameÚsettings_overrides)Údocutils.corer  rM   r  )Zrst_strr  r  r  r8   r8   r9   rµ   :  s    
ÿrµ   c                 C   sB   zddl m} W n ty$   Y dS 0 t|ƒ}|| |d|d� dS )a>  Format reStructuredText in `rst_file_path` to html using `docutils`
    if available. Otherwise, does nothing.

    Parameters
    ----------
    rst_file_path: string

    html_out_path: string

    css_path: string or None (default)
        If not None, use the CSS stylesheet.

    Returns
    -------
    None
    r   )Úpublish_fileNr  )Úsource_pathZdestination_pathr  r   )r!  r"  rM   r  )Zrst_file_pathZhtml_out_pathr  r"  r  r8   r8   r9   Úpublish_html_fileU  s    ür$  r<   úTraits UI DemosrŸ   c              
   C   sn   |d u rt ttjd ƒƒ}t|ƒ\}}t|ƒdkrFt|ƒsFt|||ƒ}t||t	|t
|ƒ| ||d�d� ¡  d S )Nr   )r7   rª   rÒ   r×   r²   )r[   r
  r  )r   r   r`   Úargvr   rð   r   r
   r  rÉ   r:   Zconfigure_traits)rÒ   Údir_namer×   r
  r²   r[   r7   r8   r8   r9   rp   y  s     ûý)rU   rV   )N)N)N)FNr<   r%  rŸ   )_rõ   Ú
contextlibrî   Úior   rã   rË   r   Úos.pathr   r   r   r   r   r	   r
   r   r   r`   rA   r>   rN   Z	configobjr   Z
pyface.apir   Z
traits.apir   r   r   r   r   r   r   r   r   r   r   r   Ztraitsui.apir   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   rÏ   rÌ   r:   rK   rT   rL   Úcontextmanagerrc   rd   Zdemo_file_handlerr{   r�   r‰   r‹   rœ   r³   rÈ   rÅ   rÇ   rÉ   r÷   rù   Zdemo_content_viewr  r  r  r  r  r  rµ   r$  rp   r8   r8   r8   r9   Ú<module>   sH  ,8d &

	,;K@  0þýöþý
ÿûþ
ÿù	üýðß÷-Ð3þýÿ
ôýÿýÿòíûûû
d


%     û