a
    ©ˆcÇ  ã                   @   s@   d dl mZ d dlmZmZmZ d dlmZ G dd„ deƒZdS )é    )ÚPreferencesHelper)ÚCallableÚ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u r6| jdur.| jjj}| j|d�| _ ntdƒ‚| 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   úe/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/envisage/ui/tasks/preferences_pane.pyÚtrait_context9   s    


zPreferencesPane.trait_contextNc                 C   s,   t t| 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   ÚapplyL   s    ÿzPreferencesPane.applyc                    s   |r|   ¡  tƒ  ||¡S )zM Handles the user attempting to close a dialog-based user interface.
        )r   ÚsuperÚclose)r   r   Zis_ok©Ú	__class__r   r   r   T   s    zPreferencesPane.close)N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   ÚidÚcategoryÚbeforeÚafterr   r   r   r   r   r   r   Ú__classcell__r   r   r   r   r      s   
r   N)	Zapptools.preferences.apir   Z
traits.apir   r   r   Ztraitsui.apir   r   r   r   r   r   Ú<module>   s   