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
cee949f9
Kaydet (Commit)
cee949f9
authored
Ara 03, 2001
tarafından
Just van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Removed old and broken AE-based browser controller, use webbrowser.py
instead. This fixes bug #488420.
üst
551ffae3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
31 deletions
+11
-31
PyDocSearch.py
Mac/Tools/IDE/PyDocSearch.py
+11
-31
No files found.
Mac/Tools/IDE/PyDocSearch.py
Dosyayı görüntüle @
cee949f9
import
aetools
import
Standard_Suite
import
Required_Suite
import
WWW_Suite
import
re
import
W
import
macfs
...
...
@@ -9,33 +5,18 @@ import os
import
MacPrefs
import
MacOS
import
string
import
webbrowser
if
hasattr
(
WWW_Suite
,
"WWW_Suite"
):
WWW
=
WWW_Suite
.
WWW_Suite
else
:
WWW
=
WWW_Suite
.
WorldWideWeb_suite_2c__as_defined_in_Spyglass_spec_2e_
class
WebBrowser
(
aetools
.
TalkTo
,
Standard_Suite
.
Standard_Suite
,
WWW
):
def
openfile
(
self
,
path
,
activate
=
1
):
if
activate
:
self
.
activate
()
self
.
OpenURL
(
"file:///"
+
string
.
join
(
string
.
split
(
path
,
':'
),
'/'
))
app
=
W
.
getapplication
()
#SIGNATURE='MSIE' # MS Explorer
SIGNATURE
=
'MOSS'
# Netscape
_titlepat
=
re
.
compile
(
'<title>
\
([^<]*
\
)</title>'
)
def
sucktitle
(
path
):
f
=
open
(
path
)
text
=
f
.
read
(
1024
)
# assume the title is in the first 1024 bytes
f
.
close
()
lowertext
=
string
.
lower
(
text
)
lowertext
=
text
.
lower
(
)
matcher
=
_titlepat
.
search
(
lowertext
)
if
matcher
:
return
matcher
.
group
(
1
)
...
...
@@ -84,25 +65,25 @@ class Results:
map
(
lambda
(
c
,
p
):
"
%
s (
%
d)"
%
(
p
,
c
),
hits
),
', '
),
hits
)
nicehits
.
sort
()
self
.
w
=
W
.
Window
((
440
,
300
),
"Search results
%
d"
%
_resultscounter
,
minsize
=
(
200
,
100
))
self
.
w
.
results
=
TwoLineList
((
-
1
,
-
1
,
1
,
-
14
),
nicehits
,
self
.
listhit
)
self
.
w
.
results
=
W
.
TwoLineList
((
-
1
,
-
1
,
1
,
-
14
),
nicehits
,
self
.
listhit
)
self
.
w
.
open
()
self
.
w
.
bind
(
'return'
,
self
.
listhit
)
self
.
w
.
bind
(
'enter'
,
self
.
listhit
)
_resultscounter
=
_resultscounter
+
1
self
.
browser
=
None
def
listhit
(
self
,
isdbl
=
1
):
if
isdbl
:
for
i
in
self
.
w
.
results
.
getselection
():
if
self
.
browser
is
None
:
self
.
browser
=
WebBrowser
(
SIGNATURE
,
start
=
1
)
self
.
browser
.
openfile
(
self
.
hits
[
i
][
1
])
path
=
self
.
hits
[
i
][
1
]
url
=
"file://"
+
"/"
.
join
(
path
.
split
(
":"
))
webbrowser
.
open
(
url
)
class
Status
:
def
__init__
(
self
):
self
.
w
=
W
.
Dialog
((
440
,
64
),
"Searching
\xc9
"
)
self
.
w
.
searching
=
W
.
TextBox
((
4
,
4
,
-
4
,
16
),
"
DevDev:PyPyDoc 1.5.1:ext:parseTupleAndKeywords.html
"
)
self
.
w
.
searching
=
W
.
TextBox
((
4
,
4
,
-
4
,
16
),
""
)
self
.
w
.
hits
=
W
.
TextBox
((
4
,
24
,
-
4
,
16
),
"Hits: 0"
)
self
.
w
.
canceltip
=
W
.
TextBox
((
4
,
44
,
-
4
,
16
),
"Type cmd-period (.) to cancel."
)
self
.
w
.
open
()
...
...
@@ -131,6 +112,7 @@ def match(text, patterns, all):
hits
.
reverse
()
return
hits
def
dosearch
(
docpath
,
searchstring
,
settings
):
(
docpath
,
kind
,
case
,
word
,
tut
,
lib
,
ref
,
ext
,
api
)
=
settings
books
=
[(
tut
,
'tut'
),
(
lib
,
'lib'
),
(
ref
,
'ref'
),
(
ext
,
'ext'
),
(
api
,
'api'
)]
...
...
@@ -219,7 +201,7 @@ class PyDocSearch:
self
.
w
.
extending
=
W
.
CheckBox
((
bookstart
,
98
,
-
10
,
16
),
"Extending & embedding"
)
self
.
w
.
api
=
W
.
CheckBox
((
bookstart
,
118
,
-
10
,
16
),
"C/C++ API"
)
self
.
w
.
setdocfolderbutton
=
W
.
Button
((
10
,
-
30
,
8
0
,
16
),
"Set doc folder"
,
self
.
setdocpath
)
self
.
w
.
setdocfolderbutton
=
W
.
Button
((
10
,
-
30
,
10
0
,
16
),
"Set doc folder"
,
self
.
setdocpath
)
if
docpath
:
self
.
w
.
setdefaultbutton
(
self
.
w
.
searchbutton
)
...
...
@@ -229,7 +211,7 @@ class PyDocSearch:
self
.
docpath
=
docpath
if
not
docpath
:
docpath
=
"(please select the Python html documentation folder)"
self
.
w
.
docfolder
=
W
.
TextBox
((
1
0
0
,
-
28
,
-
10
,
16
),
docpath
)
self
.
w
.
docfolder
=
W
.
TextBox
((
1
2
0
,
-
28
,
-
10
,
16
),
docpath
)
[
self
.
w
.
phraseradio
,
self
.
w
.
allwordsradio
,
self
.
w
.
anywordsradio
][
kind
]
.
set
(
1
)
...
...
@@ -252,8 +234,6 @@ class PyDocSearch:
Results
(
hits
)
elif
hasattr
(
MacOS
,
'SysBeep'
):
MacOS
.
SysBeep
(
0
)
#import PyBrowser
#PyBrowser.Browser(hits)
def
setdocpath
(
self
):
fss
,
ok
=
macfs
.
GetDirectory
()
...
...
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