3
7ßL]o%  ã               @   sh   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
 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ÚTupleÚUnicodeÚ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 )a�   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   ú3/tmp/pip-install-5sebvq2j/pyface/pyface/i_window.pyÚopenF   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   ÚcloseU   s    zIWindow.closeNc             C   s   dS )aš   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   Úconfirmj   s    zIWindow.confirmÚInformationÚ c             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.

        Nr   )r   r   r   ÚdetailÚinformativer   r   r   Úinformationy   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.

        Nr   )r   r   r   r   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.

        Nr   )r   r   r   r   r   r   r   r   Úerror›   s    zIWindow.error)F)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kr$| jƒ  | jdƒ | | _| jdk	oD|j S )a�   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.
        NT)r   r&   ÚvetoÚcontrolZ_createÚshowr%   )r   Úeventr   r   r   r   ¸   s    

zMWindow.openFc             C   s:   | j dk	r0tƒ  | _}|s"|j r0| jƒ  | | _| j dk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.
        N)r+   r   r(   r*   Údestroyr'   )r   r   r-   r   r   r   r   Ñ   s    
zMWindow.closeNc             C   s   ddl m} || j||||ƒS )aš   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.
        é   )r   )Zconfirmation_dialogr   r+   )r   r   r   r   r   r   r   r   r   r   í   s    zMWindow.confirmr   r   c             C   s"   ddl m} || j||||ƒ 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.

        r/   )r   N)Úmessage_dialogr   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 )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.

        r/   )r   N)r0   r   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 )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.

        r/   )r   N)r0   r   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)   ¬   s   


r)   N)r"   Z
traits.apir   r   r   r   r   Zpyface.constantr   Zpyface.key_pressed_eventr   Zpyface.i_widgetr	   r
   Úobjectr)   r   r   r   r   Ú<module>   s    