ó
/¾I]c           @   sä   d  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 d d	 l Z e d
 e
 e f d „  ƒ  Yƒ Z e d e e f d „  ƒ  Yƒ Z d	 S(   s­   Button 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.
i   (   t	   DOMWidget(   t   CallbackDispatchert   registert   widget_serialization(   t
   CoreWidget(   t   Style(   t   Colort   InstanceDictiÿÿÿÿ(   t   Unicodet   Boolt   CaselessStrEnumt   Instancet   validatet   defaultNt   ButtonStylec           B   se   e  Z d  Z e d ƒ j d e ƒ Z e d d e d d ƒj d e ƒ Z	 e d d ƒ j d e ƒ Z
 RS(   s   Button style widget.t   ButtonStyleModelt   synct
   allow_nonet   helps   Color of the buttons   Button text font weight.N(   t   __name__t
   __module__t   __doc__R   t   tagt   Truet   _model_nameR   t   Nonet   button_colort   font_weight(    (    (    s?   lib/python2.7/site-packages/ipywidgets/widgets/widget_button.pyR      s   $t   Buttonc           B   s@  e  Z d  Z e d ƒ j d e ƒ Z e d ƒ j d e ƒ Z e d d ƒ j d e ƒ Z e d d ƒ j d e ƒ Z	 e
 e d d ƒj d e ƒ Z e d d d	 ƒj d e ƒ Z e d
 d d d d d d g d d d d ƒ j d e ƒ Z e e ƒ j d e e  Z d „  Z e d ƒ d „  ƒ Z e d „ Z d „  Z d „  Z RS(   s±  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 next to the button
    tooltip: str
       tooltip caption of the toggle button
    icon: str
       font-awesome icon name
    disabled: bool
       whether user interaction is enabled
    t
   ButtonViewR   t   ButtonModelR   s   Button label.s   Tooltip caption of the button.s   Enable or disable user changes.t    s1   Font-awesome icon name, without the 'fa-' prefix.t   valuest   primaryt   successt   infot   warningt   dangert   default_values(   Use a predefined styling for the button.c         K   s6   t  t |  ƒ j |   t ƒ  |  _ |  j |  j ƒ d  S(   N(   t   superR   t   __init__R   t   _click_handlerst   on_msgt   _handle_button_msg(   t   selft   kwargs(    (    s?   lib/python2.7/site-packages/ipywidgets/widgets/widget_button.pyR(   <   s    t   iconc         C   s:   | d } | j  d ƒ r6 t j d t ƒ | d } n  | S(   s   Strip 'fa-' if necessary't   values   fa-ss   icons names no longer start with 'fa-', just use the class name itself (for example, 'check' instead of 'fa-check')i   (   t
   startswitht   warningst   warnt   DeprecationWarning(   R,   t   proposalR/   (    (    s?   lib/python2.7/site-packages/ipywidgets/widgets/widget_button.pyt   _validate_iconA   s    
	c         C   s   |  j  j | d | ƒd S(   s9  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.
        t   removeN(   R)   t   register_callback(   R,   t   callbackR6   (    (    s?   lib/python2.7/site-packages/ipywidgets/widgets/widget_button.pyt   on_clickK   s    c         C   s   |  j  |  ƒ d S(   s   Programmatically trigger a click event.

        This will call the callbacks registered to the clicked button
        widget instance.
        N(   R)   (   R,   (    (    s?   lib/python2.7/site-packages/ipywidgets/widgets/widget_button.pyt   clickX   s    c         C   s)   | j  d d ƒ d k r% |  j ƒ  n  d S(   s†   Handle a msg from the front-end.

        Parameters
        ----------
        content: dict
            Content of the msg.
        t   eventR   R:   N(   t   getR:   (   R,   t   _t   contentt   buffers(    (    s?   lib/python2.7/site-packages/ipywidgets/widgets/widget_button.pyR+   `   s    (   R   R   R   R   R   R   t
   _view_nameR   t   descriptiont   tooltipR	   t   Falset   disabledR.   R
   t   button_styleR   R   R   t   styleR(   R   R5   R9   R:   R+   (    (    (    s?   lib/python2.7/site-packages/ipywidgets/widgets/widget_button.pyR      s    	
	(   R   t	   domwidgetR    t   widgetR   R   R   t   widget_coreR   t   widget_styleR   t   trait_typesR   R   t	   traitletsR   R	   R
   R   R   R   R1   R   R   (    (    (    s?   lib/python2.7/site-packages/ipywidgets/widgets/widget_button.pyt   <module>   s   .