Ñò
3mÈKc           @   sJ  d  Z  d d k Z d d k Z d d k Z d d k Z d d k Z d d k Z d d d d d d g Z d e f d	 „  ƒ  YZ	 h  Z
 g  Z d d
 d „ Z d d „ Z d d
 d „ Z d „  Z d „  Z d
 d „ Z e i d  d j o d „  Z n
 d „  Z d „  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 e 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 i# i d, ƒ o e" ƒ  n e i# i d- ƒ oÇ e d. ƒ o e d. d e d. ƒ ƒ n e d/ ƒ o e d/ d e d/ ƒ ƒ n e d0 ƒ o e d0 d e d0 ƒ ƒ n e d1 ƒ o e d1 d e d1 ƒ ƒ n e d2 ƒ o e d2 d e d2 ƒ ƒ qæn e i d  d j o¤ d3 e f d4 „  ƒ  YZ$ g  Z h  Z
 e d5 e$ ƒ e i% i& e i# i d6 d7 ƒ d8 ƒ Z' xN d9 d: d; d< d= d> e' f D]- Z( e e( ƒ o e e( d e e( ƒ ƒ qiqiWn y d d k) Z) Wn e* j
 o n+ Xd? e f d@ „  ƒ  YZ+ e dA e+ dB d ƒe i dC j o3 dD e f dE „  ƒ  YZ, e dD d e, dF ƒ d ƒ n e i d  dG j o? e d= ƒ o2 g  Z h  Z
 e dH d e dI d= dJ g ƒ d ƒ n dK e i# j o’ e i# dK i- e i. ƒ Z/ e/ i0 ƒ  x\ e/ D]T Z1 e1 dL j oA e e1 d ƒ Z2 e2 d
 d j o e e1 d e e1 ƒ d ƒ qq½q½Wd Z1 [1 [/ n dM „  Z3 e4 dN j o e3 ƒ  n d S(O   s?   Interfaces for launching and remotely controlling Web browsers.iÿÿÿÿNt   Errort   opent   open_newt   open_new_tabt   gett   registerc           B   s   e  Z RS(    (   t   __name__t
   __module__(    (    (    s    /usr/lib/python2.6/webbrowser.pyR       s   i   c         C   sY   | | g t  |  i ƒ  <| d j o t i |  ƒ n" | d j  o t i d |  ƒ n d S(   s9   Register a browser connector and, optionally, connection.i    N(   t	   _browserst   lowert	   _tryordert   appendt   insert(   t   namet   klasst   instancet   update_tryorder(    (    s    /usr/lib/python2.6/webbrowser.pyR      s
    c         C   sø   |  d j	 o |  g } n t } xÅ | D]½ } d | j o= t i | ƒ } | d d j o t | d  ƒ St | ƒ Sq' y t | i ƒ  } Wn t j
 o t	 | ƒ } n X| d d j	 o	 | d S| d d j	 o | d ƒ  Sq' Wt
 d ƒ ‚ d S(   sC   Return a browser launcher instance appropriate for the environment.s   %siÿÿÿÿt   &i   i    s!   could not locate runnable browserN(   t   NoneR
   t   shlext   splitt   BackgroundBrowsert   GenericBrowserR   R	   t   KeyErrort   _synthesizeR    (   t   usingt   alternativest   browsert   command(    (    s    /usr/lib/python2.6/webbrowser.pyR      s&     	i    c         C   s<   x5 t  D]- } t | ƒ } | i |  | | ƒ o t Sq Wt S(   N(   R
   R   R   t   Truet   False(   t   urlt   newt	   autoraiseR   R   (    (    s    /usr/lib/python2.6/webbrowser.pyR   :   s     	c         C   s   t  |  d ƒ S(   Ni   (   R   (   R   (    (    s    /usr/lib/python2.6/webbrowser.pyR   A   s    c         C   s   t  |  d ƒ S(   Ni   (   R   (   R   (    (    s    /usr/lib/python2.6/webbrowser.pyR   D   s    c      	   C   só   |  i  ƒ  d } t | ƒ p d d g St i i | ƒ } y t | i ƒ  } Wn t j
 o d d g SX| d } | om | i ƒ  | i j oW d d k	 } | i	 | ƒ } |  | _
 t i i |  ƒ | _ t |  d | | ƒ d | g Sd d g S(   s¾  Attempt to synthesize a controller base on existing controllers.

    This is useful to create a controller when a user specifies a path to
    an entry in the BROWSER environment variable -- we can copy a general
    controller to operate using a specific installation of the desired
    browser in this way.

    If we can't create a controller in this way, or if there is no
    executable for the requested browser, return [None, None].

    i    i   iÿÿÿÿN(   R   t
   _iscommandR   t   ost   patht   basenameR   R	   R   t   copyR   R   (   R   R   t   cmdR   R   t
   controllerR&   (    (    s    /usr/lib/python2.6/webbrowser.pyR   H   s"    
	i   t   winc         C   se   |  i  ƒ  }  t i i |  ƒ o |  i d ƒ o t Sx* d D]" } t i i |  | ƒ o t Sq; Wt S(   Ns   .exes   .bat(   s   .exes   .bat(   s   .exes   .bat(   R	   R#   R$   t   isfilet   endswithR   R   (   R'   t   ext(    (    s    /usr/lib/python2.6/webbrowser.pyt   _isexecutablei   s    # 	c         C   s`   t  i i |  ƒ oI t  i |  ƒ t i } | t i @p | t i @p | t i @o t Sn t	 S(   N(
   R#   R$   R*   t   statt   ST_MODEt   S_IXUSRt   S_IXGRPt   S_IXOTHR   R   (   R'   t   mode(    (    s    /usr/lib/python2.6/webbrowser.pyR-   r   s
    *	c         C   sx   t  |  ƒ o t St i i d ƒ } | p t SxA | i t i ƒ D]- } t i i	 | |  ƒ } t  | ƒ o t SqC Wt S(   sS   Return True if cmd is executable or can be found on the executable
    search path.t   PATH(
   R-   R   R#   t   environR   R   R   t   pathsepR$   t   join(   R'   R$   t   dt   exe(    (    s    /usr/lib/python2.6/webbrowser.pyR"   y   s     	t   BaseBrowserc           B   sD   e  Z d  Z d g Z d d „ Z d d d „ Z d „  Z d „  Z RS(	   s3   Parent class for all browsers. Do not use directly.s   %st    c         C   s   | |  _  | |  _ d  S(   N(   R   R%   (   t   selfR   (    (    s    /usr/lib/python2.6/webbrowser.pyt   __init__   s    	i    i   c         C   s
   t  ‚ d  S(   N(   t   NotImplementedError(   R<   R   R    R!   (    (    s    /usr/lib/python2.6/webbrowser.pyR   “   s    c         C   s   |  i  | d ƒ S(   Ni   (   R   (   R<   R   (    (    s    /usr/lib/python2.6/webbrowser.pyR   –   s    c         C   s   |  i  | d ƒ S(   Ni   (   R   (   R<   R   (    (    s    /usr/lib/python2.6/webbrowser.pyR   ™   s    (   R   R   t   __doc__t   argsR=   R   R   R   (    (    (    s    /usr/lib/python2.6/webbrowser.pyR:   Š   s   		R   c           B   s&   e  Z d  Z d „  Z d d d „ Z RS(   sV   Class for all browsers started with a command
       and without remote functionality.c         C   s_   t  | t ƒ o | |  _ d g |  _ n | d |  _ | d |  _ t i i |  i ƒ |  _ d  S(   Ns   %si    i   (   t
   isinstancet
   basestringR   R@   R#   R$   R%   (   R<   R   (    (    s    /usr/lib/python2.6/webbrowser.pyR=   ¡   s    	i    i   c      
   C   s    |  i  g g  } |  i D] } | | i d | ƒ q ~ } yK t i d  d j o t i | ƒ } n t i | d t ƒ} | i ƒ  SWn t	 j
 o t
 SXd  S(   Ns   %si   R)   t	   close_fds(   R   R@   t   replacet   syst   platformt
   subprocesst   PopenR   t   waitt   OSErrorR   (   R<   R   R    R!   t   _[1]t   argt   cmdlinet   p(    (    s    /usr/lib/python2.6/webbrowser.pyR   «   s    *(   R   R   R?   R=   R   (    (    (    s    /usr/lib/python2.6/webbrowser.pyR      s   	
R   c           B   s   e  Z d  Z d d d „ Z RS(   sH   Class for all browsers which are to be started in the
       background.i    i   c   	      C   sÚ   |  i  g g  } |  i D] } | | i d | ƒ q ~ } y… t i d  d j o t i | ƒ } nK t t d d  ƒ } | p t t d d  ƒ } n t i | d t
 d | ƒ} | i ƒ  d  j SWn t j
 o t SXd  S(   Ns   %si   R)   t   setsidt   setpgrpRC   t
   preexec_fn(   R   R@   RD   RE   RF   RG   RH   t   getattrR#   R   R   t   pollRJ   R   (	   R<   R   R    R!   RK   RL   RM   RN   RO   (    (    s    /usr/lib/python2.6/webbrowser.pyR   ¼   s    *(   R   R   R?   R   (    (    (    s    /usr/lib/python2.6/webbrowser.pyR   ¸   s   t   UnixBrowserc           B   sV   e  Z d  Z d Z d d g Z d Z d Z d Z e	 Z
 e Z d „  Z d d d „ Z RS(   s=   Parent class for all Unix browsers with remote functionality.s   %actions   %sc         C   s—  g  } | oA |  i  o7 t t | ƒ ƒ } |  i  | } | o | g } qN n |  i g | | } | p
 |  i o t t i d ƒ } n d  } t	 t d d  ƒ } | p t	 t d d  ƒ } n t
 i | d t d | d |  i o | p d  d | d | ƒ}	 | o[ t i d	 ƒ |	 i ƒ  }
 |
 d  j o/ t i d
 ƒ |	 i ƒ  }
 |
 d  j o t Sn |
 S|  i o  |	 i ƒ  d  j o t St Sn |	 i ƒ  Sd  S(   Ns   r+RO   RP   RC   t   stdint   stdoutt   stderrRQ   i   i   (   t
   raise_optst   intt   boolR   t
   backgroundt   fileR#   t   devnullR   RR   RG   RH   R   t   redirect_stdoutt   timet   sleepRS   R   RI   (   R<   R@   t   remoteR!   t	   raise_optt   optRM   t   inoutRO   RN   t   rc(    (    s    /usr/lib/python2.6/webbrowser.pyt   _invoke×   s<     	
i    i   c   
      C   s#  | d j o |  i  } nf | d j o |  i } nL | d j o* |  i d  j o |  i } q |  i } n t d d | ƒ ‚ g  } |  i D]% } | | i d | ƒ i d | ƒ q ~ } |  i | t | ƒ } | pD g  }	 |  i	 D] } |	 | i d | ƒ qå ~	 } |  i | t
 t
 ƒ St Sd  S(   Ni    i   i   s   Bad 'new' parameter to open(); s   expected 0, 1, or 2, got %ss   %ss   %action(   t   remote_actiont   remote_action_newwint   remote_action_newtabR   R    t   remote_argsRD   Rf   R   R@   R   (
   R<   R   R    R!   t   actionRK   RL   R@   t   successt   _[2](    (    s    /usr/lib/python2.6/webbrowser.pyR     s"    50N(   R   R   R?   R   RX   Rj   Rg   Rh   Ri   R   R[   R   R^   Rf   R   (    (    (    s    /usr/lib/python2.6/webbrowser.pyRT   Ì   s   	,t   Mozillac           B   s>   e  Z d  Z d d g Z d d g Z d Z d Z d Z e Z	 RS(   s-   Launcher class for Mozilla/Netscape browsers.s   -noraises   -raises   -remotes   openURL(%s%action)R;   s   ,new-windows   ,new-tab(
   R   R   R?   RX   Rj   Rg   Rh   Ri   R   R[   (    (    (    s    /usr/lib/python2.6/webbrowser.pyRn     s   t   Galeonc           B   s8   e  Z d  Z d d g Z d d g Z d Z d Z e Z RS(   s,   Launcher class for Galeon/Epiphany browsers.s   -noraiseR;   s   %actions   %ss   -ns   -w(	   R   R   R?   RX   Rj   Rg   Rh   R   R[   (    (    (    s    /usr/lib/python2.6/webbrowser.pyRo   +  s   t   Operac           B   s>   e  Z d  Z d d g Z d d g Z d Z d Z d Z e Z	 RS(   s!   Launcher class for Opera browser.R;   s   -raises   -remotes   openURL(%s%action)s   ,new-windows	   ,new-page(
   R   R   R?   RX   Rj   Rg   Rh   Ri   R   R[   (    (    (    s    /usr/lib/python2.6/webbrowser.pyRp   6  s   t   Elinksc           B   s8   e  Z d  Z d d g Z d Z d Z d Z e Z e Z	 RS(   s#   Launcher class for Elinks browsers.s   -remotes   openURL(%s%action)R;   s   ,new-windows   ,new-tab(
   R   R   R?   Rj   Rg   Rh   Ri   R   R[   R^   (    (    (    s    /usr/lib/python2.6/webbrowser.pyRq   B  s   t	   Konquerorc           B   s   e  Z d  Z d d d „ Z RS(   s±   Controller for the KDE File Manager (kfm, or Konqueror).

    See the output of ``kfmclient --commands``
    for more information on the Konqueror remote-control interface.
    i    i   c         C   sƒ  | d j o
 d } n d } t  t i d ƒ } t t d d  ƒ } | p t t d d  ƒ } n y4 t i d | | g d t d	 | d
 | d | ƒ} Wn t j
 o n X| i	 ƒ  t Sy: t i d d | g d t d	 | d
 | d | d | ƒ} Wn t j
 o n X| i
 ƒ  d  j o t Sy: t i d d | g d t d	 | d
 | d | d | ƒ} Wn t j
 o t SX| i
 ƒ  d  j Sd  S(   Ni   t   newTabt   openURLs   r+RO   RP   t	   kfmclientRC   RU   RV   RW   t	   konquerors   --silentRQ   t   kfms   -d(   R\   R#   R]   RR   R   RG   RH   R   RJ   RI   RS   R   (   R<   R   R    R!   Rk   R]   RO   RN   (    (    s    /usr/lib/python2.6/webbrowser.pyR   W  s@    

(   R   R   R?   R   (    (    (    s    /usr/lib/python2.6/webbrowser.pyRr   P  s   t   Grailc           B   s)   e  Z d  „  Z d „  Z d d d „ Z RS(   c      
   C   s  d d  k  } d d  k } d d  k } d d  k } t i i | i ƒ  d ƒ } | i t i	 ƒ  ƒ d } t i i | | d ƒ } | i  | ƒ } | p d  S| i | i | i ƒ }	 xc | D][ }
 y |	 i |
 ƒ Wn= | i j
 o. y t i |
 ƒ Wqt j
 o qXq· X|	 Sq· Wd  S(   Niÿÿÿÿs   .grail-unixi    s   -*(   t   globt   pwdt   sockett   tempfileR#   R$   R7   t
   gettempdirt   getpwuidt   getuidR   t   AF_UNIXt   SOCK_STREAMt   connectt   errort   unlinkt   IOError(   R<   Ry   Rz   R{   R|   t   tempdirt   usert   filenamet   maybest   st   fn(    (    s    /usr/lib/python2.6/webbrowser.pyt   _find_grail_rc  s,    	 
c         C   s3   |  i  ƒ  } | p d S| i | ƒ | i ƒ  d S(   Ni    i   (   RŒ   t   sendt   close(   R<   Rk   RŠ   (    (    s    /usr/lib/python2.6/webbrowser.pyt   _remote§  s    
i    i   c         C   s5   | o |  i  d | ƒ } n |  i  d | ƒ } | S(   Ns   LOADNEW s   LOAD (   R   (   R<   R   R    R!   t   ok(    (    s    /usr/lib/python2.6/webbrowser.pyR   ¯  s    (   R   R   RŒ   R   R   (    (    (    s    /usr/lib/python2.6/webbrowser.pyRx   ‰  s   		c       	   C   sí  d t  i j o' t d ƒ o t d d  t d ƒ ƒ n d t  i j o' t d ƒ o t d t t d ƒ ƒ n t d ƒ o t d d  t d ƒ ƒ n x5 d D]- }  t |  ƒ o t |  d  t |  ƒ ƒ qœ qœ Wt d ƒ o t d t t d ƒ ƒ n( t d ƒ o t d t t d ƒ ƒ n x5 d D]- }  t |  ƒ o t |  d  t |  ƒ ƒ q"q"Wt d ƒ o t d d  t d ƒ ƒ n t d ƒ o t d d  t	 d ƒ ƒ n t d ƒ o t d d  t d ƒ ƒ n t d ƒ o t d t
 d  ƒ n d  S(   Nt   GNOME_DESKTOP_SESSION_IDs
   gnome-opent   KDE_FULL_SESSIONRu   s   x-www-browsers   mozilla-firefoxt   firefoxs   mozilla-firebirdt   firebirdt	   iceweaselt   iceapet	   seamonkeyt   mozillat   netscapeRw   Rv   t   galeont   epiphanyt	   skipstonet   operat   mosaict   grail(	   s   mozilla-firefoxR“   s   mozilla-firebirdR”   R•   R–   R—   R˜   R™   (   Rš   R›   (   R#   R5   R"   R   R   R   Rr   Rn   Ro   Rp   Rx   (   R   (    (    s    /usr/lib/python2.6/webbrowser.pyt   register_X_browsers¾  s:        t   DISPLAYt   TERMs   www-browsert   linkst   elinkst   lynxt   w3mt   WindowsDefaultc           B   s   e  Z d  d d „ Z RS(   i    i   c         C   s0   y t  i | ƒ Wn t j
 o t SXt Sd  S(   N(   R#   t	   startfilet   WindowsErrorR   R   (   R<   R   R    R!   (    (    s    /usr/lib/python2.6/webbrowser.pyR     s
    (   R   R   R   (    (    (    s    /usr/lib/python2.6/webbrowser.pyR§     s   s   windows-defaultt   PROGRAMFILESs   C:\Program Filess   Internet Explorer\IEXPLORE.EXER“   R”   R—   R˜   R™   R   t   InternetConfigc           B   s   e  Z d  d d „ Z RS(   i    i   c         C   s   t  i | ƒ t S(   N(   t   ict	   launchurlR   (   R<   R   R    R!   (    (    s    /usr/lib/python2.6/webbrowser.pyR   *  s    (   R   R   R   (    (    (    s    /usr/lib/python2.6/webbrowser.pyR«   )  s   s   internet-configR   t   darwint   MacOSXc           B   s&   e  Z d  Z d „  Z d d d „ Z RS(   s{  Launcher class for Aqua browsers on Mac OS X

        Optionally specify a browser name on instantiation.  Note that this
        will not work for Aqua browsers if the user has moved the application
        package after installation.

        If no browser is specified, the default browser, as specified in the
        Internet System Preferences panel, will be used.
        c         C   s   | |  _  d  S(   N(   R   (   R<   R   (    (    s    /usr/lib/python2.6/webbrowser.pyR=   <  s    i    i   c   	      C   s  d | j p t  ‚ d | j o d | } n t t | ƒ ƒ } |  i d j o d | i d d ƒ } nU |  i d j o
 d	 } n d
 | d } d | i d d ƒ } d |  i | | f } t i d d ƒ } | d  j o t S| i	 | ƒ | i
 ƒ  } | S(   Nt   't   :s   file:t   defaults   open location "%s"t   "s   %22t   OmniWebR;   s   toWindow %di   s   OpenURL "%s"s‰   tell application "%s"
                                activate
                                %s %s
                            end tellt	   osascriptt   w(   t   AssertionErrorRY   RZ   R   RD   R#   t   popenR   R   t   writeRŽ   (	   R<   R   R    R!   t   scriptt   toWindowR'   t   osapipeRe   (    (    s    /usr/lib/python2.6/webbrowser.pyR   ?  s"    
(   R   R   R?   R=   R   (    (    (    s    /usr/lib/python2.6/webbrowser.pyR¯   2  s   		R²   t   os2t   os2netscapet   starts   %st   BROWSERR;   c    	   
   C   s  d d  k  }  d t i d } y# |  i  t i d d ƒ \ } } Wn? |  i j
 o0 } t i | IJt i | IJt i d ƒ n Xd } xB | D]: \ } } | d j o
 d } q | d j o
 d } q q Wt | ƒ d j o t i | IJt i d ƒ n | d } t | | ƒ d	 GHd  S(
   NiÿÿÿÿsD   Usage: %s [-n | -t] url
    -n: open new window
    -t: open new tabi    i   t   ntds   -ns   -ti   s   (   t   getoptRE   t   argvRƒ   RW   t   exitt   lenR   (	   RÂ   t   usaget   optsR@   t   msgt   new_wint   ot   aR   (    (    s    /usr/lib/python2.6/webbrowser.pyt   main„  s*    #  
 
t   __main__(5   R?   R#   R   RE   R.   RG   R_   t   __all__t	   ExceptionR    R   R
   R   R   R   R   R   R   R   RF   R-   R"   t   objectR:   R   R   RT   Rn   t   NetscapeRo   Rp   Rq   Rr   Rx   R    R5   R§   R$   R7   t   iexploreR   R¬   t   ImportErrorR«   R¯   R   R6   t   _userchoicest   reverseRM   R'   RÌ   R   (    (    (    s    /usr/lib/python2.6/webbrowser.pyt   <module>   s¬   		 			P95	1	 "0!	
 %	