
    Xh                     
   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ee      Ze G d de             Ze G d de             Ze G d de             Ze G d de             Z G d deee      Ze G d de             Ze G d de             Ze G d de             Ze G d de             Ze G d de             Z e G d  d!e              Z!e G d" d#e              Z"y$)%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                       e Zd ZdZ ed      j                  d      Z eddd      j                  d      Z eddd      j                  d      Z e	ddd	      j                  d      Z
y)
_StringStyleText input style widget.StringStyleModelTsyncNzBackground specifications.
allow_nonehelpzText font size.z
Text color)__name__
__module____qualname____doc__r   tag_model_name
background	font_sizer
   
text_color     T/var/www/html/myenv/lib/python3.12/site-packages/ipywidgets/widgets/widget_string.pyr   r      sv    ",-11t1<K$5QRVV\`VaJ4EFJJPTJUIt<@DD$DOJr%   r   c                   N   e Zd ZdZ ed      j                  d      Z eddd      j                  d      Z eddd      j                  d      Z eddd	      j                  d      Z	 eddd
      j                  d      Z
 eddd      j                  d      Zy)
LabelStylezLabel style widget.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    font_family
font_stylefont_variantfont_weighttext_decorationr$   r%   r&   r(   r(      s    +,00d0;K$46OPTTZ^T_K$5MNRRX\R]J4D7QRVV\`VaL$46OPTTZ^T_Kdt:RSWW]aWbOr%   r(   c                   @    e Zd ZdZ ed      j                  d      Zy)	TextStyler   TextStyleModelTr   Nr   r   r   r   r   r   r    r$   r%   r&   r0   r0   %   s    "*+//T/:Kr%   r0   c                   @    e Zd ZdZ ed      j                  d      Zy)	HTMLStylezHTML style widget.HTMLStyleModelTr   Nr2   r$   r%   r&   r4   r4   *   s    *+//T/:Kr%   r4   c                   @    e Zd ZdZ ed      j                  d      Zy)HTMLMathStylezHTML with math style widget.HTMLMathStyleModelTr   Nr2   r$   r%   r&   r7   r7   /   s    &./333>Kr%   r7   c                        e Zd ZdZ ed      j                  d      Z edd      j                  d      Z  ee	      j
                  dddie
Zd fd		Z ed
      j                  d      Z x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   c                 2    |||d<   t        |   di | y )Nvaluer$   )super__init__)selfr=   kwargs	__class__s      r&   r?   z_String.__init__@   s"    #F7O"6"r%   StringModelr$   N)r   r   r   r   r   r   r=   placeholderr   r   r   styler?   r    __classcell__rB   s   @r&   r:   r:   5   s{    D(,,$,7E
 ()bcggmqgrK*L&**MM8LME#
 -(,,$,7Kr%   r:   c                       e Zd ZdZ ed      j                  d      Z ed      j                  d      Z  ee	      j
                  dddie
Zy)	HTMLz#Renders the string `value` as HTML.HTMLViewTr   	HTMLModelr   Nr$   )r   r   r   r   r   r   
_view_namer    r   r4   r   rF   r$   r%   r&   rJ   rJ   G   sU    -$((d(3J+&***5K'L#''JTJ5IJEr%   rJ   c                       e Zd ZdZ ed      j                  d      Z ed      j                  d      Z  ee	      j
                  dddie
Zy)	HTMLMathz;Renders the string `value` as HTML, and render mathematics.HTMLMathViewTr   HTMLMathModelr   Nr$   )r   r   r   r   r   r   rM   r    r   r7   r   rF   r$   r%   r&   rO   rO   N   sU    E(,,$,7J/*..D.9K+L'++NN9MNEr%   rO   c                       e Zd ZdZ ed      j                  d      Z ed      j                  d      Z  ee	      j
                  dddie
Zy)	LabelzLabel widget.

    It also renders math inside the string `value` as Latex (requires $ $ or
    $$ $$ and similar latex tags).
    	LabelViewTr   
LabelModelr   Nr$   )r   r   r   r   r   r   rM   r    r   r(   r   rF   r$   r%   r&   rS   rS   V   sY    
 %))t)4J,'+++6K(L$((KdK6JKEr%   rS   c                   B   e Zd ZdZ ed      j                  d      Z ed      j                  d      Z eddd      j                  d      Z	 e
d	d
      j                  d      Z e
dd      j                  d      Z  ee      j
                  dddieZy)TextareazMultiline text area widget.TextareaViewTr   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   rM   r    r   rowsr   disabledcontinuous_updater   r0   r   rF   r$   r%   r&   rW   rW   b   s    %(,,$,7J/*..D.9Kt+KLPPVZP[DE @AEE4EPHT  )W  X  \  \  bf  \  g'L#''JTJ5IJEr%   rW   c                   ,    e Zd ZdZ ed      j                  d      Z ed      j                  d      Z edd      j                  d      Z	 edd	      j                  d      Z
  ee      j
                  dd
dieZ fdZd ZddZ xZS )TextSingle line textbox widget.TextViewTr   	TextModelFrZ   r;   r[   r   c                 x    t        |   |i | t               | _        | j	                  | j
                         y rD   )r>   r?   r   _submission_callbackson_msg_handle_string_msg)r@   argsrA   rB   s      r&   r?   zText.__init__u   s2    $)&)%7%9"D++,r%   c                 R    |j                  dd      dk(  r| j                  |        yy)zHandle a msg from the front-end.

        Parameters
        ----------
        content: dict
            Content of the msg.
        event submitN)getre   )r@   _contentbufferss       r&   rg   zText._handle_string_msgz   s*     ;;w#x/&&t, 0r%   c                 T    t        d       | j                  j                  ||       y)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   re   register_callback)r@   callbackrr   s      r&   	on_submitzText.on_submit   s,     	  p  	q""44Xf4Mr%   r$   )F)r   r   r   r   r   r   rM   r    r   r]   r^   r   r0   r   rF   r?   rg   ru   rG   rH   s   @r&   r`   r`   l   s    %$((d(3J+&***5KE @AEE4EPHT  )W  X  \  \  bf  \  g'L#''JTJ5IJE-
	-Nr%   r`   c                        e Zd ZdZ ed      j                  d      Z ed      j                  d      Z edd      j                  d      Z	 fd	Z
 xZS )
