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
36ea0e76
Kaydet (Commit)
36ea0e76
authored
Tem 11, 1994
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add menu to change directories -- also generalize acceptable names from *.n
into *.[ln123456789]
üst
0f650f41
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
16 deletions
+40
-16
tkman.py
Demo/tkinter/guido/tkman.py
+40
-16
No files found.
Demo/tkinter/guido/tkman.py
Dosyayı görüntüle @
36ea0e76
...
...
@@ -9,13 +9,14 @@ import regex
from
Tkinter
import
*
from
ManPage
import
ManPage
MANDIR
=
'/usr/local/man/mann'
MANNDIR
=
'/usr/local/man/mann'
MAN3DIR
=
'/usr/local/man/man3'
def
listmanpages
(
mandir
=
MANDIR
):
def
listmanpages
(
mandir
):
files
=
os
.
listdir
(
mandir
)
names
=
[]
for
file
in
files
:
if
file
[
-
2
:
]
==
'.n'
:
if
file
[
-
2
:
-
1
]
==
'.'
and
(
file
[
-
1
]
in
'ln123456789'
)
:
names
.
append
(
file
[:
-
2
])
names
.
sort
()
return
names
...
...
@@ -30,23 +31,39 @@ class SelectionBox:
self
.
master
=
self
.
frame
.
master
self
.
subframe
=
Frame
(
self
.
frame
,
{
Pack
:
{
'expand'
:
0
,
'fill'
:
'both'
}})
self
.
listbox
=
Listbox
(
self
.
subframe
,
{
'relief'
:
'sunken'
,
'bd'
:
2
,
'geometry'
:
'20x6'
,
Pack
:
{
'side'
:
'right'
,
'expand'
:
1
,
'fill'
:
'both'
}})
self
.
subsubframe
=
Frame
(
self
.
subframe
,
{
self
.
leftsubframe
=
Frame
(
self
.
subframe
,
{
Pack
:
{
'side'
:
'left'
,
'expand'
:
1
,
'fill'
:
'both'
}})
self
.
l1
=
Button
(
self
.
subsubframe
,
self
.
rightsubframe
=
Frame
(
self
.
subframe
,
{
Pack
:
{
'side'
:
'right'
,
'expand'
:
1
,
'fill'
:
'both'
}})
self
.
chaptervar
=
StringVar
(
master
)
self
.
chapter
=
Menubutton
(
self
.
rightsubframe
,
{
'text'
:
'Directory'
,
'relief'
:
'raised'
,
'bd'
:
2
,
Pack
:
{
'side'
:
'top'
}})
self
.
chaptermenu
=
Menu
(
self
.
chapter
)
self
.
chaptermenu
.
add_radiobutton
({
'label'
:
'C functions'
,
'value'
:
MAN3DIR
,
'variable'
:
self
.
chaptervar
,
'command'
:
self
.
newchapter
})
self
.
chaptermenu
.
add_radiobutton
({
'label'
:
'Tcl/Tk functions'
,
'value'
:
MANNDIR
,
'variable'
:
self
.
chaptervar
,
'command'
:
self
.
newchapter
})
self
.
chapter
[
'menu'
]
=
self
.
chaptermenu
self
.
listbox
=
Listbox
(
self
.
rightsubframe
,
{
'relief'
:
'sunken'
,
'bd'
:
2
,
'geometry'
:
'20x5'
,
Pack
:
{
'expand'
:
1
,
'fill'
:
'both'
}})
self
.
l1
=
Button
(
self
.
leftsubframe
,
{
'text'
:
'Display manual page named:'
,
'command'
:
self
.
entry_cb
,
Pack
:
{
'side'
:
'top'
}})
self
.
entry
=
Entry
(
self
.
sub
subframe
,
self
.
entry
=
Entry
(
self
.
left
subframe
,
{
'relief'
:
'sunken'
,
'bd'
:
2
,
'width'
:
20
,
Pack
:
{
'side'
:
'top'
,
'expand'
:
0
,
'fill'
:
'x'
}})
self
.
l2frame
=
Frame
(
self
.
sub
subframe
,
{
self
.
l2frame
=
Frame
(
self
.
left
subframe
,
{
Pack
:
{
'expand'
:
0
,
'fill'
:
'none'
}})
self
.
l2
=
Button
(
self
.
l2frame
,
{
'text'
:
'Search regexp:'
,
...
...
@@ -57,12 +74,12 @@ class SelectionBox:
'variable'
:
'casesense'
,
'relief'
:
'flat'
,
Pack
:
{
'side'
:
'left'
}})
self
.
search
=
Entry
(
self
.
sub
subframe
,
self
.
search
=
Entry
(
self
.
left
subframe
,
{
'relief'
:
'sunken'
,
'bd'
:
2
,
'width'
:
20
,
Pack
:
{
'side'
:
'top'
,
'expand'
:
0
,
'fill'
:
'x'
}})
self
.
title
=
Label
(
self
.
sub
subframe
,
self
.
title
=
Label
(
self
.
left
subframe
,
{
'text'
:
'(none)'
,
Pack
:
{
'side'
:
'bottom'
}})
self
.
text
=
ManPage
(
self
.
frame
,
...
...
@@ -80,6 +97,14 @@ class SelectionBox:
self
.
entry
.
focus_set
()
self
.
chaptervar
.
set
(
MANNDIR
)
self
.
newchapter
()
def
newchapter
(
self
):
mandir
=
self
.
chaptervar
.
get
()
self
.
choices
=
[]
self
.
addlist
(
listmanpages
(
mandir
))
def
addchoice
(
self
,
choice
):
if
choice
not
in
self
.
choices
:
self
.
choices
.
append
(
choice
)
...
...
@@ -135,7 +160,7 @@ class SelectionBox:
self
.
updatelist
()
def
show_page
(
self
,
name
):
file
=
'
%
s/
%
s.
n'
%
(
MANDIR
,
name
)
file
=
'
%
s/
%
s.
?'
%
(
self
.
chaptervar
.
get
()
,
name
)
fp
=
os
.
popen
(
'nroff -man
%
s | ul -i'
%
file
,
'r'
)
self
.
text
.
kill
()
self
.
title
[
'text'
]
=
name
...
...
@@ -192,7 +217,6 @@ class SelectionBox:
def
main
():
root
=
Tk
()
sb
=
SelectionBox
(
root
)
sb
.
addlist
(
listmanpages
())
if
sys
.
argv
[
1
:]:
sb
.
show_page
(
sys
.
argv
[
1
])
root
.
minsize
(
1
,
1
)
...
...
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