3
8Ad]J  ã               @   sn  d 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mZ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ZededdƒƒZededd	d
dƒdd� ZZededddd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/e0e1fZ2dS )*z: Defines common traits used within the traits.ui package.
é    )Úabsolute_import)	Ú	AlignmentÚBorderÚ	HasBorderÚ	HasMarginÚImageÚMarginÚPositionÚconvert_bitmapÚconvert_image)ÚAnyÚDelegateÚEnumÚ
ExpressionÚFloatÚHasStrictTraitsÚListÚRangeÚStrÚTraitÚ
TraitErrorÚTraitPrefixListÚ	TraitTypeNZverticalÚ
horizontalZsimpleZcustomÚtextÚreadonlyé   )ÚcolsÚnormalÚsplitZtabbedZflowÚfoldÚobjectÚfixedÚ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 t| ƒjf |Ž |dk	r || _dS )z& Initializes the item object.
        N)Úsuperr&   Ú__init__Úname)ÚselfÚvalueÚtraits)Ú	__class__© ún/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.6/site-packages/traitsui-6.1.2-py3.6.egg/traitsui/ui_traits.pyr)   l   s    zStatusItem.__init__)N)	Ú__name__Ú
__module__Ú__qualname__r   r*   r   Úwidthr)   Ú__classcell__r/   r/   )r.   r0   r&   `   s   r&   c               @   s    e Zd ZdZdZdZdd„ ZdS )Ú
ViewStatuszq Defines 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jƒrt|d�gS t |tƒr(|gS |dkr4|S g }t |tƒrŠxF|D ]:}t |tjƒrj|jt|d�ƒ qHt |tƒr€|j|ƒ qHP qHW |S | j|||ƒ dS )zC Validates that a specified value is valid for this trait.
        )r*   N)Ú
isinstanceÚsixÚstring_typesr&   ÚSequenceTypesÚappendÚerror)r+   r!   r*   r,   ÚresultÚitemr/   r/   r0   Úvalidate…   s     



zViewStatus.validate)r1   r2   r3   Ú__doc__Údefault_valueÚ	info_textr?   r/   r/   r/   r0   r6   y   s   r6   é   c             C   sˆ   t | tjƒs| S | dd… dkrh| jdƒdkrhyddlm} |j| ƒ}W n   d}Y nX |dk	rh|jS ddlm} |t	| |d ƒd�S )	z8 Converts a specified value to a Theme if possible.
    Né   ú@ú:é   )ÚImageLibrary)ÚTheme)Úimage)
r7   r8   r9   ÚfindZimage.imagerH   Z
image_infoÚthemerI   r   )r,   ÚlevelrH   ÚinforI   r/   r/   r0   Úconvert_theme¥   s    
rO   c                   s2   e Zd ZdZdZdZd‡ fdd„	Zdd„ Z‡  ZS )	ÚAThemezm Defines 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 t| ƒjt|ƒf|Ž 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(   rP   r)   rO   )r+   r,   Úmetadata)r.   r/   r0   r)   Å   s    	zATheme.__init__c             C   sB   ddl m} |dkrdS t|dƒ}t||ƒr0|S | j|||ƒ dS )zC Validates that a specified value is valid for this trait.
        rD   )rI   Nr   )rL   rI   rO   r7   r<   )r+   r!   r*   r,   rI   Ú	new_valuer/   r/   r0   r?   Ð   s    

zATheme.validate)N)	r1   r2   r3   r@   rA   rB   r)   r?   r5   r/   r/   )r.   r0   rP   º   s
   rP   é    )rC   iàÿÿÿ)3r@   Ú
__future__r   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   r   r8   ZOrientationZEditorStyleZstyle_traitÚLayoutZAnObjectZ	DockStyleZdock_style_traitZ
ExportTypeZContainerDelegateZcontainer_delegateZHelpIdZhelp_id_traitZAButtonZButtonsZAViewr&   r6   rO   rP   ZSpacingÚtupleÚlistr:   r/   r/   r/   r0   Ú<module>   sB   ,<

,
)