a
    ¦ˆc?  ã                   @   sT   d Z ddlmZmZmZ ddlmZ ddlmZ G dd„ deƒZ	G dd„ deƒZ
d	S )
z The toggle field interface. é    )ÚBoolÚ	HasTraitsÚStr)ÚIField)ÚImagec                   @   s"   e Zd ZdZeƒ Zeƒ Zeƒ Z	dS )ÚIToggleFieldzo The toggle field interface.

    This is for a toggle between two states, represented by a boolean value.
    N)
Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Úvaluer   Útextr   Úicon© r   r   ú_/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/pyface/fields/i_toggle_field.pyr      s   r   c                       sr   e Zd ZdZeƒ Zeƒ Zeƒ Z	‡ fdd„Z
‡ fdd„Z‡ fdd„Zdd	„ Zd
d„ Zdd„ Zdd„ Zdd„ Z‡  ZS )ÚMToggleFieldzq The toggle field mixin class.

    This is for a toggle between two states, represented by a boolean value.
    c                    s&   t ƒ  ¡  |  | j¡ |  | j¡ d S ©N)ÚsuperÚ_initialize_controlÚ_set_control_textr   Ú_set_control_iconr   ©Úself©Ú	__class__r   r   r   7   s    
z MToggleField._initialize_controlc                    sD   t ƒ  ¡  | j| jddd� | j| jddd� | jdur@|  ¡  dS )z- Set up toolkit-specific bindings for events r   Úui)Údispatchr   N)r   Ú_add_event_listenersÚobserveÚ_text_updatedÚ_icon_updatedÚcontrolÚ_observe_control_valuer   r   r   r   r   <   s
    

z!MToggleField._add_event_listenersc                    sL   | j dur| jdd� | j| jdddd� | j| jdddd� tƒ  ¡  dS )z- Remove toolkit-specific bindings for events NT)Úremover   r   )r   r#   r   )r!   r"   r   r   r    r   Ú_remove_event_listenersr   r   r   r   r$   D   s
    
z$MToggleField._remove_event_listenersc                 C   s
   t ƒ ‚dS ©z4 Toolkit specific method to set the control's text. N©ÚNotImplementedErrorr   r   r   r   Ú_get_control_textN   s    zMToggleField._get_control_textc                 C   s
   t ƒ ‚dS r%   r&   )r   r   r   r   r   r   R   s    zMToggleField._set_control_textc                 C   s
   t ƒ ‚dS )z4 Toolkit specific method to set the control's icon. Nr&   )r   r   r   r   r   r   V   s    zMToggleField._set_control_iconc                 C   s   | j d ur|  | j¡ d S r   )r!   r   r   ©r   Úeventr   r   r   r   \   s    
zMToggleField._text_updatedc                 C   s   | j d ur|  | j¡ d S r   )r!   r   r   r)   r   r   r   r    `   s    
zMToggleField._icon_updated)r   r	   r
   r   r   r   r   r   r   r   r   r   r$   r(   r   r   r   r    Ú__classcell__r   r   r   r   r   $   s   
r   N)r   Z
traits.apir   r   r   Zpyface.fields.i_fieldr   Zpyface.ui_traitsr   r   r   r   r   r   r   Ú<module>   s
   