3
8ßL]¡
  ã               @   s4   d dl mZ d dlZddlmZ G dd„ deƒZdS )é    )Úabsolute_importNé   )ÚEditorc               @   s,   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	S )
ÚSearchEditorc             C   sÄ   d}| j jrtj}tj|d| j|d�| _| jj| j jƒ | jj	| j j
ƒ | jj| j jƒ | j jrvtj|| jjƒ | jƒ | j jr”tj|| jjƒ | jƒ tj|| jjƒ | jƒ tj|| jjƒ | jƒ dS )za Finishes initializing the editor by creating the underlying toolkit
            widget.
        r   r   )ÚvalueÚstyleNéÿÿÿÿ)ÚfactoryZ	enter_setÚwxZTE_PROCESS_ENTERZ
SearchCtrlr   ÚcontrolZSetDescriptiveTextÚtextZShowSearchButtonZsearch_buttonZShowCancelButtonZcancel_buttonZauto_setZEVT_TEXTZGetIdÚupdate_objectZEVT_TEXT_ENTERZEVT_SEARCHCTRL_SEARCH_BTNZEVT_SEARCHCTRL_CANCEL_BTNÚ
clear_text)ÚselfÚparentr   © r   ú?/tmp/pip-install-5sebvq2j/traitsui/traitsui/wx/search_editor.pyÚinit   s    zSearchEditor.initc             C   s4   | j s0| jjƒ | _| jjdkr0t| j| jjdƒ dS )zC Handles the user entering input data in the edit control.
        Ú TN)Ú
_no_updater   ÚGetValuer   r	   Úsearch_event_traitÚsetattrÚobject)r   Úeventr   r   r   r   5   s    zSearchEditor.update_objectc             C   s:   | j s6| jjdƒ d| _| jjdkr6t| j| jjdƒ dS )z= Handles the user pressing the cancel search button.
        r   TN)r   r   ÚSetValuer   r	   r   r   r   )r   r   r   r   r   r   >   s
    zSearchEditor.clear_textc             C   s.   | j jƒ | jkr*d| _| j j| jƒ d| _dS )z` Updates the editor when the object trait changes externally to the
            editor.
        TFN)r   r   r   r   r   Z	str_value)r   r   r   r   Úupdate_editorH   s    zSearchEditor.update_editorN)Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r   r   r   r   r      s   	
r   )Ú
__future__r   r
   Úeditorr   r   r   r   r   r   Ú<module>   s   