a
    ¦ˆc(  ã                
   @   sæ   d Z ddlmZmZmZmZmZmZmZm	Z	m
Z
mZ ddlmZ ededƒedƒedƒedƒed	ƒed
ƒedƒƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZeZeZeZeZdS )z: Schema class definitions

This module defines the Schema
é    )
ÚBoolÚCallableÚEnumÚ	HasTraitsÚInstanceÚListÚPropertyÚStrÚTupleÚUnion©Úget_unique_idNúpyface.action.action.Actionz$pyface.action.action_item.ActionItemzpyface.action.group.Groupz&pyface.action.menu_manager.MenuManagerz'pyface.action.schema.schema.GroupSchemaz&pyface.action.schema.schema.MenuSchemaz"pyface.action.schema.schema.Schemac                       s>   e Zd ZdZeƒ ZeeƒZ‡ fdd„Z	dd„ Z
dd„ Z‡  ZS )ÚSchemaz5 The abstract base class for all action schemas.
    c                    s"   t ƒ jf i |¤Ž | j |¡ dS )z Creates a new schema.
        N)ÚsuperÚ__init__ÚitemsÚextend)Úselfr   Útraits©Ú	__class__© ú^/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/pyface/action/schema/schema.pyr   <   s    zSchema.__init__c                 C   s
   t ƒ ‚dS )zc Create the appropriate pyface.action instance with the specified
            child items.
        N)ÚNotImplementedError)r   Úchildrenr   r   r   ÚcreateB   s    zSchema.createc                 C   s   t | ƒS ©Nr   ©r   r   r   r   Ú_id_defaultJ   s    zSchema._id_default)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r	   Úidr   Ú	SubSchemar   r   r   r   Ú__classcell__r   r   r   r   r   1   s   r   c                   @   s4   e Zd ZdZeƒ Zeƒ Zdd„ Zdd„ Z	dd„ Z
dS )	ÚActionSchemaa’   Action schema for Pyface Actions.

    An action schema cannot have children. It is used as an action factory
    to make sure a larger schema (e.g., a menu schema) can be used multiple
    times. Without using an ActionSchema, a reference to the action is added
    to every menu created from the schema. When one of the menus is destroyed,
    the action is also destroyed and is made unusable.
    c                 C   s   g S r   r   r   r   r   r   Ú
_get_items_   s    zActionSchema._get_itemsc                 C   s   t | jd�}| jf i |¤ŽS )z0 Create the appropriate Pyface Action instance. ©r$   )Údictr$   Úaction_factory©r   r   r   r   r   r   r   b   s    zActionSchema.createc                 C   s   ddl m} |S )Nr   )ÚAction)Zpyface.action.actionr-   )r   r-   r   r   r   Ú_action_factory_defaultj   s    z$ActionSchema._action_factory_defaultN)r    r!   r"   r#   r   r+   r   r   r(   r   r.   r   r   r   r   r'   N   s   
r'   c                   @   s.   e Zd ZdZeƒ ZedƒZdd„ Zdd„ Z	dS )ÚGroupSchemaz" A schema for a Pyface Group.
    Tc                 C   s    t | j| jd�}| j|i |¤ŽS )N)r$   Ú	separator)r*   r$   r0   Úgroup_factoryr,   r   r   r   r   y   s    zGroupSchema.createc                 C   s   ddl m} |S )Nr   )ÚGroup)Zpyface.action.groupr2   )r   r2   r   r   r   Ú_group_factory_default   s    z"GroupSchema._group_factory_defaultN)
r    r!   r"   r#   r   r1   r   r0   r   r3   r   r   r   r   r/   o   s
   r/   c                   @   s<   e Zd ZdZeƒ ZedƒZedƒZ	e
ƒ Zdd„ Zdd„ ZdS )	Ú
MenuSchemaz( A schema for a Pyface MenuManager.
    Fr   c                 C   s4   t | j| j| jd�}| jr$| j|d< | j|i |¤ŽS )N)r$   Únamer0   Úaction)r*   r$   r5   r0   r6   Úmenu_manager_factoryr,   r   r   r   r   ”   s    
zMenuSchema.createc                 C   s   ddl m} |S )Nr   )ÚMenuManager)Zpyface.action.menu_managerr8   )r   r8   r   r   r   Ú_menu_manager_factory_defaultœ   s    z(MenuSchema._menu_manager_factory_defaultN)r    r!   r"   r#   r	   r5   r   r0   r   r6   r   r7   r   r9   r   r   r   r   r4   „   s   r4   c                   @   s*   e Zd ZdZdZeƒ Zdd„ Zdd„ ZdS )ÚMenuBarSchemaz+ A schema for a Pyface MenuBarManager.
    ZMenuBarc                 C   s   t | jd�}| j|i |¤ŽS )Nr)   )r*   r$   Úmenu_bar_manager_factoryr,   r   r   r   r   «   s    zMenuBarSchema.createc                 C   s   ddl m} |S )Nr   )ÚMenuBarManager)Zpyface.action.menu_bar_managerr<   )r   r<   r   r   r   Ú!_menu_bar_manager_factory_default±   s    z/MenuBarSchema._menu_bar_manager_factory_defaultN)	r    r!   r"   r#   r$   r   r;   r   r=   r   r   r   r   r:   ¡   s
   r:   c                   @   sT   e Zd ZdZdZedƒZedƒZe	ddƒZ
edƒZedƒZeƒ Zdd	„ Zd
d„ ZdS )ÚToolBarSchemaz+ A schema for a Pyface ToolBarManager.
    ZToolBarzTool Bar)é   r?   Z
horizontalZverticalTc                 C   s0   t | j| j| j| j| j| jd�}| j|i |¤ŽS )N)r$   r5   Ú
image_sizeÚorientationÚshow_dividerÚshow_tool_names)r*   r$   r5   r@   rA   rB   rC   Útool_bar_manager_factoryr,   r   r   r   r   Ð   s    úzToolBarSchema.createc                 C   s   ddl m} |S )Nr   )ÚToolBarManager)Zpyface.action.tool_bar_managerrE   )r   rE   r   r   r   Ú!_tool_bar_manager_factory_defaultÝ   s    z/ToolBarSchema._tool_bar_manager_factory_defaultN)r    r!   r"   r#   r$   r	   r5   r
   r@   r   rA   r   rB   rC   r   rD   r   rF   r   r   r   r   r>   ¶   s   
r>   )r#   Z
traits.apir   r   r   r   r   r   r   r	   r
   r   Zpyface.util.id_helperr   r%   r   r'   r/   r4   r:   r>   ZSGroupZSMenuZSMenuBarZSToolBarr   r   r   r   Ú<module>   s,   0ø!-