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
03b75dc0
Kaydet (Commit)
03b75dc0
authored
Tem 14, 2001
tarafından
Kurt B. Kaiser
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Remove, was retained for 1.5.2 support
üst
17720095
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
157 deletions
+0
-157
BrowserControl.py
Lib/idlelib/BrowserControl.py
+0
-157
No files found.
Lib/idlelib/BrowserControl.py
deleted
100755 → 0
Dosyayı görüntüle @
17720095
"""Remote-control interfaces to some browsers."""
import
os
import
string
import
sys
DEFAULT_CONFIG_FILE
=
"~/.browser.ini"
PROCESS_CREATION_DELAY
=
4
DEFAULT_BROWSER
=
"netscape"
_browsers
=
{}
def
get
(
name
=
None
):
if
name
is
None
:
name
=
get_default_browser
()
else
:
name
=
string
.
lower
(
name
)
L
=
_browsers
[
name
]
if
L
[
1
]
is
None
:
L
[
1
]
=
L
[
0
]()
return
L
[
1
]
def
get_default_browser
(
file
=
None
):
if
file
is
None
:
files
=
[
DEFAULT_CONFIG_FILE
]
else
:
files
=
[
file
,
DEFAULT_CONFIG_FILE
]
for
file
in
files
:
file
=
os
.
path
.
expandvars
(
os
.
path
.
expanduser
(
file
))
if
file
and
os
.
path
.
isfile
(
file
):
import
ConfigParser
cf
=
ConfigParser
.
ConfigParser
()
cf
.
read
([
file
])
try
:
return
string
.
lower
(
cf
.
get
(
"Browser"
,
"name"
))
except
ConfigParser
.
Error
:
pass
return
DEFAULT_BROWSER
_default_browser
=
None
def
_get_browser
():
global
_default_browser
if
_default_browser
is
None
:
_default_browser
=
get
()
return
_default_browser
def
open
(
url
,
new
=
0
):
_get_browser
()
.
open
(
url
,
new
)
def
open_new
(
url
):
_get_browser
()
.
open_new
(
url
)
def
register
(
name
,
klass
):
_browsers
[
string
.
lower
(
name
)]
=
[
klass
,
None
]
class
Netscape
:
autoRaise
=
0
def
_remote
(
self
,
action
):
raise_opt
=
(
"-noraise"
,
"-raise"
)[
self
.
autoRaise
]
cmd
=
"netscape
%
s -remote '
%
s' >/dev/null 2>&1"
%
(
raise_opt
,
action
)
rc
=
os
.
system
(
cmd
)
if
rc
:
import
time
os
.
system
(
"netscape -no-about-splash &"
)
time
.
sleep
(
PROCESS_CREATION_DELAY
)
rc
=
os
.
system
(
cmd
)
return
not
rc
def
open
(
self
,
url
,
new
=
0
):
if
new
:
self
.
open_new
(
url
)
else
:
self
.
_remote
(
"openURL(
%
s)"
%
url
)
def
open_new
(
self
,
url
):
self
.
_remote
(
"openURL(
%
s, new-window)"
%
url
)
register
(
"netscape"
,
Netscape
)
class
Grail
:
# There should be a way to maintain a connection to Grail, but the
# Grail remote control protocol doesn't really allow that at this
# point. It probably never will!
def
_find_grail_rc
(
self
):
import
glob
import
pwd
import
socket
import
tempfile
tempdir
=
os
.
path
.
join
(
tempfile
.
gettempdir
(),
".grail-unix"
)
user
=
pwd
.
getpwuid
(
_os
.
getuid
())[
0
]
filename
=
os
.
path
.
join
(
tempdir
,
user
+
"-*"
)
maybes
=
glob
.
glob
(
filename
)
if
not
maybes
:
return
None
s
=
socket
.
socket
(
socket
.
AF_UNIX
,
socket
.
SOCK_STREAM
)
for
fn
in
maybes
:
# need to PING each one until we find one that's live
try
:
s
.
connect
(
fn
)
except
socket
.
error
:
# no good; attempt to clean it out, but don't fail:
try
:
os
.
unlink
(
fn
)
except
IOError
:
pass
else
:
return
s
def
_remote
(
self
,
action
):
s
=
self
.
_find_grail_rc
()
if
not
s
:
return
0
s
.
send
(
action
)
s
.
close
()
return
1
def
open
(
self
,
url
,
new
=
0
):
if
new
:
self
.
open_new
(
url
)
else
:
self
.
_remote
(
"LOAD "
+
url
)
def
open_new
(
self
,
url
):
self
.
_remote
(
"LOADNEW "
+
url
)
register
(
"grail"
,
Grail
)
class
WindowsDefault
:
def
open
(
self
,
url
,
new
=
0
):
import
win32api
,
win32con
try
:
win32api
.
ShellExecute
(
0
,
"open"
,
url
,
None
,
"."
,
win32con
.
SW_SHOWNORMAL
)
except
:
traceback
.
print_exc
()
raise
def
open_new
(
self
,
url
):
self
.
open
(
url
)
if
sys
.
platform
[:
3
]
==
"win"
:
register
(
"windows-default"
,
WindowsDefault
)
DEFAULT_BROWSER
=
"windows-default"
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