ó õ^‚Rc@s>dZddlZddlZddlZddlZddlZddlZddddddgZdefd „ƒYZ iZ gZ dd d „Z dd „Zd ed„Zd„Zd„Zd d„Zejd dkrïd„Zn d„Zd„Zdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd „ƒYZeZd!efd"„ƒYZd#efd$„ƒYZeZ d%efd&„ƒYZ!d'efd(„ƒYZ"d)efd*„ƒYZ#d+efd,„ƒYZ$d-„Z%ej&jd.ƒr$e%ƒnej&jd/ƒròed0ƒr[e d0ded0ƒƒned1ƒr€e d1ded1ƒƒned2ƒr¥e d2de"d2ƒƒned3ƒrÊe d3ded3ƒƒned4ƒròe d4ded4ƒƒqònejd dkr¦d5efd6„ƒYZ'gZ iZ e d7e'ƒej(j)ej&jd8d9ƒd:ƒZ*xKd;d<d=d>d?d@e*fD]+Z+ee+ƒrte e+dee+ƒƒqtqtWnejdAkr/dBefdC„ƒYZ,dDefdE„ƒYZ-e dFde-dFƒdƒe d;de-d;ƒdƒe dBde-dGƒdƒnejd dHkred?ƒrgZ iZ e dIdedJd?dKgƒdƒndLej&krej&dLj.ej/ƒZ0e0j1ƒxXe0D]PZ2e2dMkr¸ee2dƒZ3e3d dkre e2dee2ƒdƒqq¸q¸WdZ2[2[0ndN„Z4e5dOkr:e4ƒndS(Ps?Interfaces for launching and remotely controlling Web browsers.iÿÿÿÿNtErrortopentopen_newt open_new_tabtgettregistercBseZRS((t__name__t __module__(((s /usr/lib/python2.7/webbrowser.pyRsicCsU||gt|jƒ<|dkr2tj|ƒn|dkrQtjd|ƒndS(s9Register a browser connector and, optionally, connection.iN(t _browserstlowert _tryordertappendtinsert(tnametklasstinstancetupdate_tryorder((s /usr/lib/python2.7/webbrowser.pyRs   cCsì|dk r|g}nt}x»|D]³}d|krqtj|ƒ}|ddkrdt|d ƒSt|ƒSq%yt|jƒ}Wntk r¤t |ƒ}nX|ddk r½|dS|ddk r%|dƒSq%Wt dƒ‚dS(sCReturn a browser launcher instance appropriate for the environment.s%siÿÿÿÿt&iis!could not locate runnable browserN( tNoneR tshlextsplittBackgroundBrowsertGenericBrowserRR tKeyErrort _synthesizeR(tusingt alternativestbrowsertcommand((s /usr/lib/python2.7/webbrowser.pyRs$      icCs:x3tD]+}t|ƒ}|j|||ƒrtSqWtS(N(R RRtTruetFalse(turltnewt autoraiseR R((s /usr/lib/python2.7/webbrowser.pyR:s   cCs t|dƒS(Ni(R(R((s /usr/lib/python2.7/webbrowser.pyRAscCs t|dƒS(Ni(R(R((s /usr/lib/python2.7/webbrowser.pyRDscCsì|jƒd}t|ƒs&ddgStjj|ƒ}yt|jƒ}Wntk rfddgSX|d}|râ|jƒ|jkrâddl }|j |ƒ}||_ tjj|ƒ|_t |d||ƒd|gSddgS(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]. iiiÿÿÿÿN( Rt _iscommandRtostpathtbasenameRR RtcopyR R(RRtcmdR Rt controllerR&((s /usr/lib/python2.7/webbrowser.pyRHs"         itwincCs`|jƒ}tjj|ƒr1|jdƒr1tSx(dD] }tjj||ƒr8tSq8WtS(Ns.exes.bat(s.exes.bat(s.exes.bat(R R#R$tisfiletendswithRR(R'text((s /usr/lib/python2.7/webbrowser.pyt _isexecutableis ! cCsZtjj|ƒrVtj|ƒtj}|tj@sO|tj@sO|tj@rVtSnt S(N( R#R$R*tstattST_MODEtS_IXUSRtS_IXGRPtS_IXOTHRR(R'tmode((s /usr/lib/python2.7/webbrowser.pyR-rs 'cCsrt|ƒrtStjjdƒ}|s,tSx?|jtjƒD]+}tjj ||ƒ}t|ƒr?tSq?WtS(sSReturn True if cmd is executable or can be found on the executable search path.tPATH( R-RR#tenvironRRRtpathsepR$tjoin(R'R$tdtexe((s /usr/lib/python2.7/webbrowser.pyR"ys  t BaseBrowsercBsDeZdZdgZdd„Zded„Zd„Zd„ZRS(s3Parent class for all browsers. Do not use directly.s%stcCs||_||_dS(N(R R%(tselfR ((s /usr/lib/python2.7/webbrowser.pyt__init__s icCs t‚dS(N(tNotImplementedError(R<RR R!((s /usr/lib/python2.7/webbrowser.pyR“scCs|j|dƒS(Ni(R(R<R((s /usr/lib/python2.7/webbrowser.pyR–scCs|j|dƒS(Ni(R(R<R((s /usr/lib/python2.7/webbrowser.pyR™s( RRt__doc__targsR=RRRR(((s /usr/lib/python2.7/webbrowser.pyR:Šs    RcBs&eZdZd„Zded„ZRS(sVClass for all browsers started with a command and without remote functionality.cCs]t|tƒr'||_dg|_n|d|_|d|_tjj|jƒ|_dS(Ns%sii(t isinstancet basestringR R@R#R$R%(R<R ((s /usr/lib/python2.7/webbrowser.pyR=¡s    icCs”|jgg|jD]}|jd|ƒ^q}yItjd dkrZtj|ƒ}ntj|dtƒ}|jƒ SWnt k rt SXdS(Ns%siR)t close_fds( R R@treplacetsystplatformt subprocesstPopenRtwaittOSErrorR(R<RR R!targtcmdlinetp((s /usr/lib/python2.7/webbrowser.pyR«s & (RRR?R=RR(((s /usr/lib/python2.7/webbrowser.pyRs RcBseZdZded„ZRS(sHClass for all browsers which are to be started in the background.icCsÌ|jgg|jD]}|jd|ƒ^q}ytjd dkrZtj|ƒ}nHttddƒ}|s‡ttddƒ}ntj|dt d|ƒ}|j ƒdkSWnt k rÇt SXdS(Ns%siR)tsetsidtsetpgrpRCt preexec_fn(R R@RDRERFRGRHtgetattrR#RRtpollRJR(R<RR R!RKRLRMRN((s /usr/lib/python2.7/webbrowser.pyR¼s & (RRR?RR(((s /usr/lib/python2.7/webbrowser.pyR¸st UnixBrowsercBsVeZdZdZddgZdZdZdZe Z e Z d„Z de d„ZRS(s=Parent class for all Unix browsers with remote functionality.s%actions%sc Cs{g}|rC|jrCt|ƒ}|j|}|rC|g}qCn|jg||}|sf|jr{ttjdƒ}nd}ttddƒ}|s®ttddƒ}nt j |dt d|d|j rÕ|pØdd|d|ƒ} |rFt jd ƒ| jƒ} | dkrAt jd ƒ| jƒ} | dkrAt Sn| S|jrl| jƒdkret StSn | jƒ SdS( Nsr+RNRORCtstdintstdouttstderrRPii(t raise_optstintR t backgroundtfileR#tdevnullRRQRGRHRtredirect_stdoutttimetsleepRRRRI( R<R@tremoteR!t raise_opttoptRLtinoutRNRMtrc((s /usr/lib/python2.7/webbrowser.pyt_invoke×s<         icCs |dkr|j}n_|dkr0|j}nG|dkrc|jdkrW|j}qw|j}ntdd|ƒ‚g|jD]$}|jd|ƒjd|ƒ^q}|j|t|ƒ}|sg|j D]}|jd|ƒ^qÐ}|j|t t ƒStSdS(NiiisBad 'new' parameter to open(); sexpected 0, 1, or 2, got %ss%ss%action( t remote_actiontremote_action_newwintremote_action_newtabRRt remote_argsRDRdRR@R(R<RR R!tactionRKR@tsuccess((s /usr/lib/python2.7/webbrowser.pyRs"       1(N(RRR?RRWRhReRfRgRRYRR\RdR(((s /usr/lib/python2.7/webbrowser.pyRSÌs  ,tMozillacBs>eZdZddgZddgZdZdZdZeZ RS(s-Launcher class for Mozilla/Netscape browsers.s-noraises-raises-remotesopenURL(%s%action)R;s ,new-windows,new-tab( RRR?RWRhReRfRgRRY(((s /usr/lib/python2.7/webbrowser.pyRks  tGaleoncBs8eZdZddgZddgZdZdZeZRS(s,Launcher class for Galeon/Epiphany browsers.s-noraiseR;s%actions%ss-ns-w( RRR?RWRhReRfRRY(((s /usr/lib/python2.7/webbrowser.pyRl)s   tChromecBs2eZdZddgZdZdZdZeZRS(s)Launcher class for Google Chrome browser.s%actions%sR;s --new-window( RRR?RhReRfRgRRY(((s /usr/lib/python2.7/webbrowser.pyRm3s  tOperacBs>eZdZddgZddgZdZdZdZeZ RS(s!Launcher class for Opera browser.s-noraiseR;s-remotesopenURL(%s%action)s ,new-windows ,new-page( RRR?RWRhReRfRgRRY(((s /usr/lib/python2.7/webbrowser.pyRn?s  tElinkscBs8eZdZddgZdZdZdZeZeZ RS(s#Launcher class for Elinks browsers.s-remotesopenURL(%s%action)R;s ,new-windows,new-tab( RRR?RhReRfRgRRYR\(((s /usr/lib/python2.7/webbrowser.pyRoJs t KonquerorcBseZdZded„ZRS(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. ic Csw|dkrd}nd}ttjdƒ}ttddƒ}|sZttddƒ}ny4tjd||gdtd |d |d |ƒ}Wntk r¡nX|j ƒtSy:tjd d |gdtd |d |d |d|ƒ}Wntk rýnX|j ƒdkrtSy:tjdd|gdtd |d |d |d|ƒ}Wntk rbt SX|j ƒdkSdS(NitnewTabtopenURLsr+RNROt kfmclientRCRTRURVt konquerors--silentRPtkfms-d( RZR#R[RQRRGRHRRJRIRRR(R<RR R!RiR[RNRM((s /usr/lib/python2.7/webbrowser.pyR_s@             (RRR?RR(((s /usr/lib/python2.7/webbrowser.pyRpXstGrailcBs)eZd„Zd„Zded„ZRS(c Csddl}ddl}ddl}ddl}tjj|jƒdƒ}|jtj ƒƒd}tjj||dƒ}|j|ƒ}|s–dS|j|j |j ƒ} x_|D]W} y| j | ƒWn9|jk rytj| ƒWq tk rq XqµX| SqµWdS(Niÿÿÿÿs .grail-unixis-*(tglobtpwdtsocketttempfileR#R$R7t gettempdirtgetpwuidtgetuidRtAF_UNIXt SOCK_STREAMtconnectterrortunlinktIOError( R<RwRxRyRzttempdirtusertfilenametmaybeststfn((s /usr/lib/python2.7/webbrowser.pyt_find_grail_rc•s*       cCs1|jƒ}|sdS|j|ƒ|jƒdS(Nii(RŠtsendtclose(R<RiRˆ((s /usr/lib/python2.7/webbrowser.pyt_remote¯s    icCs3|r|jd|ƒ}n|jd|ƒ}|S(NsLOADNEW sLOAD (R(R<RR R!tok((s /usr/lib/python2.7/webbrowser.pyR·s(RRRŠRRR(((s /usr/lib/python2.7/webbrowser.pyRv‘s  c Csdtdƒr%tddtdƒƒndtjkrYtdƒrYtddtdƒƒndtjkrtdƒrtddtdƒƒndtjkrÁtdƒrÁtdttdƒƒntdƒrætddtdƒƒnx3dD]+}t|ƒrít|dt|ƒƒqíqíWtdƒrAtdttdƒƒn%tdƒrftdttdƒƒnx3dD]+}t|ƒrmt|dt|ƒƒqmqmWtdƒrÁtddtdƒƒnx3dD]+}t|ƒrÈt|dt |ƒƒqÈqÈWtdƒrtddt dƒƒntdƒrAtddtdƒƒntdƒr`tdt dƒndS( Nsxdg-opentGNOME_DESKTOP_SESSION_IDs gvfs-opens gnome-opentKDE_FULL_SESSIONRss x-www-browsersmozilla-firefoxtfirefoxsmozilla-firebirdtfirebirdt iceweaselticeapet seamonkeytmozillatnetscapeRuRttgaleontepiphanyt skipstones google-chrometchrometchromiumschromium-browsertoperatmosaictgrail( smozilla-firefoxR‘smozilla-firebirdR’R“R”R•R–R—(R˜R™(s google-chromeR›Rœschromium-browser( R"RRRR#R5RpRkRlRmRnRv(R((s /usr/lib/python2.7/webbrowser.pytregister_X_browsersÆsD              tDISPLAYtTERMs www-browsertlinkstelinkstlynxtw3mtWindowsDefaultcBseZded„ZRS(icCs.ytj|ƒWntk r%tSXtSdS(N(R#t startfilet WindowsErrorRR(R<RR R!((s /usr/lib/python2.7/webbrowser.pyRs  (RRRR(((s /usr/lib/python2.7/webbrowser.pyR§sswindows-defaultt PROGRAMFILESsC:\Program FilessInternet Explorer\IEXPLORE.EXER‘R’R•R–R—RtdarwintMacOSXcBs&eZdZd„Zded„ZRS(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. cCs ||_dS(N(R (R<R ((s /usr/lib/python2.7/webbrowser.pyR=Esic Cs÷d|kst‚d|kr+d|}ntt|ƒƒ}|jdkred|jddƒ}nR|jdkr}d }nd |d }d |jddƒ}d |j||f}tjddƒ}|dkrÙtS|j |ƒ|j ƒ}| S(Nt't:sfile:tdefaultsopen location "%s"t"s%22tOmniWebR;s toWindow %dis OpenURL "%s"s‰tell application "%s" activate %s %s end tellt osascripttw( tAssertionErrorRXtboolR RDR#tpopenRRtwriteRŒ( R<RR R!tscriptttoWindowR'tosapipeRc((s /usr/lib/python2.7/webbrowser.pyRHs"      (RRR?R=RR(((s /usr/lib/python2.7/webbrowser.pyR¬;s  tMacOSXOSAScriptcBs eZd„Zded„ZRS(cCs ||_dS(N(t_name(R<R ((s /usr/lib/python2.7/webbrowser.pyR=jsicCs‡|jdkr(d|jddƒ}nd|j|jddƒf}tjddƒ}|dkritS|j|ƒ|jƒ}| S(NR¯sopen location "%s"R°s%22sž tell application "%s" activate open location "%s" end R²R³(R¼RDR#R¶RRR·RŒ(R<RR R!R¸RºRc((s /usr/lib/python2.7/webbrowser.pyRms   (RRR=RR(((s /usr/lib/python2.7/webbrowser.pyR»is tsafariR¯tos2t os2netscapetstarts%stBROWSERR;c Csddl}dtjd}y#|jtjddƒ\}}Wn=|jk r}tj|IJtj|IJtjdƒnXd}x>|D]6\}}|dkr®d}q|dkrd}qqWt|ƒdkrötj|IJtjdƒn|d}t||ƒd GHdS( NiÿÿÿÿsDUsage: %s [-n | -t] url -n: open new window -t: open new tabiitntds-ns-tis(tgetoptREtargvRRVtexittlenR( RÃtusagetoptsR@tmsgtnew_wintotaR((s /usr/lib/python2.7/webbrowser.pytmain§s( #       t__main__(6R?R#RRER.RGR]t__all__t ExceptionRRR RRRRRRRRRFR-R"tobjectR:RRRSRktNetscapeRlRmtChromiumRnRoRpRvR R5R§R$R7tiexploreRR¬R»RR6t _userchoicestreverseRLR'RÍR(((s /usr/lib/python2.7/webbrowser.pyts¦            P    95 >           .    #