3
8ßL]ù  ã               @   sd   d dl mZ d dlZd dl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 )
é    )Úabsolute_importN)ÚInstanceÚIntÚStr)ÚEditor)ÚProgressDialogc               @   s   e Zd Zdd„ ZdS )Ú_ProgressDialogc             C   s   dS )z) Overwritten to disable closing.
        N© )Úselfr	   r	   úA/tmp/pip-install-5sebvq2j/traitsui/traitsui/wx/progress_editor.pyÚclose   s    z_ProgressDialog.closeN)Ú__name__Ú
__module__Ú__qualname__r   r	   r	   r	   r   r   	   s   r   c               @   sT   e Zd ZdZeeƒZeZe	Z
e	Zdd„ Zdd„ Zdd„ Zdd	„ Zd
d„ Zdd„ ZdS )ÚSimpleEditorz<
    Show a progress bar with all the optional goodies

    c             C   sf   | j |ƒ| _| j}|j| _|j| _|j| _| j|jddƒ | j|jddƒ | j|j	ddƒ | j
ƒ  dS )za Finishes initializing the editor by creating the underlying toolkit
            widget.
        ÚminÚfromÚmaxÚmessageN)Úcreate_controlÚcontrolÚfactoryr   r   r   Z
sync_valueZmin_nameZmax_nameZmessage_nameZset_tooltip)r
   Úparentr   r	   r	   r   Úinit$   s    zSimpleEditor.initc          	   C   sà   t | jj| jj| jj| jj| jj| jj| jjd�| _	t
j|dƒ}t
jt
jƒ}|j|ƒ |jdƒ |jt
jƒ t
jƒ | j	_| j	j||ƒ | j	j||ƒ | j	j||ƒ | j	j||ƒ | j	j||ƒ |j| j	jƒ |jƒ  || _| jS )zU
        Finishes initializing the editor by creating the underlying widget.
        )Útitler   r   r   Ú
can_cancelÚ	show_timeÚshow_percenté   Téÿÿÿÿ)r   r   r   r   r   r   r   r   r   ÚprogressÚwxZPanelZBoxSizerZVERTICALZSetSizerZSetAutoLayoutZSetBackgroundColourZ
NullColourÚSizeZdialog_sizeZ_create_messageZ_create_gaugeZ_create_percentZ_create_timerZ_create_buttonsZSetClientSizeZCentreOnParentr   )r
   r   ZpanelZsizerr	   r	   r   r   2   s,    

zSimpleEditor.create_controlc             C   s:   | j | j_ | j| j_| jj| jƒ | jr6| jj| jƒ dS )zd
        Updates the editor when the object trait changes externally to the
        editor.
        N)r   r    r   Zchange_messager   ÚvalueÚupdate)r
   r	   r	   r   Úupdate_editorV   s    

zSimpleEditor.update_editorc             C   s   | j ƒ  d S )N)r%   )r
   r	   r	   r   Ú_min_changedb   s    zSimpleEditor._min_changedc             C   s   | j ƒ  d S )N)r%   )r
   r	   r	   r   Ú_max_changede   s    zSimpleEditor._max_changedc             C   s   | j ƒ  d S )N)r%   )r
   r	   r	   r   Ú_message_changedh   s    zSimpleEditor._message_changedN)r   r   r   Ú__doc__r   r   r    r   r   r   r   r   r   r   r%   r&   r'   r(   r	   r	   r	   r   r      s   $r   )Ú
__future__r   r!   Z
traits.apir   r   r   Ztraitsui.wx.editorr   Zpyface.ui.wx.progress_dialogr   r   r   r	   r	   r	   r   Ú<module>   s   