| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 76390de commit e8f2443
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,9 +6,8 @@ \section{\module{webbrowser} --- | |||
| 6 | 6 | \moduleauthor{Fred L. Drake, Jr.}{fdrake@acm.org} | |
| 7 | 7 | \sectionauthor{Fred L. Drake, Jr.}{fdrake@acm.org} | |
| 8 | 8 | ||
| 9 | - The \module{webbrowser} module provides a very high-level interface to | ||
| 10 | - allow displaying Web-based documents to users. The controller objects | ||
| 11 | - are easy to use and are platform-independent. Under most | ||
| 9 | + The \module{webbrowser} module provides a high-level interface to | ||
| 10 | + allow displaying Web-based documents to users. Under most | ||
| 12 | 11 | circumstances, simply calling the \function{open()} function from this | |
| 13 | 12 | module will do the right thing. | |
| 14 | 13 | ||
@@ -17,19 +16,26 @@ \section{\module{webbrowser} --- | |||
| 17 | 16 | display isn't available. If text-mode browsers are used, the calling | |
| 18 | 17 | process will block until the user exits the browser. | |
| 19 | 18 | ||
| 20 | - Under \UNIX, if the environment variable \envvar{BROWSER} exists, it | ||
| 19 | + If the environment variable \envvar{BROWSER} exists, it | ||
| 21 | 20 | is interpreted to override the platform default list of browsers, as a | |
| 22 | - colon-separated list of browsers to try in order. When the value of | ||
| 21 | + os.pathsep-separated list of browsers to try in order. When the value of | ||
| 23 | 22 | a list part contains the string \code{\%s}, then it is interpreted as | |
| 24 | 23 | a literal browser command line to be used with the argument URL | |
| 25 | 24 | substituted for the \code{\%s}; if the part does not contain | |
| 26 | 25 | \code{\%s}, it is simply interpreted as the name of the browser to | |
| 27 | 26 | launch. | |
| 28 | 27 | ||
| 29 | - For non-\UNIX{} platforms, or when X11 browsers are available on | ||
| 28 | + For non-\UNIX{} platforms, or when a remote browser is available on | ||
| 30 | 29 | \UNIX, the controlling process will not wait for the user to finish | |
| 31 | - with the browser, but allow the browser to maintain its own window on | ||
| 32 | - the display. | ||
| 30 | + with the browser, but allow the remote browser to maintain its own | ||
| 31 | + windows on the display. If remote browsers are not available on \UNIX, | ||
| 32 | + the controlling process will launch a new browser and wait. | ||
| 33 | + | ||
| 34 | + The script \program{webbrowser} can be used as a command-line interface | ||
| 35 | + for the module. It accepts an URL as the argument. It accepts the following | ||
| 36 | + optional parameters: \programopt{-n} opens the URL in a new browser window, | ||
| 37 | + if possible; \programopt{-t} opens the URL in a new browser page ("tab"). The | ||
| 38 | + options are, naturally, mutually exclusive. | ||
| 33 | 39 | ||
| 34 | 40 | The following exception is defined: | |
| 35 | 41 | ||
@@ -40,15 +46,24 @@ \section{\module{webbrowser} --- | |||
| 40 | 46 | The following functions are defined: | |
| 41 | 47 | ||
| 42 | 48 | \begin{funcdesc}{open}{url\optional{, new=0}\optional{, autoraise=1}} | |
| 43 | - Display \var{url} using the default browser. If \var{new} is true, | ||
| 44 | - a new browser window is opened if possible. If \var{autoraise} is | ||
| 49 | + Display \var{url} using the default browser. If \var{new} is 0, the | ||
| 50 | + \var{url} is opened in the same browser window. If \var{new} is 1, | ||
| 51 | + a new browser window is opened if possible. If \var{new} is 2, | ||
| 52 | + a new browser page ("tab") is opened if possible. If \var{autoraise} is | ||
| 45 | 53 | true, the window is raised if possible (note that under many window | |
| 46 | 54 | managers this will occur regardless of the setting of this variable). | |
| 55 | + | ||
| 47 | 56 | \end{funcdesc} | |
| 48 | 57 | ||
| 49 | - \begin{funcdesc}{open_new}{url} | ||
| 58 | + \begin{funcdesc}{open_new_win}{url} | ||
| 50 | 59 | Open \var{url} in a new window of the default browser, if possible, | |
| 51 | - otherwise, open \var{url} in the only browser window. | ||
| 60 | + otherwise, open \var{url} in the only browser window. Alias | ||
| 61 | + \function{open_new}. | ||
| 62 | + \end{funcdesc} | ||
| 63 | + | ||
| 64 | + \begin{funcdesc}{open_new_tab}{url} | ||
| 65 | + Open \var{url} in a new page ("tab") of the default browser, if possible, | ||
| 66 | + otherwise equivalent to \function{open_new_win}. | ||
| 52 | 67 | \end{funcdesc} | |
| 53 | 68 | ||
| 54 | 69 | \begin{funcdesc}{get}{\optional{name}} | |
@@ -67,7 +82,7 @@ \section{\module{webbrowser} --- | |||
| 67 | 82 | ||
| 68 | 83 | This entry point is only useful if you plan to either set the | |
| 69 | 84 | \envvar{BROWSER} variable or call \function{get} with a nonempty | |
| 70 | - argument matching the name of a handler you declare. | ||
| 85 | + argument matching the name of a handler you declare. | ||
| 71 | 86 | \end{funcdesc} | |
| 72 | 87 | ||
| 73 | 88 | A number of browser types are predefined. This table gives the type | |
@@ -76,16 +91,24 @@ \section{\module{webbrowser} --- | |||
| 76 | 91 | in this module. | |
| 77 | 92 | ||
| 78 | 93 | \begin{tableiii}{l|l|c}{code}{Type Name}{Class Name}{Notes} | |
| 79 | - \lineiii{'mozilla'}{\class{Netscape('mozilla')}}{} | ||
| 80 | - \lineiii{'netscape'}{\class{Netscape('netscape')}}{} | ||
| 81 | - \lineiii{'mosaic'}{\class{GenericBrowser('mosaic \%s \&')}}{} | ||
| 94 | + \lineiii{'mozilla'}{\class{Mozilla('mozilla')}}{} | ||
| 95 | + \lineiii{'firefox'}{\class{Mozilla('mozilla')}}{} | ||
| 96 | + \lineiii{'netscape'}{\class{Mozilla('netscape')}}{} | ||
| 97 | + \lineiii{'galeon'}{\class{Galeon('galeon')}}{} | ||
| 98 | + \lineiii{'epiphany'}{\class{Galeon('epiphany')}}{} | ||
| 99 | + \lineiii{'skipstone'}{\class{GenericBrowser('skipstone \%s \&')}}{} | ||
| 100 | + \lineiii{'konqueror'}{\class{Konqueror()}}{(1)} | ||
| 82 | 101 | \lineiii{'kfm'}{\class{Konqueror()}}{(1)} | |
| 102 | + \lineiii{'mosaic'}{\class{GenericBrowser('mosaic \%s \&')}}{} | ||
| 103 | + \lineiii{'opera'}{\class{Opera()}}{} | ||
| 83 | 104 | \lineiii{'grail'}{\class{Grail()}}{} | |
| 84 | 105 | \lineiii{'links'}{\class{GenericBrowser('links \%s')}}{} | |
| 106 | + \lineiii{'elinks'}{\class{Elinks('elinks')}}{} | ||
| 85 | 107 | \lineiii{'lynx'}{\class{GenericBrowser('lynx \%s')}}{} | |
| 86 | 108 | \lineiii{'w3m'}{\class{GenericBrowser('w3m \%s')}}{} | |
| 87 | 109 | \lineiii{'windows-default'}{\class{WindowsDefault}}{(2)} | |
| 88 | 110 | \lineiii{'internet-config'}{\class{InternetConfig}}{(3)} | |
| 111 | + \lineiii{'macosx'}{\class{MacOSX('default')}}{(4)} | ||
| 89 | 112 | \end{tableiii} | |
| 90 | 113 | ||
| 91 | 114 | \noindent | |
@@ -101,13 +124,15 @@ \section{\module{webbrowser} --- | |||
| 101 | 124 | implementation selects the best strategy for running Konqueror. | |
| 102 | 125 | ||
| 103 | 126 | \item[(2)] | |
| 104 | - Only on Windows platforms; requires the common | ||
| 105 | - extension modules \module{win32api} and \module{win32con}. | ||
| 127 | + Only on Windows platforms. | ||
| 106 | 128 | ||
| 107 | 129 | \item[(3)] | |
| 108 | 130 | Only on MacOS platforms; requires the standard MacPython \module{ic} | |
| 109 | 131 | module, described in the \citetitle[../mac/module-ic.html]{Macintosh | |
| 110 | 132 | Library Modules} manual. | |
| 133 | + | ||
| 134 | + \item[(4)] | ||
| 135 | + Only on MacOS X platform. | ||
| 111 | 136 | \end{description} | |
| 112 | 137 | ||
| 113 | 138 | ||
@@ -117,12 +142,18 @@ \subsection{Browser Controller Objects \label{browser-controllers}} | |||
| 117 | 142 | module-level convenience functions: | |
| 118 | 143 | ||
| 119 | 144 | \begin{funcdesc}{open}{url\optional{, new}} | |
| 120 | - Display \var{url} using the browser handled by this controller. If | ||
| 121 | - \var{new} is true, a new browser window is opened if possible. | ||
| 145 | + Display \var{url} using the browser handled by this controller. | ||
| 146 | + If \var{new} is 1, a new browser window is opened if possible. | ||
| 147 | + If \var{new} is 2, a new browser page ("tab") is opened if possible. | ||
| 122 | 148 | \end{funcdesc} | |
| 123 | 149 | ||
| 124 | - \begin{funcdesc}{open_new}{url} | ||
| 150 | + \begin{funcdesc}{open_new_win}{url} | ||
| 125 | 151 | Open \var{url} in a new window of the browser handled by this | |
| 126 | 152 | controller, if possible, otherwise, open \var{url} in the only | |
| 127 | - browser window. | ||
| 153 | + browser window. Alias \function{open_new}. | ||
| 154 | + \end{funcdesc} | ||
| 155 | + | ||
| 156 | + \begin{funcdesc}{open_new_tab}{url} | ||
| 157 | + Open \var{url} in a new page ("tab") of the browser handled by this | ||
| 158 | + controller, if possible, otherwise equivalent to \function{open_new_win}. | ||
| 128 | 159 | \end{funcdesc} | |
| Back | FazBrowse Home | New Git URL |
0 commit comments