3
8ßL]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verticalZ
horizontalÚsimpleZcustomÚtextÚreadonlyé   )ÚcolsÚnormalÚsplitZtabbedZflowÚfoldÚobjectZ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ÚvalueZtraits)Ú	__class__© ú8/tmp/pip-install-5sebvq2j/traitsui/traitsui/ui_traits.pyr(   l   s    zStatusItem.__init__)N)	Ú__name__Ú
__module__Ú__qualname__r   r)   r   Úwidthr(   Ú__classcell__r-   r-   )r,   r.   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-   r.   Úvalidate…   s     



zViewStatus.validate)r/   r0   r1   Ú__doc__Údefault_valueÚ	info_textr=   r-   r-   r-   r.   r4   y   s   r4   é   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)
r5   r6   r7   ÚfindZimage.imagerF   Z
image_infoÚthemerG   r   )r+   ÚlevelrF   ÚinforG   r-   r-   r.   Úconvert_theme¥   s    
rM   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'   rN   r(   rM   )r*   r+   Úmetadata)r,   r-   r.   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.
        rB   )rG   Nr   )rJ   rG   rM   r5   r:   )r*   r!   r)   r+   rG   Z	new_valuer-   r-   r.   r=   Ð   s    

zATheme.validate)N)	r/   r0   r1   r>   r?   r@   r(   r=   r3   r-   r-   )r,   r.   rN   º   s
   rN   é    )rA   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   r6   ZOrientationZEditorStyleZstyle_traitZLayoutZAnObjectZ	DockStyleZdock_style_traitZ
ExportTypeZContainerDelegateZcontainer_delegateZHelpIdZhelp_id_traitZAButtonZButtonsZAViewr%   r4   rM   rN   ZSpacingÚtupleÚlistr8   r-   r-   r-   r.   Ú<module>   sB   ,<

,
)