a
    §ˆc2  ã                   @   sr   d Z ddlmZmZmZ g d¢ZddgZddgZg d¢ZG d	d
„ d
eƒZ	dd„ Z
e	ƒ Zee ddd¡ee
d�ZdS )z7 Trait definition for a null-based (i.e., no UI) font.
é    )ÚTraitÚTraitHandlerÚ
TraitError)ÚdefaultZ
decorativeZromanÚscriptZswissZmodernZslantZitalicÚlightZbold)ÚptZpointÚfamilyc                   @   s    e Zd ZdZdd„ Zdd„ ZdS )Ú	TraitFontz´Ensures that values assigned to a trait attribute are valid font
    descriptor strings; the value actually assigned is the corresponding
    canonical font descriptor string.
    c              	   C   sú   zÐd } } } }}dg}	|  ¡ D ]ˆ}
|
 ¡ }|tv rBd| }q$|tv rTd| }q$|tv rfd| }q$|dkrxd| }q$|tvr$zt|ƒ |d }W q$   |	 |
¡ Y q$0 q$d|||||d |	¡f  	¡ }|W S  t
yâ   Y n0 t||dt|ƒƒ‚dS )z;Validates that the value is a valid font descriptor string.Ú ú Ú	underlinez ptz%s%s%s%s%s%sza font descriptor stringN)ÚsplitÚlowerÚfont_familiesÚfont_stylesÚfont_weightsÚ
font_noiseÚintÚappendÚjoinÚstripÚ	Exceptionr   Úrepr)ÚselfÚobjectÚnameÚvalueZ
point_sizer	   ÚstyleZweightr   ZfacenameÚwordZlwordZfontstr© r    ú[/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/traitsui/null/font_trait.pyÚvalidate-   sB    



úÿÿzTraitFont.validatec                 C   s   dS )NzXa string describing a font (e.g. '12 pt bold italic swiss family Arial' or 'default 12')r    )r   r    r    r!   ÚinfoR   s    ÿzTraitFont.infoN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r"   r#   r    r    r    r!   r
   '   s   %r
   c                  O   s   ddl m} || i |¤ŽS )Né   )Ú
FontEditor)Úapir)   )ÚargsZtraitsr)   r    r    r!   Úget_font_editorc   s    r,   NzArial 10)Zeditor)r'   Z
traits.apir   r   r   r   r   r   r   r
   r,   Úfhr"   ZNullFontr    r    r    r!   Ú<module>   s   <ÿ