a
    ¦ˆcn  ã                   @   sP   d Z ddlmZmZmZmZmZ ddlmZ G dd„ deƒZ	G dd„ deƒZ
dS )	zTThe interface for a dialog that allows the user to display progress of an
operation.é    )ÚAnyÚBoolÚ	HasTraitsÚIntÚStr)ÚIDialogc                   @   sX   e Zd ZdZeƒ Zeƒ Zeƒ ZedƒZ	e
dƒZe
dƒZe
dƒZeƒ Zdd„ Zdd„ ZdS )	ÚIProgressDialogzG A simple progress dialog window which allows itself to be updated
    é   Fc                 C   s   dS ©a   Update the progress bar to the desired value

        If the value is >= the maximum and the progress bar is not contained
        in another panel the parent window will be closed.

        Parameters
        ----------
        value :
            The progress value to set.
        N© ©ÚselfÚvaluer   r   ú[/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/pyface/i_progress_dialog.pyÚupdate7   s    zIProgressDialog.updatec                 C   s   dS ©z® Change the displayed message in the progress dialog

        Parameters
        ----------
        message : str or unicode
            The new message to display.

        Nr   ©r   Úmessager   r   r   Úchange_messageC   s    zIProgressDialog.change_messageN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   ÚminÚmaxÚmarginr   Z
can_cancelZ	show_timeZshow_percentZcancel_button_labelr   r   r   r   r   r   r      s   r   c                       s6   e Zd ZdZeƒ Z‡ fdd„Zdd„ Zdd„ Z‡  Z	S )ÚMProgressDialogz” The mixin class that contains common code for toolkit specific
    implementations of the IProgressDialog interface.

    Implements: update()
    c                    s2   | j | jk r$d}t| | j| j ¡ƒ‚tƒ  ¡  dS )z Open the dialog z0Dialog min ({}) is greater than dialog max ({}).N)r   r   ÚAttributeErrorÚformatÚsuperÚopen)r   Úmsg©Ú	__class__r   r   r    ]   s    zMProgressDialog.openc                 C   s,   | j dur| j  |¡ || jkr(|  ¡  dS r
   )Úprogress_barr   r   Úcloser   r   r   r   r   i   s    

zMProgressDialog.updatec                 C   s
   || _ dS r   )r   r   r   r   r   r   {   s    	zMProgressDialog.change_message)
r   r   r   r   r   r$   r    r   r   Ú__classcell__r   r   r"   r   r   N   s
   r   N)r   Z
traits.apir   r   r   r   r   Zpyface.i_dialogr   r   r   r   r   r   r   Ú<module>   s   9