3
7ßL]F	  ã               @   s4   d dl mZmZmZ ddlmZ G dd„ deƒZdS )é    )ÚConstantÚ	HasTraitsÚInstanceé   )ÚActionc                   s8   e Zd ZdZeeƒZedƒZdd„ Z	‡ fdd„Z
‡  ZS )ÚTraitsUIWidgetActiona   A widget action containing a TraitsUI.

    If a object is supplied, then the UI is generated from the object's view,
    otherwise the ui is generated on using the Action object.

    Notes
    -----
    This is currently only supported by the Qt backend.
    Zwidgetc             C   s   | j d|d�}|j}||_|S )a�   Called when creating a "widget" style action.

        This constructs an TraitsUI subpanel-based control.  It does no binding
        to the `perform` method.

        Parameters
        ----------
        parent : toolkit control
            The toolkit control, usually a toolbar.

        Returns
        -------
        control : toolkit control
            A toolkit control or None.
        Zsubpanel)ÚkindÚparent)Zedit_traitsÚcontrolZ_ui)Úselfr	   Úuir
   © r   úH/tmp/pip-install-5sebvq2j/pyface/pyface/action/traitsui_widget_action.pyÚcreate_control(   s    z#TraitsUIWidgetAction.create_controlc                s(   | j dk	r| j | dœ}|S tt| ƒjƒ S )zI Use the model object for the Traits UI context, if appropriate.
        N)ÚobjectÚaction)ÚmodelÚsuperr   Útrait_context)r   Úcontext)Ú	__class__r   r   r   A   s    
z"TraitsUIWidgetAction.trait_context)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   Ústyler   r   Ú__classcell__r   r   )r   r   r      s
   	r   N)Z
traits.apir   r   r   r   r   r   r   r   r   r   Ú<module>
   s   