VcbdZddlZddlZddlZddlZddlZddlZddlZgdZGdde Z ej Z iZ dadad4dddZd4d Zd5d Zd Zd ZdddZGddeZGddeZGddeZGddeZGddeZGddeZGddeZGddeZeZGdd eZ Gd!d"eZ!Gd#d$eZ"Gd%d&eZ#d'Z$d(Z%ej&dd)d*krGd+d,eZ'ej&d-krGd.d/eZ(Gd0d1eZ)d2Z*e+d3kr e*dSdS)6z?Interfaces for launching and remotely controlling web browsers.N)Erroropenopen_new open_new_tabgetregisterceZdZdS)rN)__name__ __module__ __qualname__#/usr/lib64/python3.11/webbrowser.pyrrsDrrF preferredc<t5tt||gt|<|st r%|t vrtd|nt|ddddS#1swxYwYdS)zRegister a browser connector.Nr)_lock _tryorderregister_standard_browsers _browserslower_os_preferred_browserinsertappend)nameklassinstancers rrrs  # #  ) & ( ( (#(("3 $**,,  #. #4;P3P #   Q % % % %   T " " " # # # # # # # # # # # # # # # # # #sAz'GenericBrowser.open..7!7!7!7%("%T3!7!7!7!7!7rwinT) close_fdsF) sysauditrrQplatform subprocessPopenwaitOSErrorrFr.r/r0cmdlineps ` rrzGenericBrowser.opens #S)))9+!7!7!7!7,0I!7!7!77 |BQB5( >$W--$W===vvxx<    55 sAB BBNrOr r r rPrGrr rrr&r&sA,,444      rr&ceZdZdZddZdS)r%zHClass for all browsers which are to be started in the background.rTc>|jgfd|jDz}tjd tjdddkrt j|}nt j|dd}|duS#t$rYdSwxYw)Nc<g|]}|dSrYrZr\s rr_z*BackgroundBrowser.open..r`rrWrarbT)rcstart_new_sessionF) rrQrdrerfrgrhpollrjrks ` rrzBackgroundBrowser.opens9+!7!7!7!7,0I!7!7!77 #S))) |BQB5( =$W--$W7;===FFHH$ %   55 sAB BBNrOr r r rPrr rrr%r%s2      rr%cBeZdZdZdZdZdZddgZdZdZ dZ d dZ d d Z dS) UnixBrowserz=Parent class for all Unix browsers with remote functionality.NFT%actionrcg}|r(|jr!t|}|j|}|r|g}|jg|z|z}|s|jr tj}nd}t j|d||jr|pd|d} |r/ | d} | S#tj $rYdSwxYw|jr| dSdS|  S)NTrcstdinstdoutstderrrrF) raise_optsintr backgroundrgDEVNULLrhredirect_stdoutriTimeoutExpiredrs) rFrQremoter0r. raise_optoptrlinoutrmrcs r_invokezUnixBrowser._invokes#  &do &II/),C %I9+ )D0  T_ &EEE  WE%)%9%Ce%Kt$)T C C C   VVAYYv ,   tt  _ vvxx tuvvxx< s9BB$#B$rctjd|dkr|jn@|dkr|jn2|dkr|j|jn|jnt dd|zzfd|jD}d|D}||d |}|s*fd |jD}||d d Sd S) NrWrr"r6zBad 'new' parameter to open(); zexpected 0, 1, or 2, got %scdg|],}|dd-S)rrwrZ)r]r^actionr.s rr_z$UnixBrowser.open..sG--- D#&&..y&AA---rcg|]}||Sr r )r]r^s rr_z$UnixBrowser.open..s+++s++++rTc<g|]}|dSrYrZr\s rr_z$UnixBrowser.open..s'@@@sCKKc**@@@rF) rdre remote_actionremote_action_newwinremote_action_newtabr remote_argsrrQ)rFr.r/r0rQsuccessrs ` @rrzUnixBrowser.opens( #S))) !8 ='FF AX =.FF AX =( 32295;<== =-----+---++t+++,,tT9c:: @@@@di@@@D<<eU33 34rrDrO) r r r rPr~rrrrrrrrr rrrvrvsoGGJJOd#KM! ! ! ! Frrvc*eZdZdZddgZdZdZdZdZdS) Mozillaz$Launcher class for Mozilla browsers.rwrrBz -new-windowz-new-tabTN r r r rPrrrrrr rrrrs4..d#KM(%JJJrrc2eZdZdZddgZddgZdZdZdZd Z d S) Netscapez$Launcher class for Netscape browser.-noraisez-raise-remoteopenURL(%s%action)rB ,new-window,new-tabTN) r r r rPr~rrrrrr rrrr's?..h'J23KM(%JJJrrc.eZdZdZddgZddgZdZdZdZd S) Galeonz,Launcher class for Galeon/Epiphany browsers.rrBrwr-nz-wTN) r r r rPr~rrrrr rrrr2s866b!Jd#KMJJJrrc*eZdZdZddgZdZdZdZdZdS)Chromez)Launcher class for Google Chrome browser.rwrrB --new-windowTNrr rrrr<s4//d#KM)JJJrrc*eZdZdZddgZdZdZdZdZdS)Operaz!Launcher class for Opera browser.rwrrBrTNrr rrrrHs4''d#KM)JJJrrc.eZdZdZddgZdZdZdZdZdZ dS) Elinksz#Launcher class for Elinks browsers.rrrBrrFN) r r r rPrrrrrrr rrrrRs<))23KM(%JOOOrrceZdZdZddZdS) KonquerorzController for the KDE File Manager (kfm, or Konqueror). See the output of ``kfmclient --commands`` for more information on the Konqueror remote-control interface. rTctjd||dkrd}nd}tj} tjd||gd|||}|dS#t $rYnwxYw tjdd |gd|||d }|dSn#t $rYnwxYw tjd d |gd|||d }|duS#t $rYd SwxYw)NrWr6newTabopenURL kfmclientT)rcrzr{r| konquerorz--silentrykfmz-dF)rdrergrrhrirjrs)rFr.r/r0rdevnullrms rrzKonqueror.opengsx #S))) !8 FFF$  +vs!;+/w(/AAAA FFHHH4     D   +z3!?+/w(/37999Avvxx t      D  & %s!3+/w(/37999AFFHH$ %   55 s5A A-,A-1B%% B21B26C)) C76C7NrOrtr rrrr`s2 +&+&+&+&+&+&rrc"eZdZdZdZddZdS)Grailcddl}ddl}ddl}ddl}tj|d}|t j d}tj| || |dz}||}|sdS||j |j } |D]Q} | | | cS#t$r) t j| n#t$rYnwxYwYNwxYwdS)Nrz .grail-unixz-*)globpwdsockettempfiler:r;join gettempdirgetpwuidgetuidescapeAF_UNIX SOCK_STREAMconnectrjunlink) rFrrrrtempdiruserfilenamemaybessfns r_find_grail_rczGrail._find_grail_rcs[   ',,x2244,..||BIKK((+7<< G 4 4dkk$6G6G$6NOO8$$ 4 MM&.&*< = =  B  "    IbMMMMD    s66D ED/.E/ D<9E;D<<EEc|}|sdS|||dS)Nrr")rsendclose)rFrrs r_remotez Grail._remotesA    ! ! 1 v  qrrTctjd||r|d|z}n|d|z}|S)NrWzLOADNEW zLOAD )rdrer)rFr.r/r0oks rrz Grail.opensO #S)))  -j3.//BBgm,,B rNrO)r r r rrrr rrrrsF4rrcZtjdrtddtdtjdr tddtgddtjvr2tjdrtddtddtjvr7tjdr#tdt t dtjdrtddtdd D]4}tj|rt|dt|5d D]4}tj|rt|dt|5tjd r$td t t d n7tjd r#td t t d d D]4}tj|rt|dt|5tjdrtddtddD]4}tj|rt|dt|5tjdrtddtdtjdrtddtdtjdrtdtddSdS)Nzxdg-opengio)rrz--rGNOME_DESKTOP_SESSION_IDz gvfs-openKDE_FULL_SESSIONrz x-www-browser)firefox iceweaseliceape seamonkey)zmozilla-firefoxzmozilla-firebirdfirebirdmozillanetscaperr)galeonepiphany skipstone)z google-chromechromechromiumzchromium-browseroperamosaicgrail) r8r9rr%r:environrrrrrrr)r+s rregister_X_browsersrs,|JBT#4Z#@#@AAA|EN/0K0K0KLLMMM"RZ/DFL4M4MDd$5k$B$BCCCRZ'AFL,E,EAi;)?)?@@@ |O$$L$(9/(J(JKKKC66 <  6 WdGG$4$4 5 5 5+77 <  7 WdHW$5$5 6 6 6|EA 9U#3#34444 k " "Ai;)?)?@@@*55 <  5 WdF7OO 4 4 4|K  Dd$5k$B$BCCCO55 <  5 WdF7OO 4 4 4|G0$g///|H>4!28! raw_resultresult userchoicesrls rrr sI |x<4!;!;<<<4!:!:;;;D/)"<"<===4!:!:;;; ||#@D"3I">">??? |BQB5 (="N3337<< ~?R S S ACC!:{I"GX7 D DG|G$$ D$(9'(B(BCCC D :>>) $ $ " 7H(I(I " /<BBDD'4SASTTT #**,,2244 )/%% &z'DoWij     ! ! ! :>>& ! ! =|M** Mn].K.KLLL|G$$ A$w(?(?@@@|H%% ;4)9)9:::|F## ?~f'='=>>>|E"" =nU&;&;<<<BJ Uj+11"*== # U UG"} U!'T:::q6UWdN7,C,CtTTTT U U  U Us#AH"H%$H%rarbceZdZddZdS)rrTc|tjd| tj|dS#t$rYdSwxYw)NrWTF)rdrer: startfilerjrJs rrzWindowsDefault.open^sW I' - - -  S!!! t    uu s - ;;NrO)r r r rr rrrr]s(      rrrc eZdZdZdZddZdS)ra{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. cftj|jjdtd||_dS)Nz3 is deprecated in 3.11 use MacOSXOSAScript instead.r6 stacklevelwarningswarn __class__r DeprecationWarningrrEs rrGzMacOSX.__init__ysF MT^4:::;MZ[ ] ] ] ]DIIIrrTctjd|d|vrd|z}tt|}|jdkrd|ddz}n@|jdkrd }nd |d z z}d |ddz}d |jd|d|d}t jdd}|dS||| }| S)NrW:zfile:ropen location "%s""%22OmniWebrBz toWindow %dr"z OpenURL "%s"ztell application "zK" activate  z% end tell osascriptwF) rdrerboolrr[r:popenwriter) rFr.r/r0scripttoWindowr>osapipers rrz MacOSX.open~s I' - - -#: "ckd3ii..CyI% E- C0G0GG9 )9!HH -a8H$s{{3'>'>>,0999ccc888E h{C00G u MM& ! ! !B6MrNrOrnr rrrrosA           rrc^eZdZdfd ZedZejdZd dZxZS) rrcJt|dSrD)superrG)rFrr s rrGzMacOSXOSAScript.__init__s! GG  T " " " " "rc|tj|jjd|jjdtd|jSNz!._name is deprecated in 3.11 use z.name instead.r6rr )rFs r_namezMacOSXOSAScript._namesW MT^4JJ"&."9JJJ, < < < <9 rctj|jjd|jjdtd||_dSr!r )rFvals rr"zMacOSXOSAScript._namesZ MT^4JJ"&."9JJJ, < < < <DIIIrrTc|jdkrd|ddz}n d|j|ddfz}tjdd}|dS|||}| S) Nrrrrz tell application "%s" activate open location "%s" end rrF)rr[r:rrr)rFr.r/r0rrrs rrzMacOSXOSAScript.opensyI% <- C0G0GG  3;;sE#:#:; <h{C00G u MM& ! ! !B6Mr)rrO) r r r rGpropertyr"setterr __classcell__)r s@rrrs # # # # # #                   rrc\ddl}dtjdz} |tjddd\}}na#|j$rT}t |tjt |tjtjdYd}~nd}~wwxYwd}|D]\}}|dkrd}|dkrd}t|dkr/t |tjtjd|d}t||t d dS) NrzDUsage: %s [-n | -t] url -n: open new window -t: open new tabr"ntd)filerz-tr6) getoptrdargverrorprintr|exitlenr) r-usageoptsrQmsgnew_winoar.s rmainr9sAMMM (1+ &E]]38ABB<77 dd < c #### e#*%%%%  G$$1 9 $gg $Y#! 4yyA~ e#*%%%%  q'Cg $KKKKKs+A B%A B  B%__main__rDrO),rPr:r#r8rdrg threadingr __all__ ExceptionrRLockrrrrrrrrrr(objectrAr&r%rvrrrrChromiumrrrrrrrfrrrr9r r rrrAsDEE  J J J     I         #e # # # # #5555D&',D!!!!!&!!!&[8&LLLLL+LLL^k{[[ K     [   2&2&2&2&2& 2&2&2&j,,,,,K,,,l@'@'@'DFUFUFU^<u          <8V////////b#####+###L0 z DFFFFF  r