o
    tfl                     @   s   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 dee
ZeG d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                   @   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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 )ButtonStylezButton style widget.Z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	   Zbutton_colorZfont_familyZ	font_sizeZ
font_styleZfont_variantZfont_weightZ
text_colorZtext_decoration r   r   i/var/www/html/software/conda/envs/catlas/lib/python3.10/site-packages/ipywidgets/widgets/widget_button.pyr      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jddZe	dd	djddZ
ed
ddjddZeg dd
ddjddZeejdddieZ fddZeddd ZdddZdd Zdd Z  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
    Z
ButtonViewTr   ZButtonModelzButton label.)r   FzEnable or disable user changes. z2Font-awesome icon names, without the 'fa-' prefix.)primarysuccessinfowarningZdangerr    z(Use a predefined styling for the button.)valuesdefault_valuer   r   c                    s*   t  jdi | t | _| | j d S )Nr   )super__init__r   _click_handlersZon_msg_handle_button_msg)selfkwargs	__class__r   r   r(   ?   s   zButton.__init__iconc                 C   s0   |d }d|v rt dg d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)Zinternalr    )r   replace)r+   Zproposalr0   r   r   r   _validate_iconD   s   zButton._validate_iconc                 C   s   | j j||d 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)   Zregister_callback)r+   callbackr3   r   r   r   on_clickO   s   zButton.on_clickc                 C   s   |  |  dS )zProgrammatically trigger a click event.

        This will call the callbacks registered to the clicked button
        widget instance.
        N)r)   )r+   r   r   r   click\   s   zButton.clickc                 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.
        eventr    r6   N)getr6   )r+   _contentbuffersr   r   r   r*   d   s   zButton._handle_button_msgr   )F)r   r   r   r   r   r   Z
_view_namer   descriptionr   disabledr/   r   Zbutton_styler
   r   r   styler(   r   r2   r5   r6   r*   __classcell__r   r   r-   r   r   "   s(    


r   N)r   utilsr   Z	domwidgetr   Zwidgetr   r   r   Zwidget_corer   Zwidget_styler   Ztrait_typesr	   r
   Z	traitletsr   r   r   r   r   r   r   r   r   r   r   r   <module>   s    