a
    §ˆc  ã                   @   s<  d 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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 edƒZeddd	� ZZed
ƒZedƒZedddddd� ZZ edd�Z!eddd� Z"Z#edd� Z$Z%eƒ Z&ee&dd�Z'eƒ Z(G dd„ deƒZ)G dd„ deƒZ*d$dd„Z+G dd „ d eƒZ,ed!d"dƒZ-d#S )%z: Defines common traits used within the traits.ui package.
é    )	Ú	AlignmentÚBorderÚ	HasBorderÚ	HasMarginÚImageÚMarginÚPositionÚconvert_bitmapÚconvert_image)ÚAnyÚDelegateÚEnumÚ
ExpressionÚFloatÚHasStrictTraitsÚListÚ
PrefixListÚRangeÚStrÚ
TraitErrorÚ	TraitTypeé   )ÚSequenceTypes)ÚverticalÚ
horizontal)ÚsimpleZcustomÚtextÚreadonlyé   )Úcols)ÚnormalÚsplitZtabbedZflowÚfoldÚobjectÚfixedr   r   Útabz the default docking style to use)Údescz0the category of elements dragged out of the viewÚ	containerF)Z
listenablez$the external help context identifierz3the action buttons to add to the bottom of the viewc                       s.   e Zd ZedƒZedƒZd‡ fdd„	Z‡  ZS )Ú
StatusItemÚstatusg      à?Nc                    s$   t ƒ jf i |¤Ž |dur || _dS )zInitializes the item object.N)ÚsuperÚ__init__Úname)ÚselfÚvalueZtraits©Ú	__class__© úU/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/traitsui/ui_traits.pyr+   u   s    zStatusItem.__init__)N)	Ú__name__Ú
__module__Ú__qualname__r   r,   r   Úwidthr+   Ú__classcell__r1   r1   r/   r2   r(   i   s   r(   c                   @   s    e Zd ZdZdZdZdd„ ZdS )Ú
ViewStatuszlDefines a trait whose value must be a single StatusItem instance or a
    list of StatusItem instances.
    NzgNone, a string, a single StatusItem instance, or a list or tuple of strings and/or StatusItem instancesc                 C   s–   t |tƒrt|d�gS t |tƒr&|gS |du r2|S g }t |tƒr„|D ]:}t |tƒrd| t|d�¡ qDt |tƒrz| |¡ qD q„qD|S |  |||¡ dS )ú9Validates that a specified value is valid for this trait.)r,   N)Ú
isinstanceÚstrr(   r   ÚappendÚerror)r-   r#   r,   r.   ÚresultÚitemr1   r1   r2   Úvalidate�   s     




zViewStatus.validate)r3   r4   r5   Ú__doc__Údefault_valueÚ	info_textr@   r1   r1   r1   r2   r8   ‚   s
   ÿr8   é   c                 C   s†   t | tƒs| S | dd… dkrf|  d¡dkrfzddlm} | | ¡}W n   d}Y n0 |durf|jS ddlm} |t| |d ƒd�S )	z2Converts a specified value to a Theme if possible.Nr   ú@ú:é   )ÚImageLibrary©ÚTheme)Úimage)	r:   r;   ÚfindZimage.imagerH   Z
image_infoÚthemerJ   r
   )r.   ÚlevelrH   ÚinforJ   r1   r1   r2   Úconvert_theme¯   s    

rP   c                       s2   e Zd ZdZdZdZd‡ fdd„	Zdd„ Z‡  ZS )	ÚAThemezhDefines a trait whose value must be a traits UI Theme or a string that
    can be converted to one.
    Nz0a Theme or string that can be used to define onec                    s   t ƒ jt|ƒfi |¤Ž dS )zïCreates an ATheme trait.

        Parameters
        ----------
        value : string or Theme
            The default value for the ATheme, either a Theme object, or a
            string from which a Theme object can be derived.
        N)r*   r+   rP   )r-   r.   Úmetadatar/   r1   r2   r+   Ï   s    	zATheme.__init__c                 C   sB   ddl m} |du rdS t|dƒ}t||ƒr0|S |  |||¡ dS )r9   r   rI   Nr   )rM   rJ   rP   r:   r=   )r-   r#   r,   r.   rJ   Ú	new_valuer1   r1   r2   r@   Ú   s    

zATheme.validate)N)	r3   r4   r5   rA   rB   rC   r+   r@   r7   r1   r1   r/   r2   rQ   Ä   s
   rQ   iàÿÿÿé    N)rD   ).rA   Zpyface.ui_traitsr   r   r   r   r   r   r   r	   r
   Z
traits.apir   r   r   r   r   r   r   r   r   r   r   r   Úhelperr   ZOrientationZEditorStyleZstyle_traitZLayoutZAnObjectZ	DockStyleZdock_style_traitZ
ExportTypeZContainerDelegateZcontainer_delegateZHelpIdZhelp_id_traitZAButtonZButtonsZAViewr(   r8   rP   rQ   ZSpacingr1   r1   r1   r2   Ú<module>   s>   ,8ÿ
û
	
ÿ
ÿ-
)