Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
f79cb2db
Kaydet (Commit)
f79cb2db
authored
Ock 23, 2001
tarafından
Eric S. Raymond
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Expose the autoraise capability. Improve the documentation.
üst
aeb5532c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
27 deletions
+29
-27
libwebbrowser.tex
Doc/lib/libwebbrowser.tex
+22
-17
webbrowser.py
Lib/webbrowser.py
+7
-10
No files found.
Doc/lib/libwebbrowser.tex
Dosyayı görüntüle @
f79cb2db
...
@@ -8,7 +8,9 @@
...
@@ -8,7 +8,9 @@
The
\module
{
webbrowser
}
module provides a very high-level interface to
The
\module
{
webbrowser
}
module provides a very high-level interface to
allow displaying Web-based documents to users. The controller objects
allow displaying Web-based documents to users. The controller objects
are easy to use and are platform independent.
are easy to use and are platform-independent. Under most
circumstances, simply calling the
\function
{
open()
}
function from this
module will do the right thing.
Under
\UNIX
, graphical browsers are preferred under X11, but text-mode
Under
\UNIX
, graphical browsers are preferred under X11, but text-mode
browsers will be used if graphical browsers are not available or an X11
browsers will be used if graphical browsers are not available or an X11
...
@@ -16,11 +18,11 @@ display isn't available. If text-mode browsers are used, the calling
...
@@ -16,11 +18,11 @@ display isn't available. If text-mode browsers are used, the calling
process will block until the user exits the browser.
process will block until the user exits the browser.
Under
\UNIX
, if the environment variable
\envvar
{
BROWSER
}
exists, it
Under
\UNIX
, if the environment variable
\envvar
{
BROWSER
}
exists, it
is interpreted to override the platform default
browser
, as a
is interpreted to override the platform default
list of browsers
, as a
colon-separated list of browsers to try in order. When the value of
colon-separated list of browsers to try in order. When the value of
a list part contains the string
\code
{
\%
s
}
, then it is interpreted as
a list part contains the string
\code
{
\%
s
}
, then it is interpreted as
a literal browser command line to be used with the argument URL
a literal browser command line to be used with the argument URL
substituted for the
\code
{
\%
s
}
; if the part does not contain
,
substituted for the
\code
{
\%
s
}
; if the part does not contain
\code
{
\%
s
}
, it is simply interpreted as the name of the browser to
\code
{
\%
s
}
, it is simply interpreted as the name of the browser to
launch.
launch.
...
@@ -37,9 +39,11 @@ The following exception is defined:
...
@@ -37,9 +39,11 @@ The following exception is defined:
The following functions are defined:
The following functions are defined:
\begin{funcdesc}
{
open
}{
url
\optional
{
, new
}}
\begin{funcdesc}
{
open
}{
url
\optional
{
, new
=0
}
\optional
{
, autoraise=1
}}
Display
\var
{
url
}
using the default browser. If
\var
{
new
}
is true,
Display
\var
{
url
}
using the default browser. If
\var
{
new
}
is true,
a new browser window is opened if possible.
a new browser window is opened if possible. If
\var
{
autoraise
}
is
true, the window is raised if possible (note that under many window
managers this will occur regardless of the setting of this variable).
\end{funcdesc}
\end{funcdesc}
\begin{funcdesc}
{
open
_
new
}{
url
}
\begin{funcdesc}
{
open
_
new
}{
url
}
...
@@ -67,19 +71,20 @@ The following functions are defined:
...
@@ -67,19 +71,20 @@ The following functions are defined:
argument matching the name of a handler you declare.
argument matching the name of a handler you declare.
\end{funcdesc}
\end{funcdesc}
Several browser types are defined. This table gives the type names
A number of browser types are predefined. This table gives the type
that may be passed to the
\function
{
get()
}
function and the names of
names that may be passed to the
\function
{
get()
}
function and the
the implementation classes, all defined in this module.
corresponding instantiations for the controller classes, all defined
in this module.
\begin{tableiii}
{
l|l|c
}{
code
}{
Type Name
}{
Class Name
}{
Notes
}
\begin{tableiii}
{
l|l|c
}{
code
}{
Type Name
}{
Class Name
}{
Notes
}
\lineiii
{
'mozilla'
}{
\class
{
Mozilla
}}{}
\lineiii
{
'mozilla'
}{
\class
{
Netscape('mozilla')
}}{}
\lineiii
{
'netscape'
}{
\class
{
Netscape
}}{}
\lineiii
{
'netscape'
}{
\class
{
Netscape
('netscape')
}}{}
\lineiii
{
'mosaic'
}{
\class
{
Mosaic
}}{}
\lineiii
{
'mosaic'
}{
\class
{
GenericBrowser('mosaic
\%
s
&
')
}}{}
\lineiii
{
'kfm'
}{
\class
{
Konquer
er
}}{
(1)
}
\lineiii
{
'kfm'
}{
\class
{
Konquer
or()
}}{
(1)
}
\lineiii
{
'grail'
}{
\class
{
Grail
}}{}
\lineiii
{
'grail'
}{
\class
{
Grail
()
}}{}
\lineiii
{
'links'
}{
\class
{
links
}}{}
\lineiii
{
'links'
}{
\class
{
GenericBrowser('links
\%
s')
}}{}
\lineiii
{
'lynx'
}{
\class
{
Lynx
}}{}
\lineiii
{
'lynx'
}{
\class
{
GenericBrowser('lynx
\%
s')
}}{}
\lineiii
{
'w3m'
}{
\class
{
w3m
}}{}
\lineiii
{
'w3m'
}{
\class
{
GenericBrowser('w3m
\%
s')
}}{}
\lineiii
{
'windows-default'
}{
\class
{
WindowsDefault
}}{
(2)
}
\lineiii
{
'windows-default'
}{
\class
{
WindowsDefault
}}{
(2)
}
\lineiii
{
'internet-config'
}{
\class
{
InternetConfig
}}{
(3)
}
\lineiii
{
'internet-config'
}{
\class
{
InternetConfig
}}{
(3)
}
\end{tableiii}
\end{tableiii}
...
@@ -89,7 +94,7 @@ Notes:
...
@@ -89,7 +94,7 @@ Notes:
\begin{description}
\begin{description}
\item
[(1)]
\item
[(1)]
``Konquer
e
r'' is the file manager for the KDE desktop environment for
``Konquer
o
r'' is the file manager for the KDE desktop environment for
UNIX, and only makes sense to use if KDE is running. Some way of
UNIX, and only makes sense to use if KDE is running. Some way of
reliably detecting KDE would be nice; the
\envvar
{
KDEDIR
}
variable is
reliably detecting KDE would be nice; the
\envvar
{
KDEDIR
}
variable is
not sufficient.
not sufficient.
...
...
Lib/webbrowser.py
Dosyayı görüntüle @
f79cb2db
...
@@ -34,8 +34,8 @@ def get(using=None):
...
@@ -34,8 +34,8 @@ def get(using=None):
# Please note: the following definition hides a builtin function.
# Please note: the following definition hides a builtin function.
def
open
(
url
,
new
=
0
):
def
open
(
url
,
new
=
0
,
autoraise
=
1
):
get
()
.
open
(
url
,
new
)
get
()
.
open
(
url
,
new
,
autoraise
)
def
open_new
(
url
):
# Marked deprecated. May be removed in 2.1.
def
open_new
(
url
):
# Marked deprecated. May be removed in 2.1.
get
()
.
open
(
url
,
1
)
get
()
.
open
(
url
,
1
)
...
@@ -99,13 +99,11 @@ if os.environ.get("TERM") or os.environ.get("DISPLAY"):
...
@@ -99,13 +99,11 @@ if os.environ.get("TERM") or os.environ.get("DISPLAY"):
if
_iscommand
(
"netscape"
)
or
_iscommand
(
"mozilla"
):
if
_iscommand
(
"netscape"
)
or
_iscommand
(
"mozilla"
):
class
Netscape
:
class
Netscape
:
"Launcher class for Netscape browsers."
"Launcher class for Netscape browsers."
autoRaise
=
1
def
__init__
(
self
,
name
):
def
__init__
(
self
,
name
):
self
.
name
=
name
self
.
name
=
name
def
_remote
(
self
,
action
):
def
_remote
(
self
,
action
,
autoraise
):
raise_opt
=
(
"-noraise"
,
"-raise"
)[
self
.
autoR
aise
]
raise_opt
=
(
"-noraise"
,
"-raise"
)[
autor
aise
]
cmd
=
"
%
s
%
s -remote '
%
s' >/dev/null 2>&1"
%
(
self
.
name
,
raise_opt
,
action
)
cmd
=
"
%
s
%
s -remote '
%
s' >/dev/null 2>&1"
%
(
self
.
name
,
raise_opt
,
action
)
rc
=
os
.
system
(
cmd
)
rc
=
os
.
system
(
cmd
)
if
rc
:
if
rc
:
...
@@ -115,11 +113,11 @@ if os.environ.get("TERM") or os.environ.get("DISPLAY"):
...
@@ -115,11 +113,11 @@ if os.environ.get("TERM") or os.environ.get("DISPLAY"):
rc
=
os
.
system
(
cmd
)
rc
=
os
.
system
(
cmd
)
return
not
rc
return
not
rc
def
open
(
self
,
url
,
new
=
0
):
def
open
(
self
,
url
,
new
=
0
,
autoraise
=
1
):
if
new
:
if
new
:
self
.
_remote
(
"openURL(
%
s, new-window)"
%
url
)
self
.
_remote
(
"openURL(
%
s, new-window)"
%
url
,
autoraise
)
else
:
else
:
self
.
_remote
(
"openURL(
%
s)"
%
url
)
self
.
_remote
(
"openURL(
%
s)"
%
url
,
autoraise
)
# Deprecated. May be removed in 2.1.
# Deprecated. May be removed in 2.1.
def
open_new
(
self
,
url
):
def
open_new
(
self
,
url
):
...
@@ -159,7 +157,6 @@ if os.environ.get("TERM") or os.environ.get("DISPLAY"):
...
@@ -159,7 +157,6 @@ if os.environ.get("TERM") or os.environ.get("DISPLAY"):
# Deprecated. May be removed in 2.1.
# Deprecated. May be removed in 2.1.
open_new
=
open
open_new
=
open
register
(
"kfm"
,
Konqueror
,
None
)
register
(
"kfm"
,
Konqueror
,
None
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment