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
7045dd04
Kaydet (Commit)
7045dd04
authored
Agu 16, 1991
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Initial revision
üst
784ca6c8
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
285 additions
and
0 deletions
+285
-0
importall.py
Lib/importall.py
+35
-0
mainloop.py
Lib/lib-stdwin/mainloop.py
+72
-0
stdwinq.py
Lib/lib-stdwin/stdwinq.py
+53
-0
mainloop.py
Lib/stdwin/mainloop.py
+72
-0
stdwinq.py
Lib/stdwin/stdwinq.py
+53
-0
No files found.
Lib/importall.py
0 → 100755
Dosyayı görüntüle @
7045dd04
# Utility module to import all modules in the path, in the hope
# that this will update their ".pyc" files.
# First, see if this is the Mac or UNIX
try
:
import
posix
os
=
posix
import
path
except
NameError
:
import
mac
os
=
mac
import
macpath
path
=
macpath
import
sys
exceptions
=
[
'importall'
]
for
dir
in
sys
.
path
:
print
'Listing'
,
dir
try
:
names
=
os
.
listdir
(
dir
)
except
os
.
error
:
print
'Can
\'
t list'
,
dir
names
=
[]
names
.
sort
()
for
name
in
names
:
head
,
tail
=
name
[:
-
3
],
name
[
-
3
:]
if
tail
=
'.py'
and
head
not
in
exceptions
:
s
=
'import '
+
head
print
s
try
:
exec
(
s
+
'
\n
'
)
except
:
print
'Sorry:'
,
sys
.
exc_type
,
sys
.
exc_value
Lib/lib-stdwin/mainloop.py
0 → 100644
Dosyayı görüntüle @
7045dd04
# Standard main loop for *all* STDWIN applications.
# This requires that applications:
# - register their windows on creation and unregister them when closed
# - have a 'dispatch' function as a window member
import
stdwin
,
stdwinq
from
stdwinevents
import
*
# List of windows known to the main loop.
#
windows
=
[]
# Function to register a window.
#
def
register
(
win
):
# First test the dispatch function by passing it a null event --
# this catches registration of unconforming windows.
win
.
dispatch
(
WE_NULL
,
win
,
None
)
if
win
not
in
windows
:
windows
.
append
(
win
)
# Function to unregister a window.
# It is not an error to unregister an already unregistered window
# (this is useful for cleanup actions).
#
def
unregister
(
win
):
if
win
in
windows
:
windows
.
remove
(
win
)
# Not in 0.9.1
for
i
in
range
(
len
(
windows
)):
if
windows
[
i
]
=
win
:
del
windows
[
i
]
break
# Interfaces used by WindowSched.
#
def
countwindows
():
return
len
(
windows
)
#
def
anywindow
():
if
windows
:
return
windows
[
0
]
else
:
return
None
# Event processing main loop.
# Return when there are no windows left, or when an unhandled
# exception occurs. (It is safe to restart the main loop after
# an unsuccessful exit.)
# Python's stdwin.getevent() turns WE_COMMAND/WC_CANCEL events
# into KeyboardInterrupt exceptions; these are turned back in events.
#
def
mainloop
():
while
windows
:
try
:
dispatch
(
stdwinq
.
getevent
())
except
KeyboardInterrupt
:
dispatch
(
WE_COMMAND
,
stdwin
.
getactive
(),
WC_CANCEL
)
# Dispatch a single event.
# Windows not in the windows list don't get their events:
# events for such windows are silently ignored.
#
def
dispatch
(
event
):
if
event
[
1
]
in
windows
:
event
[
1
]
.
dispatch
(
event
)
Lib/lib-stdwin/stdwinq.py
0 → 100644
Dosyayı görüntüle @
7045dd04
# Replacements for getevent() and pollevent(),
# and new functions ungetevent() and sync().
# Every library module should ideally use this instead of
# stdwin.{get,poll}event(), so applications can use the services
# of ungetevent() and sync().
import
stdwin
# Events read ahead are stored in this queue.
#
queue
=
[]
# Replacement for getevent().
#
def
getevent
():
if
queue
:
event
=
queue
[
0
]
del
queue
[
0
]
return
event
else
:
return
stdwin
.
getevent
()
# Replacement for pollevent().
#
def
pollevent
():
if
queue
:
return
getevent
()
else
:
return
stdwin
.
pollevent
()
# Push an event back in the queue.
#
def
ungetevent
(
event
):
queue
.
insert
(
0
,
event
)
# Synchronize the display. It turns out that this is the way to
# force STDWIN to call XSync(), which some (esoteric) applications need.
# (This is stronger than just flushing -- it actually waits for a
# positive response from the X server on the last command issued.)
#
def
sync
():
while
1
:
event
=
stdwin
.
pollevent
()
if
not
event
:
break
queue
.
append
(
event
)
Lib/stdwin/mainloop.py
0 → 100755
Dosyayı görüntüle @
7045dd04
# Standard main loop for *all* STDWIN applications.
# This requires that applications:
# - register their windows on creation and unregister them when closed
# - have a 'dispatch' function as a window member
import
stdwin
,
stdwinq
from
stdwinevents
import
*
# List of windows known to the main loop.
#
windows
=
[]
# Function to register a window.
#
def
register
(
win
):
# First test the dispatch function by passing it a null event --
# this catches registration of unconforming windows.
win
.
dispatch
(
WE_NULL
,
win
,
None
)
if
win
not
in
windows
:
windows
.
append
(
win
)
# Function to unregister a window.
# It is not an error to unregister an already unregistered window
# (this is useful for cleanup actions).
#
def
unregister
(
win
):
if
win
in
windows
:
windows
.
remove
(
win
)
# Not in 0.9.1
for
i
in
range
(
len
(
windows
)):
if
windows
[
i
]
=
win
:
del
windows
[
i
]
break
# Interfaces used by WindowSched.
#
def
countwindows
():
return
len
(
windows
)
#
def
anywindow
():
if
windows
:
return
windows
[
0
]
else
:
return
None
# Event processing main loop.
# Return when there are no windows left, or when an unhandled
# exception occurs. (It is safe to restart the main loop after
# an unsuccessful exit.)
# Python's stdwin.getevent() turns WE_COMMAND/WC_CANCEL events
# into KeyboardInterrupt exceptions; these are turned back in events.
#
def
mainloop
():
while
windows
:
try
:
dispatch
(
stdwinq
.
getevent
())
except
KeyboardInterrupt
:
dispatch
(
WE_COMMAND
,
stdwin
.
getactive
(),
WC_CANCEL
)
# Dispatch a single event.
# Windows not in the windows list don't get their events:
# events for such windows are silently ignored.
#
def
dispatch
(
event
):
if
event
[
1
]
in
windows
:
event
[
1
]
.
dispatch
(
event
)
Lib/stdwin/stdwinq.py
0 → 100755
Dosyayı görüntüle @
7045dd04
# Replacements for getevent() and pollevent(),
# and new functions ungetevent() and sync().
# Every library module should ideally use this instead of
# stdwin.{get,poll}event(), so applications can use the services
# of ungetevent() and sync().
import
stdwin
# Events read ahead are stored in this queue.
#
queue
=
[]
# Replacement for getevent().
#
def
getevent
():
if
queue
:
event
=
queue
[
0
]
del
queue
[
0
]
return
event
else
:
return
stdwin
.
getevent
()
# Replacement for pollevent().
#
def
pollevent
():
if
queue
:
return
getevent
()
else
:
return
stdwin
.
pollevent
()
# Push an event back in the queue.
#
def
ungetevent
(
event
):
queue
.
insert
(
0
,
event
)
# Synchronize the display. It turns out that this is the way to
# force STDWIN to call XSync(), which some (esoteric) applications need.
# (This is stronger than just flushing -- it actually waits for a
# positive response from the X server on the last command issued.)
#
def
sync
():
while
1
:
event
=
stdwin
.
pollevent
()
if
not
event
:
break
queue
.
append
(
event
)
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