3
8ßL]í  ã               @   s°   d Z ddlmZ ddlmZmZmZ ddlmZ ddl	m
Z
 ddlmZmZ ddlmZ G d	d
„ d
eƒZdd
dgdfdd„Zdd
ddgdfdd„ZG dd„ deƒZddd„ZdS )z3 Displays a message to the user as a modal window.
é    )Úabsolute_import)ÚHasPrivateTraitsÚStrÚFloaté   )ÚView)ÚHGroup)ÚItemÚspring)Údo_afterc               @   s   e Zd ZeZdS )ÚMessageN)Ú__name__Ú
__module__Ú__qualname__r   Úmessage© r   r   ú6/tmp/pip-install-5sebvq2j/traitsui/traitsui/message.pyr   *   s   r   Ú ÚOKNc             C   s.   t | d�}|j|tddg||dd�d�}|jS )a   Displays a message to the user as a model window with the specified
    title and buttons.

    If *buttons* is not specified, a single **OK** button is used, which is
    appropriate for notifications, where no further action or decision on the
    user's part is required.
    )r   zmessage~z|<>Úmodal)ÚtitleÚbuttonsÚkind)ÚparentÚview)r   Úedit_traitsr   Úresult)r   r   r   r   ÚmsgÚuir   r   r   r   8   s    	
r   ZCancelc             C   s.   t | d�}|j|tddg||dd�d�}|jS )am   Displays a message to the user as a modal window with the specified
    title and buttons.

    If *buttons* is not specified, **OK** and **Cancel** buttons are used,
    which is appropriate for confirmations, where the user must decide whether
    to proceed. Be sure to word the message so that it is clear that clicking
    **OK** continues the operation.
    )r   zmessage~z|<>r   )r   r   r   )r   r   )r   r   r   r   )r   r   r   r   r   r   r   r   r   ÚerrorN   s    

r   c               @   s&   e Zd ZedƒZedƒZddd„ZdS )ÚAutoCloseMessagezPlease waitg       @Nr   c             C   sB   t tttdddd�tƒ|d�}ttd| j ƒ| j||d�jƒ dS )	z: Display the wait message for a limited duration.
        r   FÚreadonly)Z
show_labelÚstyle)r   g     @�@)r   r   N)	r   r   r
   r	   r   ÚintÚtimer   Zdispose)Úselfr   r   r   r   r   r   Úshowm   s    zAutoCloseMessage.show)Nr   )r   r   r   r   r   r   r$   r&   r   r   r   r   r    e   s   r    úPlease waitç       @c             C   s   t | |d�}|j||d� dS )z¯ Displays a message to the user as a modal window with no buttons. The
        window closes automatically after a specified time interval (specified
        in seconds).
    )r   r$   )r   r   N)r    r&   )r   r$   r   r   r   r   r   r   Úauto_close_message…   s    r)   )r'   r(   r'   N)Ú__doc__Ú
__future__r   Z
traits.apir   r   r   r   r   Úgroupr   Úitemr	   r
   Zpyface.timer.apir   r   r   r   r    r)   r   r   r   r   Ú<module>   s   
  