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
439c467a
Kaydet (Commit)
439c467a
authored
Eki 13, 1998
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Adding the beginnings of a Class browser. Incomplete, yet.
üst
b3418889
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
70 additions
and
0 deletions
+70
-0
ClassBrowser.py
Tools/idle/ClassBrowser.py
+70
-0
No files found.
Tools/idle/ClassBrowser.py
0 → 100644
Dosyayı görüntüle @
439c467a
from
Tkinter
import
*
import
string
import
pyclbr
class
ClassBrowser
:
def
__init__
(
self
,
root
,
name
):
try
:
dict
=
pyclbr
.
readmodule
(
name
)
except
ImportError
,
msg
:
tkMessageBox
.
showerror
(
"Import error"
,
str
(
msg
),
parent
=
root
)
return
if
not
dict
:
tkMessageBox
.
showerror
(
"Nothing to browse"
,
"Module
%
s defines no classes"
%
name
,
parent
=
root
)
return
self
.
root
=
root
self
.
top
=
top
=
Toplevel
(
root
)
# Create help label
self
.
helplabel
=
Label
(
top
,
text
=
"Classes in module
%
s"
%
name
,
borderwidth
=
2
,
relief
=
"groove"
)
self
.
helplabel
.
pack
(
fill
=
"x"
)
# Create top frame, with scrollbar and listbox
self
.
topframe
=
Frame
(
top
)
self
.
topframe
.
pack
(
fill
=
"both"
,
expand
=
1
)
self
.
vbar
=
Scrollbar
(
self
.
topframe
,
name
=
"vbar"
)
self
.
vbar
.
pack
(
side
=
"right"
,
fill
=
"y"
)
self
.
listbox
=
Listbox
(
self
.
topframe
,
exportselection
=
0
,
takefocus
=
1
,
width
=
60
)
self
.
listbox
.
pack
(
expand
=
1
,
fill
=
"both"
)
# Tie listbox and scrollbar together
self
.
vbar
[
"command"
]
=
self
.
listbox
.
yview
self
.
listbox
[
"yscrollcommand"
]
=
self
.
vbar
.
set
# Bind events to the list box
self
.
listbox
.
bind
(
"<ButtonRelease-1>"
,
self
.
click_event
)
self
.
listbox
.
bind
(
"<Double-ButtonRelease-1>"
,
self
.
double_click_event
)
##self.listbox.bind("<ButtonPress-3>", self.popup_event)
self
.
listbox
.
bind
(
"<Key-Up>"
,
self
.
up_event
)
self
.
listbox
.
bind
(
"<Key-Down>"
,
self
.
down_event
)
# Load the classes
self
.
loadclasses
(
dict
)
def
loadclasses
(
self
,
dict
):
items
=
dict
.
items
()
items
.
sort
()
l
=
self
.
listbox
for
key
,
value
in
items
:
s
=
key
if
value
.
super
:
super
=
[]
for
sup
in
value
.
super
:
name
=
sup
.
name
if
sup
.
module
!=
value
.
module
:
name
=
"
%
s.
%
s"
%
(
sup
.
module
,
name
)
super
.
append
(
name
)
s
=
s
+
"(
%
s)"
%
string
.
join
(
super
,
", "
)
l
.
insert
(
END
,
s
)
def
click_event
(
self
,
event
):
pass
def
double_click_event
(
self
,
event
):
pass
def
up_event
(
self
,
event
):
pass
def
down_event
(
self
,
event
):
pass
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