a
    ¦ˆc7  ã                   @   s\   d Z ddlmZmZ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 )
z0 The abstract interface for all pyface dialogs. é    )ÚBoolÚEnumÚ	HasTraitsÚIntÚStr)ÚOK)ÚIWindowc                   @   sj   e Zd ZdZeƒ Zeƒ Zeƒ Zeƒ Ze	dƒZ
eeƒZeddƒZdd„ Zdd„ Zd	d
„ Zdd„ Zdd„ ZdS )ÚIDialogaE   The abstract interface for all pyface dialogs.

    Usage: Sub-class this class and either override '_create_contents' or
    more simply, just override the two methods that do the real work:-

    1) '_create_dialog_area' creates the main content of the dialog.
    2) '_create_buttons'     creates the dialog buttons.
    TÚmodalZnonmodalc                 C   s   dS )áÅ   Opens the dialog.

        If the dialog is modal then the dialog's event loop is entered and the
        dialog closed afterwards.  The 'return_code' trait is updated according
        to the button the user pressed and this value is also returned.

        If the dialog is non-modal the return_code trait is set to 'OK'.

        Returns
        -------
        return_code : OK or CANCEL
            The value of the ``return_code`` trait.
        N© ©Úselfr   r   úR/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/pyface/i_dialog.pyÚopen>   s    zIDialog.openc                 C   s   dS )aF   Create and return the buttons.

        Parameters
        ----------
        parent : toolkit control
            The dialog's toolkit control to be used as the parent for
            buttons.

        Returns
        -------
        buttons : toolkit control
            A control containing the dialog's buttons.

        Nr   ©r   Úparentr   r   r   Ú_create_buttonsQ   s    zIDialog._create_buttonsc                 C   s   dS )ae   Create and return the dialog's contents.

        Parameters
        ----------
        parent : toolkit control
            The window's toolkit control to be used as the parent for
            widgets in the contents.

        Returns
        -------
        control : toolkit control
            A control to be used for contents of the window.
        Nr   r   r   r   r   Ú_create_contentsa   s    zIDialog._create_contentsc                 C   s   dS )aq   Create and return the main content of the dialog's window.

        Parameters
        ----------
        parent : toolkit control
            A toolkit control to be used as the parent for widgets in the
            contents.

        Returns
        -------
        control : toolkit control
            A control to be used for main contents of the dialog.
        Nr   r   r   r   r   Ú_create_dialog_areap   s    zIDialog._create_dialog_areac                 C   s   dS )z« Opens the dialog as a modal dialog.

        Returns
        -------
        return_code : OK or CANCEL
            The return code from the user's interactions.
        Nr   r   r   r   r   Ú_show_modal   s    zIDialog._show_modalN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Zcancel_labelZhelp_idZ
help_labelZok_labelr   Z
resizeabler   r   Úreturn_coder   Ústyler   r   r   r   r   r   r   r   r   r	      s   
r	   c                       s(   e Zd ZdZdd„ Z‡ fdd„Z‡  ZS )ÚMDialogz¾ The mixin class that contains common code for toolkit specific
    implementations of the IDialog interface.

    Implements: open()
    Reimplements: _add_event_listeners(), _create()
    c                 C   sF   | j du r|  ¡  | jdkr0|  ¡ | _|  ¡  n|  d¡ t| _| jS )r   Nr
   T)ÚcontrolÚ_creater   r   r   ÚcloseÚshowr   r   r   r   r   r   •   s    




zMDialog.openc                    s   t ƒ  ¡  |  | j¡ dS )z( Creates the window's widget hierarchy. N)Úsuperr   r   r   r   ©Ú	__class__r   r   r   ´   s    
zMDialog._create)r   r   r   r   r   r   Ú__classcell__r   r   r#   r   r   ‰   s   r   N)r   Z
traits.apir   r   r   r   r   Zpyface.constantr   Zpyface.i_windowr   r	   r   r   r   r   r   Ú<module>   s
   t