3
7ßL]1  ã            
   @   sö   d dl mZmZmZmZmZmZ d dlmZ d dl	m
Z
mZmZmZmZmZmZmZmZmZmZ edeeee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 )é    )ÚActionÚ
ActionItemÚGroupÚMenuManagerÚMenuBarManagerÚToolBarManager)Úget_unique_id)ÚBoolÚCallableÚEnumÚ	HasTraitsÚInstanceÚListÚPropertyÚStrÚTraitÚTupleÚUnicodeNz&pyface.tasks.action.schema.GroupSchemaz%pyface.tasks.action.schema.MenuSchemaz!pyface.tasks.action.schema.Schemac                   s<   e Zd ZdZeZdd„ ZeeƒZ	‡ fdd„Z
dd„ Z‡  ZS )ÚSchemaz; The abstract base class for all Tasks action schemas.
    c             C   s   t | ƒS )N)r   )Úself© r   ú>/tmp/pip-install-5sebvq2j/pyface/pyface/tasks/action/schema.pyÚ_id_default   s    zSchema._id_defaultc                s"   t t| ƒjf |Ž | jj|ƒ dS )z Creates a new schema.
        N)Úsuperr   Ú__init__ÚitemsÚextend)r   r   Útraits)Ú	__class__r   r   r      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   Úcreate#   s    zSchema.create)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Úidr   r   Ú	SubSchemar   r   r!   Ú__classcell__r   r   )r   r   r      s   r   c               @   s.   e Zd ZdZeeƒZeƒ 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 )Nr   )r   r   r   r   Ú
_get_items;   s    zActionSchema._get_itemsc             C   s   t | jd�}| jf |ŽS )z0 Create the appropriate Pyface Action instance. )r&   )Údictr&   Úaction_factory)r   r    r   r   r   r   r!   >   s    zActionSchema.createN)r"   r#   r$   r%   r
   r   r,   r   r   r*   r!   r   r   r   r   r)   *   s
   	r)   c               @   s(   e Zd ZdZeeƒZedƒZdd„ Z	dS )ÚGroupSchemaz" A schema for a Pyface Group.
    Tc             C   s   t | j| jd�}| j||ŽS )N)r&   Ú	separator)r+   r&   r.   Úgroup_factory)r   r    r   r   r   r   r!   O   s    zGroupSchema.createN)
r"   r#   r$   r%   r
   r   r/   r	   r.   r!   r   r   r   r   r-   E   s   r-   c               @   s4   e Zd ZdZeZedƒZee	ƒZ
eeƒZdd„ ZdS )Ú
MenuSchemaz( A schema for a Pyface MenuManager.
    Fc             C   s0   t | j| j| jd�}| jr$| j|d< | j||ŽS )N)r&   Únamer.   Úaction)r+   r&   r1   r.   r2   Úmenu_manager_factory)r   r    r   r   r   r   r!   d   s    
zMenuSchema.createN)r"   r#   r$   r%   r   r1   r	   r.   r   r   r2   r
   r   r3   r!   r   r   r   r   r0   T   s   r0   c               @   s$   e Zd ZdZdZeeƒZdd„ ZdS )ÚMenuBarSchemaz+ A schema for a Pyface MenuBarManager.
    ZMenuBarc             C   s   t | jd�}| j||ŽS )N)r&   )r+   r&   Úmenu_bar_manager_factory)r   r    r   r   r   r   r!   u   s    zMenuBarSchema.createN)	r"   r#   r$   r%   r&   r
   r   r5   r!   r   r   r   r   r4   k   s   r4   c               @   sN   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eƒZdd	„ Zd
S )ÚToolBarSchemaz+ A schema for a Pyface ToolBarManager.
    ZToolBarzTool Baré   Z
horizontalZverticalTc             C   s,   t | j| j| j| j| j| jd�}| j||ŽS )N)r&   r1   Ú
image_sizeÚorientationÚshow_dividerÚshow_tool_names)r+   r&   r1   r8   r9   r:   r;   Útool_bar_manager_factory)r   r    r   r   r   r   r!   ”   s
    
zToolBarSchema.createN)r7   r7   )r"   r#   r$   r%   r&   r   r1   r   r8   r   r9   r	   r:   r;   r
   r   r<   r!   r   r   r   r   r6   z   s   
r6   ) Zpyface.action.apir   r   r   r   r   r   Zpyface.util.id_helperr   Z
traits.apir	   r
   r   r   r   r   r   r   r   r   r   r'   r   r)   r-   r0   r4   r6   ZSGroupZSMenuZSMenuBarZSToolBarr   r   r   r   Ú<module>   s     4
#