a
    ¦ˆch+  ã                   @   sl   d Z ddlmZmZmZmZmZmZ ddl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 )z: The abstract interface for all pyface top-level windows. é    )ÚEventÚ	HasTraitsÚTupleÚStrÚVetoableÚVetoableEvent)ÚNO)ÚKeyPressedEvent)ÚIWidgetc                   @   sŽ   e Zd ZdZeƒ Zeƒ Zeƒ Ze	ƒ Z
eƒ Ze	ƒ Ze	ƒ Zeƒ Ze	ƒ Ze	eƒZdd„ Zddd„Zddefdd	„Zddd„Zddd„Zddd„ZdS )ÚIWindowzÌ The abstract interface for all pyface top-level windows.

    A pyface top-level window has no visual representation until it is opened
    (ie. its 'control' trait will be None until it is opened).
    c                 C   s   dS )á�   Opens the window.

        This fires the :py:attr:`closing` vetoable event, giving listeners the
        opportunity to veto the opening of the window.

        If the window is opened, the :py:attr:`opened` event will be fired
        with the IWindow instance as the event value.

        Returns
        -------
        opened : bool
            Whether or not the window was opened.
        N© )Úselfr   r   úR/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/pyface/i_window.pyÚopenG   s    zIWindow.openFc                 C   s   dS ©aO   Closes the window.

        This fires the :py:attr:`closing` vetoable event, giving listeners the
        opportunity to veto the closing of the window.  If :py:obj:`force` is
        :py:obj:`True` then the window will close no matter what.

        If the window is closed, the closed event will be fired with the window
        object as the event value.

        Parameters
        ----------
        force : bool
            Whether the window should close despite vetos.

        Returns
        -------
        closed : bool
            Whether or not the window is closed.
        Nr   )r   Úforcer   r   r   ÚcloseV   s    zIWindow.closeNc                 C   s   dS )áš   Convenience method to show a confirmation dialog.

        Parameters
        ----------
        message : str
            The text of the message to display.
        title : str
            The text of the dialog title.
        cancel : bool
            ``True`` if the dialog should contain a Cancel button.
        default : NO, YES or CANCEL
            Which button should be the default button.
        Nr   )r   ÚmessageÚtitleÚcancelÚdefaultr   r   r   Úconfirmk   s    zIWindow.confirmÚInformationÚ Úautoc                 C   s   dS )a%   Convenience method to show an information message dialog.

        Parameters
        ----------
        message : str
            The text of the message to display.
        title : str
            The text of the dialog title.
        detail : str
            Further details about the message.
        informative : str
            Explanatory text to display along with the message.
        text_format : str
            Specifies what text format to use in the resulting message dialog.
            One of "auto", "plain", or "rich".

        Nr   ©r   r   r   ÚdetailÚinformativeÚtext_formatr   r   r   Úinformationz   s    zIWindow.informationÚWarningc                 C   s   dS )a    Convenience method to show a warning message dialog.

        Parameters
        ----------
        message : str
            The text of the message to display.
        title : str
            The text of the dialog title.
        detail : str
            Further details about the message.
        informative : str
            Explanatory text to display along with the message.
        text_format : str
            Specifies what text format to use in the resulting message dialog.
            One of "auto", "plain", or "rich".

        Nr   r   r   r   r   Úwarning”   s    zIWindow.warningÚErrorc                 C   s   dS )a   Convenience method to show an error message dialog.

        Parameters
        ----------
        message : str
            The text of the message to display.
        title : str
            The text of the dialog title.
        detail : str
            Further details about the message.
        informative : str
            Explanatory text to display along with the message.
        text_format : str
            Specifies what text format to use in the resulting message dialog.
            One of "auto", "plain", or "rich".

        Nr   r   r   r   r   Úerror®   s    zIWindow.error)F)r   r   r   r   )r"   r   r   r   )r$   r   r   r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   ÚpositionÚsizer   r   r   Úopenedr   ÚopeningZ	activatedÚclosedÚclosingZdeactivatedr	   Zkey_pressedr   r   r   r   r!   r#   r%   r   r   r   r   r      s:   	
    ú
    ú
    úr   c                   @   sP   e Zd ZdZdd„ Zddd„Zddefdd	„Zddd„Zddd„Z	ddd„Z
dS )ÚMWindowzº The mixin class that contains common code for toolkit specific
    implementations of the IWindow interface.

    Implements: close(), confirm(), open()
    Reimplements: _create()
    c                 C   sF   t ƒ  | _}|js4| jdu r$|  ¡  |  d¡ | | _| jduoD|j S )r   NT)r   r-   ÚvetoÚcontrolÚ_createÚshowr,   )r   Úeventr   r   r   r   Õ   s    

zMWindow.openFc                 C   s8   | j dur.tƒ  | _}|s |js.|  ¡  | | _| j du S r   )r2   r   r/   r1   Údestroyr.   )r   r   r5   r   r   r   r   î   s    

zMWindow.closeNc                 C   s   ddl m} || j||||ƒS )r   é   )r   )Zconfirmation_dialogr   r2   )r   r   r   r   r   r   r   r   r   r   
  s    zMWindow.confirmr   r   r   c                 C   s$   ddl m} || j|||||ƒ dS )aS   Convenience method to show an information message dialog.

        Parameters
        ----------
        message : str
            The text of the message to display.
        title : str
            The text of the dialog title.
        detail : str
            Further details about the message.
        informative : str
            Explanatory text to display along with the message.
        text_format : str
            Specifies what text format to use in the resulting message dialog.
            One of "auto", "plain", or "rich". Only supported on the qt
            backend.

        r7   )r!   N)Úmessage_dialogr!   r2   )r   r   r   r   r   r    r!   r   r   r   r!     s    ÿzMWindow.informationr"   c                 C   s$   ddl m} || j|||||ƒ dS )aN   Convenience method to show a warning message dialog.

        Parameters
        ----------
        message : str
            The text of the message to display.
        title : str
            The text of the dialog title.
        detail : str
            Further details about the message.
        informative : str
            Explanatory text to display along with the message.
        text_format : str
            Specifies what text format to use in the resulting message dialog.
            One of "auto", "plain", or "rich". Only supported on the qt
            backend.

        r7   )r#   N)r8   r#   r2   )r   r   r   r   r   r    r#   r   r   r   r#   <  s    ÿzMWindow.warningr$   c                 C   s$   ddl m} || j|||||ƒ dS )aM   Convenience method to show an error message dialog.

        Parameters
        ----------
        message : str
            The text of the message to display.
        title : str
            The text of the dialog title.
        detail : str
            Further details about the message.
        informative : str
            Explanatory text to display along with the message.
        text_format : str
            Specifies what text format to use in the resulting message dialog.
            One of "auto", "plain", or "rich". Only supported on the qt
            backend.

        r7   )r%   N)r8   r%   r2   )r   r   r   r   r   r    r%   r   r   r   r%   \  s    zMWindow.error)F)r   r   r   r   )r"   r   r   r   )r$   r   r   r   )r&   r'   r(   r)   r   r   r   r   r!   r#   r%   r   r   r   r   r0   É   s&   
    ú
#    ú
#    úr0   N)r)   Z
traits.apir   r   r   r   r   r   Zpyface.constantr   Zpyface.key_pressed_eventr	   Zpyface.i_widgetr
   r   r0   r   r   r   r   Ú<module>   s     2