a
    §ˆc«  ã                   @   s¨   d Z ddlZddlZddlmZmZmZmZmZ ddl	m
Z
mZ ddlmZmZmZmZ ddlmZ ejeejeejeejeejedeiZee
ƒG dd	„ d	eeƒƒZdS )
z$ Enthought pyface package component
é    N)ÚBoolÚEnumÚIntÚprovidesÚStr)ÚIDialogÚMDialog)ÚOKÚCANCELÚYESÚNOé   )ÚWindowc                   @   sŠ   e Zd ZdZeƒ Zeƒ Zeƒ Zeƒ Ze	dƒZ
eeƒZeddƒZed ƒZdd„ Zdd„ Zd	d
„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ ZdS )ÚDialogzp The toolkit specific implementation of a Dialog.  See the IDialog
    interface for the API documentation.
    TÚmodalZnonmodalc                 C   sü   t  ¡ }| jr| j}nd}t  |t j|¡ | _}| ¡  |jt j| j	t jd� | 
|¡ | jrf| j}nd}t  |t j|¡ | _}|jt j| jt jd� | 
|¡ t| jƒdkrð| jr¼| j}nd}t  |t j|¡}|jt j| jt jd� | 
|¡ | ¡  |S )Nr	   )ÚidZCancelr   ZHelp)ÚwxZStdDialogButtonSizerÚok_labelZButtonÚID_OKZ_wx_okZ
SetDefaultZBindZ
EVT_BUTTONÚ	_wx_on_okZ	AddButtonÚcancel_labelÚ	ID_CANCELZ
_wx_cancelÚ_wx_on_cancelÚlenÚhelp_idÚ
help_labelZID_HELPÚ_wx_on_helpZRealize)ÚselfÚparentÚsizerÚlabelÚokÚcancelÚhelp© r$   úV/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/pyface/ui/wx/dialog.pyÚ_create_buttonsH   s.    


zDialog._create_buttonsc                 C   s’   t  t j¡}| |¡ | d¡ |  |¡}| |dt jt jB d¡ |  	|¡}| |dt j
t jB d¡ | jdkr|| | j¡ n
| |¡ | ¡  d S )NTr   é   r   )éÿÿÿÿr(   )r   ZBoxSizerZVERTICALZSetSizerZSetAutoLayoutÚ_create_dialog_areaÚAddZEXPANDÚALLr&   ZALIGN_RIGHTÚsizeÚSetSizeZFitZCentreOnParent)r   r   r   Zdialog_areaZbuttonsr$   r$   r%   Ú_create_contentsn   s    





zDialog._create_contentsc                 C   s$   t  |d¡}| d¡ | d¡ |S )Nr(   Zred)éd   éÈ   )r   ZPanelZSetBackgroundColourr-   )r   r   Zpanelr$   r$   r%   r)   ƒ   s    

zDialog._create_dialog_areac                 C   s$   t jdkr| j d¡ t| j ¡  S )NÚdarwinF)ÚsysÚplatformÚcontrolZShowÚ_RESULT_MAPZ	ShowModal)r   r$   r$   r%   Ú_show_modalŠ   s    
zDialog._show_modalc                 C   s6   t jt jB }| jr|t jO }t  |d| j| j| j|¡S )Nr(   )	r   ZDEFAULT_DIALOG_STYLEZCLIP_CHILDRENÚ
resizeableZRESIZE_BORDERr   ÚtitleÚpositionr,   )r   r   Ústyler$   r$   r%   Ú_create_control•   s    
ÿzDialog._create_controlc                 C   s   t | _| ¡  dS )z) Called when the 'OK' button is pressed. N)r	   Úreturn_codeÚSkip©r   Úeventr$   r$   r%   r   ¡   s    zDialog._wx_on_okc                 C   s   t | _| ¡  dS )z- Called when the 'Cancel' button is pressed. N)r
   r<   r=   r>   r$   r$   r%   r   ©   s    zDialog._wx_on_cancelc                 C   s   dS )z+ Called when the 'Help' button is pressed. Nr$   r>   r$   r$   r%   r   ±   s    zDialog._wx_on_helpN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r   r7   r   r	   r<   r   r:   r8   r&   r.   r)   r6   r;   r   r   r   r$   r$   r$   r%   r   *   s"   
&r   )rC   r2   r   Z
traits.apir   r   r   r   r   Zpyface.i_dialogr   r   Zpyface.constantr	   r
   r   r   Zwindowr   r   r   ZID_YESZID_NOZID_CLOSEr5   r   r$   r$   r$   r%   Ú<module>   s   ÷