mò
­fIc           @   s|  d  Z  d k Z d k Z d d d d g Z d e f d „  ƒ  YZ h  Z g  Z d d „ Z	 d d „ Z
 d	 d
 d „ Z d „  Z d „  Z d „  Z d Z d f  d „  ƒ  YZ d f  d „  ƒ  YZ d f  d „  ƒ  YZ d f  d „  ƒ  YZ d f  d „  ƒ  YZ d f  d „  ƒ  YZ e i i
 d ƒ p e i i
 d ƒ o×d d d  g Z e i i
 d ƒ oy e d ƒ o e	 d d e d! ƒ ƒ n e d ƒ o e	 d d e d" ƒ ƒ n e d  ƒ o e	 d  d e d# ƒ ƒ qÇn e i i
 d ƒ o%d$ d% d& d' d( d) d* d+ g e Z x5 d= D]- Z e e ƒ o e	 e d e e ƒ ƒ qqWe d, ƒ o e	 d, d e d- ƒ ƒ n e d$ ƒ o e	 d$ d e d$ ƒ ƒ n e d% ƒ o e	 d% d e d. ƒ ƒ n e d* ƒ p e d/ ƒ o e	 d* e e ƒ  ƒ n e d+ ƒ o e	 d+ e d ƒ qÿqn d0 f  d1 „  ƒ  YZ e i d2  d3 j o d) d4 g Z e	 d4 e ƒ n y d k Z Wn e j
 o n Xd5 g Z e	 d5 e ƒ e i d2  d6 j o0 e d7 ƒ o# d8 g Z e	 d8 d e d9 ƒ ƒ n d: e i j o$ e i d: i e i ƒ e d	 d	 +n xb e D]Z Z e i ƒ  e j oA e e i ƒ  ƒ o* e	 e i ƒ  d e d; e i ƒ  ƒ ƒ qYqÿqÿWd Z [ e  d< „  e ƒ Z d S(>   s?   Interfaces for launching and remotely controlling Web browsers.Nt   Errort   opent   gett   registerc           B   s   t  Z RS(   N(   t   __name__t
   __module__(    (    (    t'   /mit/python/lib/python2.4/webbrowser.pyR       s   c         C   s   | | g t |  i ƒ  <d S(   s9   Register a browser connector and, optionally, connection.N(   t   klasst   instancet	   _browserst   namet   lower(   R
   R   R   (    (    R   R      s     c         C   sº   |  d j	 o |  g } n t } x‡ | D] } d | j o t | ƒ Sq' y t | i ƒ  } Wn t	 j
 o t
 | ƒ } n X| d d j o | d ƒ  Sq' | d Sq' Wt d ƒ ‚ d S(   sC   Return a browser launcher instance appropriate for the environment.s   %si   i    s!   could not locate runnable browserN(   t   usingt   Nonet   alternativest	   _tryordert   browsert   GenericBrowserR	   R   t   commandt   KeyErrort   _synthesizeR    (   R   R   R   R   (    (    R   R      s       i    i   c         C   s   t  ƒ  i |  | | ƒ d  S(   N(   R   R   t   urlt   newt	   autoraise(   R   R   R   (    (    R   R   *   s    c         C   s   t  ƒ  i |  d ƒ d  S(   Ni   (   R   R   R   (   R   (    (    R   t   open_new-   s    c         C   sì   t  i i |  ƒ p d d g Sn t  i i |  ƒ } y t | i ƒ  } Wn t
 j
 o d d g Sn X| d } | oj | i ƒ  | i j oT d k } | i | ƒ } |  | _ t  i i |  ƒ | _ t |  d | ƒ d | g Sn 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   N(   t   ost   patht   existsR   R   t   basenameR
   R	   R   R   R   t
   controllert   copyR   (   R   R
   R   R   R   (    (    R   R   1   s"     
		c         C   sr   t  i i d ƒ } | p t Sn xJ | i t  i ƒ D]6 } t  i i | |  ƒ } t  i i | ƒ o t Sq4 q4 Wt S(   s>   Return True if cmd can be found on the executable search path.t   PATHN(   R   t   environR   R   t   Falset   splitt   pathsept   dt   joint   cmdt   exet   isfilet   True(   R&   R'   R$   R   (    (    R   t
   _iscommandP   s      i   R   c           B   s)   t  Z d „  Z d d d „ Z d „  Z RS(   Nc         C   s:   | i d  d ƒ \ |  _ |  _ t i i |  i ƒ |  _ d  S(   Ni   (	   R&   R"   R   t   selfR
   t   argsR   R   R   (   R+   R&   (    (    R   t   __init__`   s    i    i   c         C   s?   d | j p t ‚ d |  i |  i f } t i | | ƒ d  S(   Nt   's   %s %s(   R   t   AssertionErrorR+   R
   R,   R   R   t   system(   R+   R   R   R   R   (    (    R   R   d   s    c         C   s   |  i | ƒ d  S(   N(   R+   R   R   (   R+   R   (    (    R   R   i   s    (   R   R   R-   R   R   (    (    (    R   R   _   s   	t   Netscapec           B   s8   t  Z d  Z d „  Z d „  Z d d d „ Z d „  Z RS(   s%   Launcher class for Netscape browsers.c         C   s"   | |  _  t i i | ƒ |  _ d  S(   N(   R
   R+   R   R   R   (   R+   R
   (    (    R   R-   o   s    	c         C   sx   d | } d |  i | | f } t i | ƒ } | o= d  k	 } t i d |  i ƒ | i
 t ƒ t i | ƒ } n | S(   Ns   -noraises   -raises"   %s %s -remote '%s' >/dev/null 2>&1s   %s &(   s   -noraises   -raise(   R   t	   raise_optR+   R
   t   actionR&   R   R0   t   rct   timet   sleept   PROCESS_CREATION_DELAY(   R+   R3   R   R&   R2   R5   R4   (    (    R   t   _remotes   s    
	i    i   c         C   s7   | o |  i d | | ƒ n |  i d | | ƒ d  S(   Ns   openURL(%s,new-window)s   openURL(%s)(   R   R+   R8   R   R   (   R+   R   R   R   (    (    R   R   €   s    c         C   s   |  i | d ƒ d  S(   Ni   (   R+   R   R   (   R+   R   (    (    R   R   †   s    (   R   R   t   __doc__R-   R8   R   R   (    (    (    R   R1   m   s
    		t   Galeonc           B   s8   t  Z d  Z d „  Z d „  Z d d d „ Z d „  Z RS(   s#   Launcher class for Galeon browsers.c         C   s"   | |  _  t i i | ƒ |  _ d  S(   N(   R
   R+   R   R   R   (   R+   R
   (    (    R   R-   Œ   s    	c         C   sx   d | } d |  i | | f } t i | ƒ } | o= d  k	 } t i d |  i ƒ | i
 t ƒ t i | ƒ } n | S(   Ns	   --noraiset    s   %s %s %s >/dev/null 2>&1s   %s >/dev/null 2>&1 &(   s	   --noraiseR;   (   R   R2   R+   R
   R3   R&   R   R0   R4   R5   R6   R7   (   R+   R3   R   R&   R2   R5   R4   (    (    R   R8      s    
	i    i   c         C   s7   | o |  i d | | ƒ n |  i d | | ƒ d  S(   Ns   -w '%s's   -n '%s'(   R   R+   R8   R   R   (   R+   R   R   R   (    (    R   R   ›   s    c         C   s   |  i | d ƒ d  S(   Ni   (   R+   R   R   (   R+   R   (    (    R   R   ¡   s    (   R   R   R9   R-   R8   R   R   (    (    (    R   R:   Š   s
    		t	   Konquerorc           B   s5   t  Z d  Z d „  Z d „  Z d d d „ Z e Z RS(   sÇ   Controller for the KDE File Manager (kfm, or Konqueror).

    See http://developer.kde.org/documentation/other/kfmclient.html
    for more information on the Konqueror remote-control interface.

    c         C   s5   t  d ƒ o d |  _ |  _ n d |  _ |  _ d  S(   Nt	   konquerort   kfm(   R*   R+   R
   R   (   R+   (    (    R   R-   ¬   s    c         C   sŠ   d | } t i | ƒ } | oe d  k } |  i d j o t i |  i d ƒ n t i |  i d ƒ | i	 t
 ƒ t i | ƒ } n | S(   Ns   kfmclient %s >/dev/null 2>&1R=   s    --silent &s    -d &(   R3   R&   R   R0   R4   R5   R+   R   R
   R6   R7   (   R+   R3   R&   R4   R5   (    (    R   R8   ²   s    
	i   c         C   s)   d | j p t ‚ |  i d | ƒ d  S(   NR.   s   openURL '%s'(   R   R/   R+   R8   (   R+   R   R   R   (    (    R   R   ¿   s    (   R   R   R9   R-   R8   R   R   (    (    (    R   R<   ¥   s
    		t   Grailc           B   s2   t  Z d „  Z d „  Z d d d „ Z d „  Z RS(   Nc         C   s  d  k  }	 d  k } d  k } d  k } t i i | i ƒ  d ƒ } | i	 t i
 ƒ  ƒ d } t i i | | d ƒ } |	 i  | ƒ } | p d  Sn | i | i | i ƒ } xc | D][ }
 y | i |
 ƒ Wn= | i j
 o. y t i |
 ƒ Wq	t j
 o q	Xq® X| Sq® Wd  S(   Ns   .grail-unixi    s   -*(   t   globt   pwdt   sockett   tempfileR   R   R%   t
   gettempdirt   tempdirt   getpwuidt   getuidt   usert   filenamet   maybesR   t   AF_UNIXt   SOCK_STREAMt   st   fnt   connectt   errort   unlinkt   IOError(   R+   RB   RC   RM   RI   RJ   RA   RH   RE   R@   RN   (    (    R   t   _find_grail_rcÌ   s,    					 
c         C   s6   |  i ƒ  } | p d Sn | i | ƒ | i ƒ  d S(   Ni    i   (   R+   RS   RM   t   sendR3   t   close(   R+   R3   RM   (    (    R   R8   æ   s    
i    i   c         C   s1   | o |  i d | ƒ n |  i d | ƒ d  S(   Ns   LOADNEW s   LOAD (   R   R+   R8   R   (   R+   R   R   R   (    (    R   R   î   s    c         C   s   |  i | d ƒ d  S(   Ni   (   R+   R   R   (   R+   R   (    (    R   R   ô   s    (   R   R   RS   R8   R   R   (    (    (    R   R?   È   s   		t   WindowsDefaultc           B   s    t  Z d d d „ Z d „  Z RS(   Ni    i   c         C   s   t  i | ƒ d  S(   N(   R   t	   startfileR   (   R+   R   R   R   (    (    R   R   ù   s    c         C   s   |  i | ƒ d  S(   N(   R+   R   R   (   R+   R   (    (    R   R   ü   s    (   R   R   R   R   (    (    (    R   RV   ø   s   t   TERMt   DISPLAYt   linkst   lynxt   w3ms
   links '%s's	   lynx '%s's   w3m '%s't   galeont	   skipstones   mozilla-firefoxs   mozilla-firebirdt   mozillat   netscapeR>   t   grailt   mosaics   mosaic '%s' >/dev/null &s   skipstone '%s' >/dev/null &R=   t   InternetConfigc           B   s    t  Z d d d „ Z d „  Z RS(   Ni    i   c         C   s   t  i | ƒ d  S(   N(   t   ict	   launchurlR   (   R+   R   R   R   (    (    R   R   :  s    c         C   s   |  i | ƒ d  S(   N(   R+   R   R   (   R+   R   (    (    R   R   =  s    (   R   R   R   R   (    (    (    R   Rc   9  s   i   t   wins   windows-defaults   internet-configt   os2s   netscape.exet   os2netscapes   start netscape.exe %st   BROWSERs   %s '%%s'c         C   s&   |  i ƒ  t j p |  i d ƒ d j S(   Ns   %siÿÿÿÿ(   t   xR   R	   t   find(   Rj   (    (    R   t   <lambda>p  s    (   s   mozilla-firefoxs   mozilla-firebirdR_   R`   (!   R9   R   t   syst   __all__t	   ExceptionR    R	   R   R   R   R   R   R   R   R*   R7   R   R1   R:   R<   R?   RV   R    R   Rc   t   platformRd   t   ImportErrorR"   R#   R&   R   t   filter(   R&   RV   Rc   R   Rd   R   R   Rn   R:   R1   R<   R*   R   R	   Rm   R   R?   R    R   R   R7   R   R   (    (    R   t   ?   sŠ   					#0&" 	!		$ 2	