ó
Ō:\c           @   s­   d  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 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   CONF(   t	   GATracker(   t   ButtonPrimaryt	   QCheckBoxt   SpacerHorizontalt   SpacerVertical(   t
   DialogBaset   DialogOfflineModec           B   s   e  Z d  Z d Z d Z d Z d Z d Z d Z e e e Z	 e e e e Z
 e e e e Z d
 e d  Z d   Z d	   Z RS(   s   Offline mode dialog.iĖ  sŪ   Some of the functionality of Anaconda Navigator will be limited. Conda environment creation will be subject to the packages currently available on your package cache.<br><br>s   <b>Offline mode</b> is indicated to the left of the login/logout button on the top right corner of the main application window.<br><br>s[   Offline mode will be disabled automatically when internet connectivity is restored.<br><br>sk   You can also manually force <b>Offline mode</b> by enabling the setting on the application preferences.<br>s?   By checking this option you will force <b>Offline mode</b>.<br>c         C   sb  t  t |   j d |  t   |  _ t |  j  |  _ t d  |  _	 t
 d  |  _ | |  _ |  j j t  |  j |  j  |  j |  j  |  j d  t   } | j   | j |  j  | j t    | j |  j	  t   } | j |  j  | j t    | j t    | j |  |  j |  |  j	 j j |  j  |  j	 j   |  j   d S(   s   Offline mode dialog.t   parentt   Oks   Don't show agains   Offline ModeN(    t   superR
   t   __init__R   t   trackerR   t   MESSAGE_DIALOGt   labelR   t	   button_okR   t   checkbox_hidet   configt   setWordWrapt   Truet   setMinimumWidtht   WIDTHt   setMaximumWidtht   setWindowTitleR    t
   addStretcht	   addWidgetR   R   R   t	   addLayoutt	   setLayoutt   clickedt   connectt   handle_acceptt   setFocust   setup(   t   selfR   R   t   layout_buttonst   layout(    (    sI   lib/python2.7/site-packages/anaconda_navigator/widgets/dialogs/offline.pyR   @   s0    		
	c         C   s)   |  j  j d d  } |  j j |  d S(   s   Setup widget content.t   maint   hide_offline_dialogN(   R   t   getR   t
   setChecked(   R$   t   hide_dialog(    (    sI   lib/python2.7/site-packages/anaconda_navigator/widgets/dialogs/offline.pyR#   i   s    c         C   s9   t  |  j j    } |  j j d d |  |  j   d S(   s&   Handle not showing updates on startup.R'   R(   N(   t   boolR   t
   checkStateR   t   sett   accept(   R$   t   value(    (    sI   lib/python2.7/site-packages/anaconda_navigator/widgets/dialogs/offline.pyR!   n   s    N(   t   __name__t
   __module__t   __doc__R   t   _MESSAGE_BASEt   _MESSAGE_LOCt   _MESSAGE_ENABLEt   _MESSAGE_FORCEt   _MESSAGE_EXTRA_PREFt   MESSAGE_TOOLt   MESSAGE_PREFERENCESR   t   NoneR   R   R#   R!   (    (    (    sI   lib/python2.7/site-packages/anaconda_navigator/widgets/dialogs/offline.pyR
      s   &	c          C   sJ   d d l  m }  |  d d  } t   } | j   | j   | j   d S(   s   Run local tests.iĸĸĸĸ(   t   qapplicationt	   test_timei   N(   t"   anaconda_navigator.utils.qthelpersR<   R
   t   update_style_sheett   showt   exec_(   R<   t   appt   widget(    (    sI   lib/python2.7/site-packages/anaconda_navigator/widgets/dialogs/offline.pyt
   local_testw   s    	

t   __main__N(   R3   t   qtpy.QtWidgetsR    R   R   t   anaconda_navigator.configR   t"   anaconda_navigator.utils.analyticsR   t   anaconda_navigator.widgetsR   R   R   R   t"   anaconda_navigator.widgets.dialogsR	   R
   RD   R1   (    (    (    sI   lib/python2.7/site-packages/anaconda_navigator/widgets/dialogs/offline.pyt   <module>   s   "]	