
    Xhl                         d 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
 ddlmZ ddlmZmZ dd	lmZmZmZmZmZmZ e G d
 dee
             Ze G d dee
             Zy)zButton class.

Represents a button in the frontend using a widget.  Allows user to listen for
click events on the button and trigger backend code when the clicks are fired.
   )deprecation)	DOMWidget)CallbackDispatcherregisterwidget_serialization)
CoreWidget)Style)ColorInstanceDict    )UnicodeBoolCaselessStrEnumInstancevalidatedefaultc                      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 eddd      j                  d      Z eddd      j                  d      Z eddd      j                  d      Zy)ButtonStylezButton style widget.ButtonStyleModelTsyncNzColor of the button)
allow_nonehelpzButton text font family.zButton text font size.zButton text font style.zButton text font variant.zButton text font weight.zButton text color.zButton text decoration.)__name__
__module____qualname____doc__r   tag_model_namer
   button_colorfont_family	font_size
font_stylefont_variantfont_weight
text_colortext_decoration     T/var/www/html/myenv/lib/python3.12/site-packages/ipywidgets/widgets/widget_button.pyr   r      s   ,-11t1<K$5JKOOUYOZL$46PQUU[_U`K4LMQQW[Q\I$5NOSSY]S^J4D7RSWW]aWbL$46PQUU[_U`K$5IJNNTXNYJdt:STXX^bXcOr)   r   c                       e Zd ZdZ ed      j                  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g dd
d      j                  d      Z  ee      j
                  dddieZ fdZ ed      d        ZddZd Zd Z xZS )Buttona  Button widget.

    This widget has an `on_click` method that allows you to listen for the
    user clicking on the button.  The click event itself is stateless.

    Parameters
    ----------
    description: str
       description displayed on the button
    icon: str
       font-awesome icon names, without the 'fa-' prefix
    disabled: bool
       whether user interaction is enabled
    
ButtonViewTr   ButtonModelzButton label.)r   FzEnable or disable user changes. z2Font-awesome icon names, without the 'fa-' prefix.)primarysuccessinfowarningdangerr/   z(Use a predefined styling for the button.)valuesdefault_valuer   r   c                 x    t        |   di | t               | _        | j	                  | j
                         y )Nr(   )super__init__r   _click_handlerson_msg_handle_button_msg)selfkwargs	__class__s     r*   r9   zButton.__init__?   s0    "6"13D++,r)   iconc                 Z    |d   }d|v r!t        dg d       |j                  dd      }|S )zStrip 'fa-' if necessary'valuezfa-z}icons names no longer need 'fa-', just use the class names themselves (for example, 'gear spin' instead of 'fa-gear fa-spin'))zipywidgets/widgets/ztraitlets/traitlets.pyz/contextlib.py)internalr/   )r   replace)r=   proposalrB   s      r*   _validate_iconzButton._validate_iconD   s>     !E> jXZ MM%,Er)   c                 >    | j                   j                  ||       y)a9  Register a callback to execute when the button is clicked.

        The callback will be called with one argument, the clicked button
        widget instance.

        Parameters
        ----------
        remove: bool (optional)
            Set to true to remove the callback from the list of callbacks.
        )removeN)r:   register_callback)r=   callbackrH   s      r*   on_clickzButton.on_clickO   s     	..x.Gr)   c                 &    | j                  |        y)zProgrammatically trigger a click event.

        This will call the callbacks registered to the clicked button
        widget instance.
        N)r:   )r=   s    r*   clickzButton.click\   s     	T"r)   c                 P    |j                  dd      dk(  r| j                          yy)zHandle a msg from the front-end.

        Parameters
        ----------
        content: dict
            Content of the msg.
        eventr/   rM   N)getrM   )r=   _contentbufferss       r*   r<   zButton._handle_button_msgd   s%     ;;w#w.JJL /r)   r(   )F)r   r   r   r   r   r   
_view_namer   descriptionr   disabledr@   r   button_styler   r   r   styler9   r   rF   rK   rM   r<   __classcell__)r?   s   @r*   r,   r,   "   s     &***5J-(,,$,7K/333>KE ABFFDFQH2PQUU[_U`D"FVX;==@SdS^  *L%))LtL7KLE-
 f H#	r)   r,   N)r   utilsr   	domwidgetr   widgetr   r   r   widget_corer   widget_styler	   trait_typesr
   r   	traitletsr   r   r   r   r   r   r   r,   r(   r)   r*   <module>ra      sg       F F #  , Q Q 

d% 
d 

d 
JY
 J 
Jr)   