3
<Ad]Ä  ã               @   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ÚIntÚStrÚUnicode)ÚOK)ÚIWindowc               @   sb   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 )aÅ   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   úi/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.6/site-packages/pyface-6.1.2-py3.6.egg/pyface/i_dialog.pyÚopenB   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_buttonsU   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   r   Ú_create_contentse   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   r   Ú_create_dialog_areat   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_labelr   Zhelp_idZ
help_labelZok_labelr   Z
resizeabler   r   Úreturn_coder   Ústyler   r   r   r   r   r   r   r   r   r	      s   
r	   c                   s0   e Zd ZdZdd„ Z‡ fdd„Z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kr| jƒ  | jdkr0| jƒ | _| jƒ  n| jdƒ t| _| jS )aÅ   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.
        Nr
   T)ÚcontrolÚ_creater   r   r   ÚcloseÚshowr   )r   r   r   r   r   ™   s    




zMDialog.openc                s   t t| ƒjƒ  | j| jƒ dS )z( Creates the window's widget hierarchy. N)Úsuperr   r   r   r   )r   )Ú	__class__r   r   r   ¸   s    zMDialog._createc             C   s   dS )z2 Adds any event listeners required by the window. Nr   )r   r   r   r   Ú_add_event_listenersÃ   s    zMDialog._add_event_listeners)r   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	   Úobjectr   r   r   r   r   Ú<module>   s
   t