
    hMhl                         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dS )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                   p   e Zd ZdZ ed                              d          Z eddd                              d          Z eddd                              d          Z	 eddd	                              d          Z
 eddd
                              d          Z eddd                              d          Z eddd                              d          Z eddd                              d          Z eddd                              d          ZdS )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     `/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/ipywidgets/widgets/widget_button.pyr   r      s}       ',--11t1<<K5$5JKKKOOUYOZZL'$46PQQQUU[_U``K4LMMMQQW[Q\\I$5NOOOSSY]S^^J74D7RSSSWW]aWbbL'$46PQQQUU[_U``K$5IJJJNNTXNYYJgdt:STTTXX^bXccOOOr)   r   c                       e Zd ZdZ ed                              d          Z ed                              d          Z ed                              d          Z e	dd	                              d          Z
 ed
d                              d          Z eg dd
d                              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                      t                      j        di | t                      | _        |                     | j                   d S )Nr(   )super__init__r   _click_handlerson_msg_handle_button_msg)selfkwargs	__class__s     r*   r9   zButton.__init__?   sI    ""6"""133D+,,,,,r)   iconc                 p    |d         }d|v r)t          dg d           |                    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XXZ Z Z Z MM%,,Er)   c                 >    | j                             ||           dS )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.GGGGGr)   c                 0    |                      |            dS )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                 f    |                     dd          dk    r|                                  dS dS )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   s6     ;;w##w..JJLLLLL /.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         &&***55J'-((,,$,77K'///333>>KtE ABBBFFDFQQH72PQQQUU[_U``D"?FFFVX;= = ==@SdS^^  *LL%%)LLtL7KLLE- - - - -
 Xf  H H H 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      sK                      F F F F F F F F F F # # # # # #       , , , , , , , , Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q 

d 
d 
d 
d 
d% 
d 
d 

d 
J J J J JY
 J J 
J J Jr)   