3
6ßL]õ  ã               @   sÞ   d Z ddlmZmZ 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 ddlmZmZmZ ddlmZmZ ddlmZ dd	lmZ dd
lmZmZmZmZmZ ddl m!Z!m"Z" ddl#m$Z$ edd�Z%G dd„ deƒZdS )zL A simple scatter-plot template defined as a test for the template package.
é    )ÚHasPrivateTraitsÚ	Undefined)ÚViewÚVGroupÚItemÚLabelÚThemeÚ
TextEditor)ÚThemedSliderEditor)ÚThemedTextEditor)ÚScatterPlotÚArrayPlotDataÚPlot)ÚPanToolÚ
SimpleZoom)Ú
ColorTrait)Úmarker_trait)ÚTemplateÚTRangeÚTStrÚTDerivedÚTDataSource)ÚTemplateDataSourceÚValueDataNameItemé   )ÚEnableEditorÚcopy)Útemplatec               @   sB  e Zd ZeZeZedƒZeddd�Z	e
ddddd�Ze
dd	d
ƒZeddd�Zeddd�ZeZeeedddeeddd�d�d�edddeƒ eddd�d�ƒdd�Zeeeededdd�d�dd�eedeƒ d�ed ƒed!eƒ d�ed"d#eƒ d$�ed%d&d'�ed(d)d'�edd7d�ed*dd�d+�ƒƒZd,d-„ Zd.d/„ Zd0d1„ Zd2d3„ Z d4S )8r   zScatter Plotr   Úupdate)r   Úeventr   é   )r   g        g      @g      ð?ZredZblackÚtitleFÚreadonlyz@GBBÚcenter)Ú	alignment)Ztheme)Ú
show_labelÚstyleÚeditorÚplotTz@GF5r   )Zmargins)r%   Ú	resizabler'   Ú
item_theme)r)   zScatter Plot Options)r*   )Zshow_labels)r'   ÚmarkerÚmarker_sizeÚ
line_widthz
Line Width)Úlabelr'   Úcolorz
Fill Color)r.   Úoutline_colorzOutline Colorz@G0B)Zgroup_themer*   c             C   s   t tddd�gdd�S )z: Returns the default value for the 'index' trait.
        ÚindexT)ÚnameÚflattenzScatter Plot Index)ÚitemsÚdescription)r   r   )Úself© r7   úI/tmp/pip-install-5sebvq2j/apptools/apptools/template/test/scatter_plot.pyÚ_index_default’   s    zScatterPlot._index_defaultc             C   s   t tddd�gdd�S )z: Returns the default value for the 'value' trait.
        ÚvalueT)r2   r3   zScatter Plot Value)r4   r5   )r   r   )r6   r7   r7   r8   Ú_value_defaultš   s    zScatterPlot._value_defaultc             C   sº   | j jtks| jjtkrdS tƒ }|jd| j jƒ |jd| jjƒ t|ƒ | _}|jddd| j| j	| j
| j| jdd�	 |jdd	d	d
d� |jjt|dd�ƒ t|ddd�}|jj|ƒ dS )zì Converts all contained 'TDerived' objects to real objects using the
            template traits of the object. This method must be overridden in
            subclasses.

            Returns
            -------
            None
        Nr1   r:   ZscatterZ	ascendingZwhite)ÚtypeZ
index_sortr+   r/   r0   r,   r-   Zbgcoloré2   r   é   )Zpadding_leftZpadding_rightZpadding_topZpadding_bottomÚshift)Zconstrain_keyZboxF)Ú	componentZ	tool_modeZ	always_on)r1   r:   )r1   Zcontext_datar   r:   r   Úset_datar   r(   r+   r/   r0   r,   r-   ÚsetZtoolsÚappendr   r   Zoverlays)r6   Úpdr(   Zzoomr7   r7   r8   Úactivate_template¤   s0    zScatterPlot.activate_templatec             C   s
   t | _dS )z. Handles a plot option being changed.
        N)r   r(   )r6   r7   r7   r8   Ú_update_changedÐ   s    zScatterPlot._update_changedNéûÿÿÿéÿÿÿÿ)rG   rH   )!Ú__name__Ú
__module__Ú__qualname__r   r1   r:   r   r!   r   r+   r   r,   r-   ÚTColorr/   r0   r   r(   r   r   r   r   r   r   Ztemplate_viewr   r	   r
   Zoptions_viewr9   r;   rE   rF   r7   r7   r7   r8   r   A   sV   



,r   N)&Ú__doc__Z
traits.apir   r   Ztraitsui.apir   r   r   r   r   r	   Z traitsui.wx.themed_slider_editorr
   Ztraitsui.wx.themed_text_editorr   Z	chaco.apir   r   r   Zchaco.tools.apir   r   Z
enable.apir   Zchaco.scatter_markersr   Zapptools.template.apir   r   r   r   r   Zapptools.template.impl.apir   r   Zenable_editorr   rL   r7   r7   r7   r8   Ú<module>   s    
