3
6ßL]g  ã               @   sL   d dl mZm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dS )é    )ÚIPreferencesÚPreferencesHelper)ÚCallableÚDictÚ	HasTraitsÚInstanceÚStr)Ú
Controllerc                   sb   e Zd ZdZeeƒZeZedƒZ	eZ
eZedƒZeZeeƒZdd„ Zddd„Z‡ fd	d
„Z‡  ZS )ÚPreferencesPanez6 A panel for configuring application preferences.
    ZGeneralz6envisage.ui.tasks.preferences_dialog.PreferencesDialogc             C   sX   | j dkr6| jdk	r.| jjj}| j|d�| _ ntdƒ‚| j jƒ | _d| j_| j| | dœS )zn Re-implemented to use a copy of the model that is not connected to
            the preferences node.
        N)Úpreferencesz%A preferences pane must have a model!)ÚobjectÚ
controllerÚhandler)ÚmodelÚmodel_factoryÚdialogZapplicationr   Ú
ValueErrorZclone_traitsÚ_model)Úselfr   © r   úH/tmp/pip-install-5sebvq2j/envisage/envisage/ui/tasks/preferences_pane.pyÚtrait_context/   s    


zPreferencesPane.trait_contextNc             C   s,   t t| jj| jjƒ ƒƒ}| jj| j|ƒ dS )z1 Handles the Apply button being clicked.
        N)ÚlistÚfilterr   Z_is_preference_traitÚtrait_namesr   Zcopy_traits)r   Úinfor   r   r   r   ÚapplyB   s    
zPreferencesPane.applyc                s   |r| j ƒ  tt| ƒj||ƒS )zM Handles the user attempting to close a dialog-based user interface.
        )r   Úsuperr
   Úclose)r   r   Zis_ok)Ú	__class__r   r   r   I   s    zPreferencesPane.close)N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   ÚidÚcategoryZbeforeÚafterr   r   r   r   r   r   r   Ú__classcell__r   r   )r   r   r
      s   
r
   N)Zapptools.preferences.apir   r   Z
traits.apir   r   r   r   r   Ztraitsui.apir	   r
   r   r   r   r   Ú<module>   s   