a
    ©ˆcŸ  ã                   @   s`   d dl mZmZmZ d dlmZmZmZ ddlm	Z	 d 
e d¡dd… ¡ZG dd	„ d	eƒZdS )
é    )ÚExtensionPointÚPluginÚServiceOffer)ÚCallableÚInstanceÚListé   )ÚPreferencesCategoryÚ.Néÿÿÿÿc                   @   s¸   e Zd ZdZed Zed Zed Zed ZdZ	dZ
dZeeeƒed	d
�Zeeeƒedd
�Zeeedƒƒedd
�Zeeedƒƒedd
�Zee	d�Zdd„ Zeed�Zdd„ Zdd„ ZdS )ÚTasksPluginz¾ The Envisage Tasks plugin.

    The Tasks plugin uses Pyface Tasks to provide an extensible framework for
    building user interfaces. For more information, see the Tasks User Manual.
    z.preferences_categoriesz.preferences_panesz.tasksz.task_extensionszenvisage.service_offerszenvisage.ui.tasksZTasksa1  

        This extension point makes preference categories available to the
        application. Note that preference categories will be created
        automatically if necessary; this extension point is useful when one
        wants to ensure that a category is inserted at a specific location.
        )ÚidÚdescaþ  

        A preferences pane appears in the preferences dialog to allow the user
        manipulate certain preference values.

        Each contribution to this extension point must be a factory that
        creates a preferences pane, where 'factory' means any callable with the
        following signature::

          callable(**traits) -> PreferencesPane

        The easiest way to contribute such a factory is to create a class
        that derives from 'envisage.ui.tasks.api.PreferencesPane'.
        z*envisage.ui.tasks.task_factory.TaskFactoryzÂ

        This extension point makes tasks avaiable to the application.

        Each contribution to the extension point must be an instance of
        'envisage.tasks.api.TaskFactory.
        z.envisage.ui.tasks.task_extension.TaskExtensiona  

        This extension point permits the contribution of new actions and panes
        to existing tasks (without creating a new task).

        Each contribution to the extension point must be an instance of
        'envisage.tasks.api.TaskExtension'.
        )Zcontributes_toc                 C   s   t d| jd�}|gS )Nz6envisage.ui.tasks.preferences_dialog.PreferencesDialog)ÚprotocolÚfactory)r   Ú"_create_preferences_dialog_service)ÚselfZ preferences_dialog_service_offer© r   úa/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/envisage/ui/tasks/tasks_plugin.pyÚ_my_service_offers_defaultv   s
    þz&TasksPlugin._my_service_offers_defaultc                 C   sh   ddl m} ddlm} ddlm} ddlm}m} |d|dd	�|d
|dd	�|d|dd	�g}||d�gS )Nr   )Ú
ExitAction)ÚPreferencesGroup)ÚTaskExtensionr   )ÚDockPaneToggleGroupÚSchemaAdditionZExitzMenuBar/File)r   r   ÚpathZPreferenceszMenuBar/Editr   zMenuBar/View)Úactions)	Zaction.exit_actionr   Zaction.preferences_actionr   Ztask_extensionr   Zpyface.tasks.action.apir   r   )r   r   r   r   r   r   r   r   r   r   Ú_my_task_extensions_default€   s    ÿýûz'TasksPlugin._my_task_extensions_defaultc                    s<   ddl m} || jd�‰ ˆ j| j‡ fdd„| jD ƒd� ˆ S )z8 Factory method for preferences dialog service.
        r   )ÚPreferencesDialog)Úapplicationc                    s   g | ]}|ˆ d �‘qS )©Údialogr   )Ú.0r   r    r   r   Ú
<listcomp>    s   zBTasksPlugin._create_preferences_dialog_service.<locals>.<listcomp>)Ú
categoriesZpanes)Zpreferences_dialogr   r   Z	trait_setÚpreferences_categoriesÚpreferences_panes)r   r   r   r    r   r   ˜   s    
ÿþz.TasksPlugin._create_preferences_dialog_serviceN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚPKGZPREFERENCES_CATEGORIESZPREFERENCES_PANESZTASKSZTASK_EXTENSIONSZSERVICE_OFFERSr   Únamer   r   r	   r%   r   r&   r   ZtasksZtask_extensionsZmy_service_offersr   Zmy_task_extensionsr   r   r   r   r   r   r      sB   ýý
ý
ý

r   )Zenvisage.apir   r   r   Z
traits.apir   r   r   Zpreferences_categoryr	   Újoinr'   Úsplitr+   r   r   r   r   r   Ú<module>   s   