a
    ¦ˆc  ã                   @   sP   d 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	G dd„ deƒZ
dS )	z The spin field interface. é    )Ú	HasTraitsÚIntÚPropertyÚRangeÚTuple)ÚIFieldc                   @   s>   e Zd ZdZeddd�ZeeeƒZe	edd�Z
e	edd�ZdS )Ú
ISpinFieldzQ The spin field interface.

    This is for spinners holding integer values.
    ÚminimumÚmaximum©ÚlowÚhighÚbounds©ÚobserveN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Úvaluer   r   r   r   r	   r
   © r   r   ú]/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/pyface/fields/i_spin_field.pyr      s
   
r   c                       s®   e Zd Zeddd�ZeeeƒZeedd�Z	eedd�Z
‡ fdd„Z‡ fdd	„Z‡ fd
d„Z‡ fdd„Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Z‡  ZS )Ú
MSpinFieldr	   r
   r   r   r   c                    sH   |  dd ¡}d|v r$|d d |d< tƒ jf i |¤Ž |d urD|| _d S )Nr   r   r   )ÚpopÚsuperÚ__init__r   )ÚselfZtraitsr   ©Ú	__class__r   r   r   8   s    zMSpinField.__init__c                    s&   t ƒ  ¡  |  | j¡ |  | j¡ d S ©N)r   Ú_initialize_controlÚ_set_control_boundsr   Z_set_control_valuer   ©r   r   r   r   r    D   s    
zMSpinField._initialize_controlc                    s2   t ƒ  ¡  | j| jddd� | jdur.|  ¡  dS )z- Set up toolkit-specific bindings for events r   Úui)ÚdispatchN)r   Ú_add_event_listenersr   Ú_bounds_updatedÚcontrolÚ_observe_control_valuer"   r   r   r   r%   I   s    

zMSpinField._add_event_listenersc                    s8   | j dur| jdd� | j| jdddd� tƒ  ¡  dS )z- Remove toolkit-specific bindings for events NT)Úremover   r#   )r$   r)   )r'   r(   r   r&   r   Ú_remove_event_listenersr"   r   r   r   r*   P   s    

ÿz"MSpinField._remove_event_listenersc                 C   s
   t ƒ ‚dS )z6 Toolkit specific method to get the control's bounds. N©ÚNotImplementedErrorr"   r   r   r   Ú_get_control_bounds[   s    zMSpinField._get_control_boundsc                 C   s
   t ƒ ‚dS )z6 Toolkit specific method to set the control's bounds. Nr+   )r   r   r   r   r   r!   _   s    zMSpinField._set_control_boundsc                 C   s
   | j d S ©Nr   ©r   r"   r   r   r   Ú_get_minimume   s    zMSpinField._get_minimumc                 C   s6   || j kr||f| _n|| j f| _|| jkr2|| _d S r   )r
   r   r   ©r   r   r   r   r   Ú_set_minimumh   s
    

zMSpinField._set_minimumc                 C   s
   | j d S )Né   r/   r"   r   r   r   Ú_get_maximump   s    zMSpinField._get_maximumc                 C   s6   || j k r||f| _n| j |f| _|| jk r2|| _d S r   )r	   r   r   r1   r   r   r   Ú_set_maximums   s
    

zMSpinField._set_maximumc                 C   s
   | j d S r.   r/   r"   r   r   r   Ú_value_default}   s    zMSpinField._value_defaultc                 C   s   | j d ur|  | j¡ d S r   )r'   r!   r   )r   Úeventr   r   r   r&   ‚   s    
zMSpinField._bounds_updated)r   r   r   r   r   r   r   r   r   r	   r
   r   r    r%   r*   r-   r!   r0   r2   r4   r5   r6   r&   Ú__classcell__r   r   r   r   r   &   s    

r   N)r   Z
traits.apir   r   r   r   r   Zpyface.fields.i_fieldr   r   r   r   r   r   r   Ú<module>   s   