o
    :ήcT                     @   sT   d dl ZddlmZ ddlmZmZ ddlmZ dgZ	dej
 ZG d	d deZdS )
    N   )Plugin   )ComboBoxSlider)	PaintToolLabelPainter   c                       sz   e Zd Zd Zd fdd	Zdd Z fddZdd	 Zd
d Ze	dd Z
e
jdd Z
e	dd Zejdd Z  ZS )r      c                    s~   t t| jdi | tdd|dddd| _dd td	D }d
|d< td|dd| _| | j | | j t	| 
  d S )Nradiusr      intplugin)lowhighvalue
value_typeptypec                 S   s   g | ]}t |qS  )str).0ir   r   I/tmp/pip-target-vg8gfxp4/lib/python/skimage/viewer/plugins/labelplugin.py
<listcomp>   s    z)LabelPainter.__init__.<locals>.<listcomp>   Eraser   label)r   r   )superr   __init__r   _radius_widgetranger   _label_widget
add_widgetprinthelp)self
max_radiuskwargslabels	__class__r   r   r      s   zLabelPainter.__init__c                 C   s   d}d |S )N)zLabel painterz+Hold left-mouse button and paint on canvas.
)join)r%   helpstrr   r   r   r$      s   
zLabelPainter.helpc                    sV   t t| | |j}t||j| jd| _| j| j_d | j_	| j
_| j| j d S )N)on_enterr   )r   r   attachoriginal_imager   shaper.   
paint_toolr   r   r!   indexartistsappend)r%   image_viewerimager)   r   r   r/   $   s   
zLabelPainter.attachc                 C   s   |j | j_ dS )zUpdate plugin for new images.N)r1   r2   )r%   r7   r   r   r   _on_new_image.   s   zLabelPainter._on_new_imagec                 C   s   d S Nr   )r%   overlayr   r   r   r.   2   s   zLabelPainter.on_enterc                 C      | j jS r9   )r   valr%   r   r   r   r   5      zLabelPainter.radiusc                 C      || j _d S r9   )r2   r   r%   r<   r   r   r   r   9      c                 C   r;   r9   )r!   r<   r=   r   r   r   r   =   r>   zLabelPainter.labelc                 C   r?   r9   )r2   r   r@   r   r   r   r   A   rA   )r
   )__name__
__module____qualname__namer   r$   r/   r8   r.   propertyr   setterr   __classcell__r   r   r)   r   r      s    



)numpynpbaser   widgetsr   r   canvastoolsr   __all__pirad2degr   r   r   r   r   <module>   s    
