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
39186bcd
Kaydet (Commit)
39186bcd
authored
Tem 23, 2009
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
use bools for autoraise
üst
beca4995
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
11 deletions
+11
-11
webbrowser.py
Lib/webbrowser.py
+11
-11
No files found.
Lib/webbrowser.py
Dosyayı görüntüle @
39186bcd
...
@@ -55,7 +55,7 @@ def get(using=None):
...
@@ -55,7 +55,7 @@ def get(using=None):
# It is recommended one does "import webbrowser" and uses webbrowser.open(url)
# It is recommended one does "import webbrowser" and uses webbrowser.open(url)
# instead of "from webbrowser import *".
# instead of "from webbrowser import *".
def
open
(
url
,
new
=
0
,
autoraise
=
1
):
def
open
(
url
,
new
=
0
,
autoraise
=
True
):
for
name
in
_tryorder
:
for
name
in
_tryorder
:
browser
=
get
(
name
)
browser
=
get
(
name
)
if
browser
.
open
(
url
,
new
,
autoraise
):
if
browser
.
open
(
url
,
new
,
autoraise
):
...
@@ -144,7 +144,7 @@ class BaseBrowser(object):
...
@@ -144,7 +144,7 @@ class BaseBrowser(object):
self
.
name
=
name
self
.
name
=
name
self
.
basename
=
name
self
.
basename
=
name
def
open
(
self
,
url
,
new
=
0
,
autoraise
=
1
):
def
open
(
self
,
url
,
new
=
0
,
autoraise
=
True
):
raise
NotImplementedError
raise
NotImplementedError
def
open_new
(
self
,
url
):
def
open_new
(
self
,
url
):
...
@@ -168,7 +168,7 @@ class GenericBrowser(BaseBrowser):
...
@@ -168,7 +168,7 @@ class GenericBrowser(BaseBrowser):
self
.
args
=
name
[
1
:]
self
.
args
=
name
[
1
:]
self
.
basename
=
os
.
path
.
basename
(
self
.
name
)
self
.
basename
=
os
.
path
.
basename
(
self
.
name
)
def
open
(
self
,
url
,
new
=
0
,
autoraise
=
1
):
def
open
(
self
,
url
,
new
=
0
,
autoraise
=
True
):
cmdline
=
[
self
.
name
]
+
[
arg
.
replace
(
"
%
s"
,
url
)
cmdline
=
[
self
.
name
]
+
[
arg
.
replace
(
"
%
s"
,
url
)
for
arg
in
self
.
args
]
for
arg
in
self
.
args
]
try
:
try
:
...
@@ -185,7 +185,7 @@ class BackgroundBrowser(GenericBrowser):
...
@@ -185,7 +185,7 @@ class BackgroundBrowser(GenericBrowser):
"""Class for all browsers which are to be started in the
"""Class for all browsers which are to be started in the
background."""
background."""
def
open
(
self
,
url
,
new
=
0
,
autoraise
=
1
):
def
open
(
self
,
url
,
new
=
0
,
autoraise
=
True
):
cmdline
=
[
self
.
name
]
+
[
arg
.
replace
(
"
%
s"
,
url
)
cmdline
=
[
self
.
name
]
+
[
arg
.
replace
(
"
%
s"
,
url
)
for
arg
in
self
.
args
]
for
arg
in
self
.
args
]
try
:
try
:
...
@@ -216,7 +216,7 @@ class UnixBrowser(BaseBrowser):
...
@@ -216,7 +216,7 @@ class UnixBrowser(BaseBrowser):
raise_opt
=
[]
raise_opt
=
[]
if
remote
and
self
.
raise_opts
:
if
remote
and
self
.
raise_opts
:
# use autoraise argument only for remote invocation
# use autoraise argument only for remote invocation
autoraise
=
int
(
bool
(
autoraise
)
)
autoraise
=
int
(
autoraise
)
opt
=
self
.
raise_opts
[
autoraise
]
opt
=
self
.
raise_opts
[
autoraise
]
if
opt
:
raise_opt
=
[
opt
]
if
opt
:
raise_opt
=
[
opt
]
...
@@ -256,7 +256,7 @@ class UnixBrowser(BaseBrowser):
...
@@ -256,7 +256,7 @@ class UnixBrowser(BaseBrowser):
else
:
else
:
return
not
p
.
wait
()
return
not
p
.
wait
()
def
open
(
self
,
url
,
new
=
0
,
autoraise
=
1
):
def
open
(
self
,
url
,
new
=
0
,
autoraise
=
True
):
if
new
==
0
:
if
new
==
0
:
action
=
self
.
remote_action
action
=
self
.
remote_action
elif
new
==
1
:
elif
new
==
1
:
...
@@ -340,7 +340,7 @@ class Konqueror(BaseBrowser):
...
@@ -340,7 +340,7 @@ class Konqueror(BaseBrowser):
for more information on the Konqueror remote-control interface.
for more information on the Konqueror remote-control interface.
"""
"""
def
open
(
self
,
url
,
new
=
0
,
autoraise
=
1
):
def
open
(
self
,
url
,
new
=
0
,
autoraise
=
True
):
# XXX Currently I know no way to prevent KFM from opening a new win.
# XXX Currently I know no way to prevent KFM from opening a new win.
if
new
==
2
:
if
new
==
2
:
action
=
"newTab"
action
=
"newTab"
...
@@ -428,7 +428,7 @@ class Grail(BaseBrowser):
...
@@ -428,7 +428,7 @@ class Grail(BaseBrowser):
s
.
close
()
s
.
close
()
return
1
return
1
def
open
(
self
,
url
,
new
=
0
,
autoraise
=
1
):
def
open
(
self
,
url
,
new
=
0
,
autoraise
=
True
):
if
new
:
if
new
:
ok
=
self
.
_remote
(
"LOADNEW "
+
url
)
ok
=
self
.
_remote
(
"LOADNEW "
+
url
)
else
:
else
:
...
@@ -511,7 +511,7 @@ if os.environ.get("TERM"):
...
@@ -511,7 +511,7 @@ if os.environ.get("TERM"):
if
sys
.
platform
[:
3
]
==
"win"
:
if
sys
.
platform
[:
3
]
==
"win"
:
class
WindowsDefault
(
BaseBrowser
):
class
WindowsDefault
(
BaseBrowser
):
def
open
(
self
,
url
,
new
=
0
,
autoraise
=
1
):
def
open
(
self
,
url
,
new
=
0
,
autoraise
=
True
):
try
:
try
:
os
.
startfile
(
url
)
os
.
startfile
(
url
)
except
WindowsError
:
except
WindowsError
:
...
@@ -545,7 +545,7 @@ except ImportError:
...
@@ -545,7 +545,7 @@ except ImportError:
pass
pass
else
:
else
:
class
InternetConfig
(
BaseBrowser
):
class
InternetConfig
(
BaseBrowser
):
def
open
(
self
,
url
,
new
=
0
,
autoraise
=
1
):
def
open
(
self
,
url
,
new
=
0
,
autoraise
=
True
):
ic
.
launchurl
(
url
)
ic
.
launchurl
(
url
)
return
True
# Any way to get status?
return
True
# Any way to get status?
...
@@ -566,7 +566,7 @@ if sys.platform == 'darwin':
...
@@ -566,7 +566,7 @@ if sys.platform == 'darwin':
def
__init__
(
self
,
name
):
def
__init__
(
self
,
name
):
self
.
name
=
name
self
.
name
=
name
def
open
(
self
,
url
,
new
=
0
,
autoraise
=
1
):
def
open
(
self
,
url
,
new
=
0
,
autoraise
=
True
):
assert
"'"
not
in
url
assert
"'"
not
in
url
# hack for local urls
# hack for local urls
if
not
':'
in
url
:
if
not
':'
in
url
:
...
...
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