a
    §ˆc
  ã                   @   sT   d Z ddlZddl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 )zN Defines the various Boolean editors for the wxPython user interface toolkit.
é    Né   )ÚEditor)ÚSimpleEditor)ÚReadonlyColorc                   @   s0   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
S )r   zFSimple style of editor for Boolean values, which displays a check box.c                 C   s.   t  |dd¡| _| j t j| j¡ |  ¡  dS )ú\Finishes initializing the editor by creating the underlying toolkit
        widget.
        éÿÿÿÿÚ N)ÚwxZCheckBoxÚcontrolZBindÚEVT_CHECKBOXÚupdate_objectZset_tooltip©ÚselfÚparent© r   ú]/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/traitsui/wx/boolean_editor.pyÚinit   s    zSimpleEditor.initc                 C   s   | j  tj¡ d S )N)r
   ZUnbindr	   r   ©r   r   r   r   Údispose&   s    zSimpleEditor.disposec                 C   s   | j  ¡ dk| _dS )z'Handles the user clicking the checkbox.r   N)r
   ZGetValueÚvalue)r   Úeventr   r   r   r   )   s    zSimpleEditor.update_objectc                 C   s   | j  | j¡ dS )ú[Updates the editor when the object trait changes externally to the
        editor.
        N)r
   ÚSetValuer   r   r   r   r   Úupdate_editor-   s    zSimpleEditor.update_editorN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r   r   r   r      s
   r   c                   @   s    e Zd ZdZdd„ Zdd„ ZdS )ÚReadonlyEditorznRead-only style of editor for Boolean values, which displays static text
    of either "True" or "False".
    c                 C   s&   t j|ddt jd�| _| j t¡ dS )r   r   r   )ÚstyleN)r	   ZTextCtrlZTE_READONLYr
   ZSetBackgroundColourr   r   r   r   r   r   9   s    zReadonlyEditor.initc                 C   s$   | j r| j d¡ n| j d¡ dS )r   ÚTrueÚFalseN)r   r
   r   r   r   r   r   r   F   s    zReadonlyEditor.update_editorN)r   r   r   r   r   r   r   r   r   r   r   4   s   r   )
r   r	   Zeditorr   Ztext_editorr   Z
TextEditorÚ	constantsr   r   r   r   r   r   Ú<module>   s   