ó
Ò:\c           @à s-  d  Z  d d l m Z m Z m Z 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 m Z m Z d d l m Z d d l m Z d e f d	 „  ƒ  YZ d
 e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d „  Z e d k r)e ƒ  n  d S(   s   Helper widgets.i    (   t   absolute_importt   divisiont   print_functiont   with_statement(   t   QSizet   Qtt   Signal(   t   QIcon(   t   QHBoxLayoutt	   QLineEditt   QPushButtont   QSizePolicyt   QToolButton(   t   update_pointer(   t   load_style_sheett   ButtonSearchc           Bà sD   e  Z d  Z e ƒ  Z e ƒ  Z d „  Z d „  Z d „  Z d „  Z	 RS(   s   Button used for CSS styling.c         Cà s1   t  t |  ƒ j | ƒ t ƒ  |  j d t ƒ d S(   s   Override Qt method.t   focusedN(   t   superR   t   mousePressEventR   t   setPropertyt   False(   t   selft   event(    (    sG   lib/python2.7/site-packages/anaconda_navigator/widgets/helperwidgets.pyR   "   s    c         Cà sc   |  j  ƒ  r9 t t j ƒ |  j d t ƒ |  j j ƒ  n |  j d t ƒ t	 t
 |  ƒ j | ƒ d S(   s   Override Qt method.R   N(   t	   isEnabledR   R   t   ArrowCursorR   t   Truet   sig_enteredt   emitR   R   R   t
   enterEvent(   R   R   (    (    sG   lib/python2.7/site-packages/anaconda_navigator/widgets/helperwidgets.pyR   (   s    c         Cà s]   |  j  ƒ  r3 t ƒ  |  j d t ƒ |  j j ƒ  n |  j d t ƒ t t |  ƒ j | ƒ d S(   s   Override Qt method.R   N(	   R   R   R   R   t   sig_leftR   R   R   t
   leaveEvent(   R   R   (    (    sG   lib/python2.7/site-packages/anaconda_navigator/widgets/helperwidgets.pyR   2   s    c         Cà sM   t  t |  ƒ j | | ƒ |  j ƒ  j |  ƒ |  j ƒ  j |  ƒ |  j ƒ  d S(   s   Override Qt method.N(   R   R   R   t   stylet   unpolisht   polisht   update(   R   t   namet   value(    (    sG   lib/python2.7/site-packages/anaconda_navigator/widgets/helperwidgets.pyR   <   s    (
   t   __name__t
   __module__t   __doc__R   R   R   R   R   R   R   (    (    (    sG   lib/python2.7/site-packages/anaconda_navigator/widgets/helperwidgets.pyR      s   				
	
t
   ButtonShowc           Bà s)   e  Z d  Z d „  Z d „  Z d „  Z RS(   t    c         Cà s   d S(   s   Override Qt method.N(    (   R   R   (    (    sG   lib/python2.7/site-packages/anaconda_navigator/widgets/helperwidgets.pyR   G   s    c         Cà s   d S(   s   Override Qt method.N(    (   R   R   (    (    sG   lib/python2.7/site-packages/anaconda_navigator/widgets/helperwidgets.pyt   mouseReleaseEventK   s    c         Cà s   d S(   s   Override Qt method.N(    (   R   R   (    (    sG   lib/python2.7/site-packages/anaconda_navigator/widgets/helperwidgets.pyt   mouseDoubleClickEventO   s    (   R%   R&   R'   R   R*   R+   (    (    (    sG   lib/python2.7/site-packages/anaconda_navigator/widgets/helperwidgets.pyR(   D   s   		t   PasswordEditc           Bà sS   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d „  Z d d „ Z	 d d „ Z
 RS(	   s(   Password edit with show password button.c         Oà s_  t  t |  ƒ j | | Ž  t |  _ t |  _ t ƒ  |  _ |  j j t	 ƒ |  j j
 t j ƒ |  j j t	 ƒ |  j t j t	 ƒ |  j t j ƒ t ƒ  } | j |  j d t j ƒ | j d ƒ | j d ƒ | j d d d d ƒ |  j | ƒ |  j j j |  j ƒ |  j j j |  j ƒ |  j j |  j  ƒ |  j  d ƒ |  j" d d ƒ |  j# |  |  j ƒ d S(   s)   Lineedit search widget with clear button.i    i   i   N($   R   R,   t   __init__R   t   _emptyt   _show_iconsR(   t   button_icont
   setDefaultR   t   setFocusPolicyR   t   NoFocust   setCheckablet   setAttributet   WA_MacShowFocusRectt   setEchoModeR	   t   PasswordR   t	   addWidgett
   AlignRightt
   setSpacingt
   addSpacingt   setContentsMarginst	   setLayoutR   t   connectt   _show_passwordR   t   _hide_passwordt
   textEditedt
   update_boxt   Nonet   set_icon_sizet   setTabOrder(   R   t   argst   kwargst   layout(    (    sG   lib/python2.7/site-packages/anaconda_navigator/widgets/helperwidgets.pyR-   W   s*    			c         Cà s   |  j  t j ƒ d S(   R)   N(   R7   R	   t   Normal(   R   (    (    sG   lib/python2.7/site-packages/anaconda_navigator/widgets/helperwidgets.pyR@   v   s    c         Cà s   |  j  t j ƒ d S(   R)   N(   R7   R	   R8   (   R   (    (    sG   lib/python2.7/site-packages/anaconda_navigator/widgets/helperwidgets.pyRA   z   s    c         Cà s=   |  j  j t | | ƒ ƒ |  j d j t | d ƒ ƒ ƒ d S(   s   Set clear button icon size.s&   PasswordEdit {{padding-right: {0}px;}}g      ø?N(   R0   t   setMaximumSizeR   t   setStyleSheett   formatt   int(   R   t   widtht   height(    (    sG   lib/python2.7/site-packages/anaconda_navigator/widgets/helperwidgets.pyRE   ~   s    c         Cà s   | |  _  |  j ƒ  d S(   s   Set clear button visibility.N(   R/   RC   (   R   R$   (    (    sG   lib/python2.7/site-packages/anaconda_navigator/widgets/helperwidgets.pyt   set_icon_visibility‡   s    	c         Cà sk   | r% |  j  r% |  j j t ƒ  ƒ n |  j  rD |  j j t ƒ  ƒ n  t | ƒ |  _ |  j j |  j ƒ d S(   s"   Update icon visibility and status.N(   R/   R0   t   setIconR   t   boolR.   t   setDisabled(   R   t   text(    (    sG   lib/python2.7/site-packages/anaconda_navigator/widgets/helperwidgets.pyRC   Œ   s    	c         Cà s#   | d k	 r |  j j | ƒ n  d S(   s   Update custom CSS style sheet.N(   RD   R0   RL   (   R   t   style_sheet(    (    sG   lib/python2.7/site-packages/anaconda_navigator/widgets/helperwidgets.pyt   update_style_sheet–   s    N(   R%   R&   R'   R-   R@   RA   RE   RQ   RD   RC   RW   (    (    (    sG   lib/python2.7/site-packages/anaconda_navigator/widgets/helperwidgets.pyR,   T   s   						
t   LineEditSearchc           Bà sS   e  Z d  Z d „  Z d „  Z d „  Z d d „ Z d „  Z d d „ Z	 d „  Z
 RS(	   s)   Lineedit search widget with clear button.c         Oà s)  t  t |  ƒ j | | Ž  t |  _ t |  _ t ƒ  |  _ |  j j	 t ƒ |  j j
 t j ƒ |  j t j t ƒ t ƒ  } | j |  j d t j ƒ | j d ƒ | j d ƒ | j d d d d ƒ |  j | ƒ |  j j |  j ƒ |  j j j |  j ƒ |  j d ƒ |  j d d ƒ |  j |  |  j ƒ d S(   s)   Lineedit search widget with clear button.i    i   i   N(   R   RX   R-   R   R.   R   R/   R   R0   R1   R2   R   R3   R5   R6   R   R9   R:   R;   R<   R=   R>   RB   R?   RC   t   clickedt
   clear_textRD   RE   RF   (   R   RG   RH   RI   (    (    sG   lib/python2.7/site-packages/anaconda_navigator/widgets/helperwidgets.pyR-   Ÿ   s$    			c         Cà s3   |  j  j t | | ƒ ƒ |  j d j | ƒ ƒ d S(   s   Set clear button icon size.s(   LineEditSearch {{padding-right: {0}px;}}N(   R0   RK   R   RL   RM   (   R   RO   RP   (    (    sG   lib/python2.7/site-packages/anaconda_navigator/widgets/helperwidgets.pyRE   »   s    c         Cà s   | |  _  |  j ƒ  d S(   s   Set clear button visibility.N(   R/   RC   (   R   R$   (    (    sG   lib/python2.7/site-packages/anaconda_navigator/widgets/helperwidgets.pyRQ   Ã   s    	c         Cà sk   | r% |  j  r% |  j j t ƒ  ƒ n |  j  rD |  j j t ƒ  ƒ n  t | ƒ |  _ |  j j |  j ƒ d S(   s"   Update icon visibility and status.N(   R/   R0   RR   R   RS   R.   RT   (   R   RU   (    (    sG   lib/python2.7/site-packages/anaconda_navigator/widgets/helperwidgets.pyRC   È   s    	c         Cà s%   |  j  d ƒ |  j ƒ  |  j ƒ  d S(   s    Clear all text in the line edit.R)   N(   t   setTextt   setFocusRC   (   R   (    (    sG   lib/python2.7/site-packages/anaconda_navigator/widgets/helperwidgets.pyRZ   Ò   s    
c         Cà s#   | d k	 r |  j j | ƒ n  d S(   s   Update custom CSS style sheet.N(   RD   R0   RL   (   R   RV   (    (    sG   lib/python2.7/site-packages/anaconda_navigator/widgets/helperwidgets.pyRW   Ø   s    c         Cà sE   | j  ƒ  } | t j g k r+ |  j ƒ  n t t |  ƒ j | ƒ d S(   s   Override Qt method.N(   t   keyR   t
   Key_EscapeRZ   R   RX   t   keyPressEvent(   R   R   R]   (    (    sG   lib/python2.7/site-packages/anaconda_navigator/widgets/helperwidgets.pyR_   Ý   s    N(   R%   R&   R'   R-   RE   RQ   RD   RC   RZ   RW   R_   (    (    (    sG   lib/python2.7/site-packages/anaconda_navigator/widgets/helperwidgets.pyRX   œ   s   			
	t   ButtonToggleCollapsec           Bà s)   e  Z d  Z d „  Z d „  Z d „  Z RS(   s(   Button to collapse the environment list.c         Oà sc   t  t |  ƒ j | | Ž  |  j t j t j ƒ |  j t j ƒ |  j	 t
 ƒ |  j j |  j ƒ d S(   s(   Button to collapse the environment list.N(   R   R`   R-   t   setSizePolicyR   t	   ExpandingR2   R   R3   R4   R   RY   R?   t   _update_icon(   R   RG   RH   (    (    sG   lib/python2.7/site-packages/anaconda_navigator/widgets/helperwidgets.pyR-   é   s
    c         Cà sG   t  j |  | | ƒ |  j ƒ  j |  ƒ |  j ƒ  j |  ƒ |  j ƒ  d S(   s   Override Qt method.N(   R   R   R   R    R!   R"   (   R   R#   R$   (    (    sG   lib/python2.7/site-packages/anaconda_navigator/widgets/helperwidgets.pyR   ò   s    c         Cà s   |  j  d |  j ƒ  ƒ d  S(   Nt   checked(   R   t	   isChecked(   R   (    (    sG   lib/python2.7/site-packages/anaconda_navigator/widgets/helperwidgets.pyRc   ù   s    (   R%   R&   R'   R-   R   Rc   (    (    (    sG   lib/python2.7/site-packages/anaconda_navigator/widgets/helperwidgets.pyR`   æ   s   			c          Cà sM   d d l  m }  |  ƒ  } t ƒ  } | j d t ƒ  ƒ | j ƒ  | j ƒ  d S(   s   Run loca tests.i    (   t   qapplicationRV   N(   t"   anaconda_navigator.utils.qthelpersRf   R,   RW   R   t   showt   exec_(   Rf   t   appt   widget(    (    sG   lib/python2.7/site-packages/anaconda_navigator/widgets/helperwidgets.pyt
   local_testÿ   s    		
t   __main__N(   R'   t
   __future__R    R   R   R   t   qtpy.QtCoreR   R   R   t
   qtpy.QtGuiR   t   qtpy.QtWidgetsR   R	   R
   R   R   Rg   R   t   anaconda_navigator.utils.stylesR   R   R(   R,   RX   R`   Rl   R%   (    (    (    sG   lib/python2.7/site-packages/anaconda_navigator/widgets/helperwidgets.pyt   <module>   s   "('HJ	