a
    §ˆc:  ã                   @   sT   d Z ddlZddlZddlZddlmZmZ ddlZ	ddl
mZ G dd„ deƒZdS )z3A dialog that is loaded from an XRC resource file.
é    N)ÚInstanceÚStré   )ÚDialogc                   @   sZ   e Zd ZdZeƒ ZedƒZeej	j
ƒZdd„ Zdd„ Zdd„ Zd	d
„ Zdd„ Zdd„ ZdS )Ú	XrcDialogz7A dialog that is loaded from an XRC resource file.
    Údialogc                 C   s<   t jj | ¡}tj || j¡}tj	 
|¡| _| j || j¡S )zL
        Creates the dialog and loads it in from the resource file.
        )ÚtraitsÚutilÚresourceÚget_pathÚosÚpathÚjoinÚxrc_fileÚwxÚxrcÚXmlResourceZ
LoadDialogÚid)ÚselfÚparentZ	classpathr   © r   úZ/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/pyface/ui/wx/xrc_dialog.pyÚ_create_control9   s    zXrcDialog._create_controlc                 C   s¢   |   d¡}|dur6| tj¡ | j tj| ¡ | j¡ |   d¡}|durl| tj	¡ | j tj| j
| ¡ ¡ |   d¡}|dur–| j tj| j| ¡ ¡ |  ¡  dS )z{
        Calls add_handlers.  The actual content is created
        in _create_control by loading a resource file.
        ÚOKNZCANCELZHELP)ÚXRCCTRLZSetIdr   ZID_OKÚcontrolZBindZ
EVT_BUTTONZGetIdZ_on_okZ	ID_CANCELZ
_on_cancelZ_on_helpÚ_add_handlers)r   r   ZokbuttonZcancelbuttonZ
helpbuttonr   r   r   Ú_create_contentsC   s    

ÿ
zXrcDialog._create_contentsc                 C   s   t j |¡S )zC
        Returns the numeric widget id for the given name.
        )r   r   ÚXRCID©r   Únamer   r   r   r   a   s    zXrcDialog.XRCIDc                 C   s   | j j |  |¡¡S )z:
        Returns the control with the given name.
        )r   ZWindowZFindWindowByIdr   r   r   r   r   r   g   s    zXrcDialog.XRCCTRLc                 C   s   |   |¡ |¡ dS )z:
        Sets the validator on the named control.
        N)r   ZSetValidator)r   r    Z	validatorr   r   r   Úset_validatorm   s    zXrcDialog.set_validatorc                 C   s   dS )z1
        Override to add event handlers.
        Nr   )r   r   r   r   r   w   s    zXrcDialog._add_handlersN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r   r   r
   r   r   r   r   r!   r   r   r   r   r   r   "   s   


r   )r%   Úos.pathr   r   Zwx.xrcZ
traits.apir   r   Ztraits.util.resourcer   r   r   r   r   r   r   r   Ú<module>   s   