3
8ßL]n  ã               @   st   d dl mZ d dlZd dlmZm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)ÚQtGuiÚQtCore)Ú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   úB/tmp/pip-install-5sebvq2j/traitsui/traitsui/qt4/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ƒ }|| _t
j| jƒ}|jddddƒ | 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_percentr   )r
   r   r   r   r   r   r   r   r   Úprogressr   ZQWidgetr   ZQVBoxLayoutZsetContentsMarginsZ_create_messageZ_create_gaugeZ_create_percentZ_create_timerZ_create_buttons)r   r   r   Zlayoutr   r   r   r   4   s"    zSimpleEditor.create_controlc             C   s6   | j | j_ | j| j_| j| j_| jr2| jj| jƒ dS )zd
        Updates the editor when the object trait changes externally to the
        editor.
        N)r   r    r   r   ÚvalueÚupdate)r   r   r   r   Úupdate_editorN   s    


zSimpleEditor.update_editorc             C   s   | j ƒ  d S )N)r#   )r   r   r   r   Ú_min_changedZ   s    zSimpleEditor._min_changedc             C   s   | j ƒ  d S )N)r#   )r   r   r   r   Ú_max_changed]   s    zSimpleEditor._max_changedc             C   s   | j ƒ  d S )N)r#   )r   r   r   r   Ú_message_changed`   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   ÚtimeZ	pyface.qtr   r   Z
traits.apir   r   r   Ztraitsui.qt4.editorr   Zpyface.ui.qt4.progress_dialogr	   r
   r   r   r   r   r   Ú<module>   s   