Passwordra   PasswordViewTr   PasswordModelFrZ   r;   c              #   L   K   t         |          }|D ]  }|dk7  s	|  y w)Nr=   )r>   
_repr_keys)r@   
super_keyskeyrB   s      r&   r{   zPassword._repr_keys   s/     W')
 	Cg~		s   $$)r   r   r   r   r   r   rM   r    r   r]   r{   rG   rH   s   @r&   rw   rw      s[    %(,,$,7J/*..D.9KE @AEE4EPH r%   rw   c                       e Zd ZdZ ed      j                  d      Z ed      j                  d      Z e e       d      j                  d      Z	 e
dd	
      j                  d      Zy)ComboboxzCSingle line textbox widget with a dropdown and autocompletion.
    ComboboxModelTr   ComboboxViewz!Dropdown options for the combobox)traitr   FzDIf set, ensure value is in options. Implies continuous_update=False.r;   N)r   r   r   r   r   r   r    rM   r   optionsr   ensure_optionr$   r%   r&   r   r      s{    /*..D.9K(,,$,7Ji0 
ctcn 
 S 
ctcn r%   r   N)#r   widget_descriptionr   r   valuewidgetr   widgetr   r   r   widget_corer	   trait_typesr
   r   r   utilsr   	traitletsr   r   r   r   r(   r0   r4   r7   r:   rJ   rO   rS   rW   r`   rw   r   r$   r%   r&   <module>r      s  
 D $ F F # 8 8  ( (P#Z P 
c c 
c 
; ; 
; 
; ; 
; 
?L ? 
?
8j 8$ 
K7 K 
K 
Ow O 
O 
LG L 
L 
Kw K 
K 
%N7 %N 
%NP 
t  
 
t  
r%   