o
    tf                     @   sz  d Z ddlmZmZ ddlmZ ddlmZmZm	Z	 ddl
mZ ddlmZmZmZ ddlmZ dd	lmZmZmZ G d
d deeZeG dd deZeG dd deZeG dd deZeG dd deZG dd deeeZeG dd deZeG dd deZeG dd deZeG dd deZeG dd deZ eG d d! d!e Z!eG d"d# d#e Z"d$S )%z;String class.

Represents a unicode string using a widget.
   )DescriptionStyleDescriptionWidget)ValueWidget)CallbackDispatcherregisterwidget_serialization)
CoreWidget)ColorInstanceDict
TypedTuple)deprecation    )UnicodeBoolIntc                   @   sb   e Zd ZdZedjddZeddddjddZeddddjddZe	ddd	djddZ
dS )
_StringStyleText input style widget.ZStringStyleModelTsyncNzBackground specifications.
allow_nonehelpzText font size.z
Text color)__name__
__module____qualname____doc__r   tag_model_name
backgroundZ	font_sizer	   Z
text_color r   r   i/var/www/html/software/conda/envs/catlas/lib/python3.10/site-packages/ipywidgets/widgets/widget_string.pyr      s    r   c                   @   s   e Zd ZdZedjddZeddddjddZeddddjddZeddd	djddZ	eddd
djddZ
eddddjddZdS )
LabelStylezLabel style widget.ZLabelStyleModelTr   NzLabel text font family.r   zLabel text font style.zLabel text font variant.zLabel text font weight.zLabel text decoration.)r   r   r   r   r   r   r   Zfont_familyZ
font_styleZfont_variantZfont_weightZtext_decorationr   r   r   r    r!      s    r!   c                   @       e Zd ZdZedjddZdS )	TextStyler   ZTextStyleModelTr   Nr   r   r   r   r   r   r   r   r   r   r    r#   %       r#   c                   @   r"   )	HTMLStylezHTML style widget.ZHTMLStyleModelTr   Nr$   r   r   r   r    r&   *   r%   r&   c                   @   r"   )HTMLMathStylezHTML with math style widget.ZHTMLMathStyleModelTr   Nr$   r   r   r   r    r'   /   r%   r'   c                       sp   e Zd ZdZeddjddZedddjddZee	jdddie
Zd fd
d	ZedjddZ  ZS )_Stringz:Base class used to create widgets that represent a string.zString valuer   Tr   u   ​z7Placeholder text to display when nothing has been typedr   Nc                    s&   |d ur||d< t  jdi | d S )Nvaluer   )super__init__)selfr*   kwargs	__class__r   r    r,   @   s   z_String.__init__ZStringModelr   N)r   r   r   r   r   r   r*   placeholderr
   r   r   styler,   r   __classcell__r   r   r/   r    r(   5   s    r(   c                   @   H   e Zd ZdZedjddZedjddZee	jdddie
ZdS )	HTMLz#Renders the string `value` as HTML.ZHTMLViewTr   Z	HTMLModelr   Nr   )r   r   r   r   r   r   
_view_namer   r
   r&   r   r3   r   r   r   r    r6   G   
    r6   c                   @   r5   )	HTMLMathz;Renders the string `value` as HTML, and render mathematics.ZHTMLMathViewTr   ZHTMLMathModelr   Nr   )r   r   r   r   r   r   r7   r   r
   r'   r   r3   r   r   r   r    r9   N   r8   r9   c                   @   r5   )	LabelzLabel widget.

    It also renders math inside the string `value` as Latex (requires $ $ or
    $$ $$ and similar latex tags).
    Z	LabelViewTr   Z
LabelModelr   Nr   )r   r   r   r   r   r   r7   r   r
   r!   r   r3   r   r   r   r    r:   V   s
    r:   c                   @   s   e Zd ZdZedjddZedjddZeddddjddZ	e
d	d
djddZe
dddjddZeejdddieZdS )TextareazMultiline text area widget.ZTextareaViewTr   ZTextareaModelNzThe number of rows to display.r   FEnable or disable user changesr)   lUpdate the value as the user types. If False, update on submission, e.g., pressing Enter or navigating away.r   r   )r   r   r   r   r   r   r7   r   r   rowsr   disabledcontinuous_updater
   r#   r   r3   r   r   r   r    r;   b   s    r;   c                       s   e Zd ZdZedjddZedjddZedddjddZ	edd	djddZ
eejdd
dieZ fddZdd ZdddZ  ZS )TextSingle line textbox widget.ZTextViewTr   Z	TextModelFr<   r)   r=   r   c                    s*   t  j|i | t | _| | j d S r1   )r+   r,   r   _submission_callbacksZon_msg_handle_string_msg)r-   argsr.   r/   r   r    r,   u   s   zText.__init__c                 C   s"   | dddkr| |  dS dS )zHandle a msg from the front-end.

        Parameters
        ----------
        content: dict
            Content of the msg.
        event submitN)getrC   )r-   _contentbuffersr   r   r    rD   z   s   zText._handle_string_msgc                 C   s   t d | jj||d dS )aE  (Un)Register a callback to handle text submission.

        Triggered when the user clicks enter.

        Parameters
        ----------
        callback: callable
            Will be called with exactly one argument: the Widget instance
        remove: bool (optional)
            Whether to unregister the callback
        zon_submit is deprecated. Instead, set the .continuous_update attribute to False and observe the value changing with: mywidget.observe(callback, 'value').)removeN)r   rC   Zregister_callback)r-   callbackrM   r   r   r    	on_submit   s   zText.on_submitr   )F)r   r   r   r   r   r   r7   r   r   r?   r@   r
   r#   r   r3   r,   rD   rO   r4   r   r   r/   r    rA   l   s    rA   c                       sT   e Zd ZdZedjddZedjddZedddjddZ	 fd	d
Z
  ZS )PasswordrB   ZPasswordViewTr   ZPasswordModelFr<   r)   c                 #   s(    t   }|D ]	}|dkr|V  qd S )Nr*   )r+   
_repr_keys)r-   Z
super_keyskeyr/   r   r    rQ      s   
zPassword._repr_keys)r   r   r   r   r   r   r7   r   r   r?   rQ   r4   r   r   r/   r    rP      s    rP   c                   @   sZ   e Zd ZdZedjddZedjddZee ddjddZ	e
dd	d
jddZdS )ComboboxzCSingle line textbox widget with a dropdown and autocompletion.
    ZComboboxModelTr   ZComboboxViewz!Dropdown options for the combobox)Ztraitr   FzDIf set, ensure value is in options. Implies continuous_update=False.r)   N)r   r   r   r   r   r   r   r7   r   optionsr   Zensure_optionr   r   r   r    rS      s     
rS   N)#r   Zwidget_descriptionr   r   Zvaluewidgetr   Zwidgetr   r   r   Zwidget_corer   Ztrait_typesr	   r
   r   utilsr   Z	traitletsr   r   r   r   r!   r#   r&   r'   r(   r6   r9   r:   r;   rA   rP   rS   r   r   r   r    <module>   s@   
	(