ó
Ň:\c           @   sł   d  Z  d d l m Z m Z m Z d d l m Z m Z d d l m	 Z	 d d l
 m Z m Z m Z m Z d d l m Z d e f d     YZ d	   Z e d
 k rŻ e   n  d S(   s   Update application dialog.i˙˙˙˙(   t   QHBoxLayoutt   QLabelt   QVBoxLayout(   t   CONFt   WIN(   t	   GATracker(   t   ButtonNormalt   ButtonPrimaryt   SpacerHorizontalt   SpacerVertical(   t
   DialogBaset   DialogUpdateApplicationc           B   s2   e  Z d  Z d Z e e e e d  Z d   Z RS(   s   Update application dialog.iĚ  c   	      C   s4  t  t |   j   t   |  _ d } | r; t r; d } n  t d j | |   |  _ t	 d  |  _
 t d  |  _ t d  |  _ | |  _ | sľ |  j j t  |  j j d  n  |  j j t  |  j |  j  |  j |  j  |  j d  | r+|  j
 j t  |  j j t  |  j j t  n  t   } | j   | j |  j  | j t    | j |  j  | j t    | j |  j
  t   } | j |  j  | j t    | j t    | j |  |  j  |  |  j
 j! j" |  j#  |  j j! j" |  j$  |  j j! j" |  j%  |  j
 j&   d	 S(
   s   
        Update application dialog.

        Parameter
        ---------
        version: str
            New version of update available.
        t    s4   <br>(You will be prompted to elevate privileges)<br>s  There's a new version of Anaconda Navigator available. We strongly recommend you to update. <br><br>If you click yes, Anaconda Navigator will close and then the Anaconda Navigator Updater will start.<br><br><br>Do you wish to update to <b>Anaconda Navigator {0}</b> now?<br>{1}<br>t   Yess   No, remind me laters   No, don't show againt   Nos   Update ApplicationN('   t   superR   t   __init__R   t   trackerR   R   t   formatt   labelR   t
   button_yesR   t	   button_not   button_no_showt   configt
   setVisiblet   Falset   setTextt   setWordWrapt   Truet   setMinimumWidtht   WIDTHt   setMaximumWidtht   setWindowTitlet   setDisabledR    t
   addStretcht	   addWidgetR   R   R	   t	   addLayoutt	   setLayoutt   clickedt   connectt   acceptt   rejectt   no_showt   setFocus(	   t   selft   versionR   t   startupt
   qa_testingt   is_root_writablet
   extra_textt   layout_buttonst   layout(    (    sH   lib/python2.7/site-packages/anaconda_navigator/widgets/dialogs/update.pyR      sP    			
	c         C   s$   |  j  j d d t  |  j   d S(   s&   Handle not showing updates on startup.t   maint   hide_update_dialogN(   R   t   setR   R)   (   R,   (    (    sH   lib/python2.7/site-packages/anaconda_navigator/widgets/dialogs/update.pyR*   m   s    (   t   __name__t
   __module__t   __doc__R   R   R   R   R*   (    (    (    sH   lib/python2.7/site-packages/anaconda_navigator/widgets/dialogs/update.pyR      s   Hc          C   sV   d d l  m }  |  d d  } t d d d t  } | j   | j   | j   d S(	   s   Run local tests.i˙˙˙˙(   t   qapplicationt	   test_timei   R-   s   1.5.0R.   N(   t"   anaconda_navigator.utils.qthelpersR:   R   R   t   update_style_sheett   showt   exec_(   R:   t   appt   widget(    (    sH   lib/python2.7/site-packages/anaconda_navigator/widgets/dialogs/update.pyt
   local_testu   s    

t   __main__N(   R9   t   qtpy.QtWidgetsR    R   R   t   anaconda_navigator.configR   R   t"   anaconda_navigator.utils.analyticsR   t   anaconda_navigator.widgetsR   R   R   R	   t"   anaconda_navigator.widgets.dialogsR
   R   RB   R7   (    (    (    sH   lib/python2.7/site-packages/anaconda_navigator/widgets/dialogs/update.pyt   <module>   s   "[	