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
0d3f4678
Kaydet (Commit)
0d3f4678
authored
Agu 16, 1991
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Used mainloop instead of WindowParent functions
üst
e825f159
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
20 deletions
+20
-20
WindowSched.py
Lib/lib-stdwin/WindowSched.py
+10
-10
WindowSched.py
Lib/stdwin/WindowSched.py
+10
-10
No files found.
Lib/lib-stdwin/WindowSched.py
Dosyayı görüntüle @
0d3f4678
# Combine a real-time scheduling queue and stdwin event handling.
# Combine a real-time scheduling queue and stdwin event handling.
# Uses the millisecond timer.
# Uses the millisecond timer.
import
stdwin
import
stdwin
,
stdwinq
from
stdwinevents
import
WE_TIMER
from
stdwinevents
import
WE_TIMER
import
WindowParent
import
mainloop
import
sched
import
sched
import
time
import
time
...
@@ -14,26 +14,26 @@ def delayfunc(msecs):
...
@@ -14,26 +14,26 @@ def delayfunc(msecs):
#
#
# Check for immediate stdwin event
# Check for immediate stdwin event
#
#
event
=
stdwin
.
pollevent
()
event
=
stdwin
q
.
pollevent
()
if
event
:
if
event
:
WindowParent
.
D
ispatch
(
event
)
mainloop
.
d
ispatch
(
event
)
return
return
#
#
# Use millisleep for very short delays or if there are no windows
# Use millisleep for very short delays or if there are no windows
#
#
if
msecs
<
100
or
WindowParent
.
CountW
indows
()
=
0
:
if
msecs
<
100
or
mainloop
.
countw
indows
()
=
0
:
if
msecs
>
0
:
if
msecs
>
0
:
time
.
millisleep
(
msecs
)
time
.
millisleep
(
msecs
)
return
return
#
#
# Post a timer event on an arbitrary window and wait for it
# Post a timer event on an arbitrary window and wait for it
#
#
window
=
WindowParent
.
AnyW
indow
()
window
=
mainloop
.
anyw
indow
()
window
.
settimer
(
msecs
/
100
)
window
.
settimer
(
msecs
/
100
)
event
=
stdwin
.
getevent
()
event
=
stdwin
q
.
getevent
()
window
.
settimer
(
0
)
window
.
settimer
(
0
)
if
event
[
0
]
<>
WE_TIMER
:
if
event
[
0
]
<>
WE_TIMER
:
WindowParent
.
D
ispatch
(
event
)
mainloop
.
d
ispatch
(
event
)
q
=
sched
.
scheduler
()
.
init
(
time
.
millitimer
,
delayfunc
)
q
=
sched
.
scheduler
()
.
init
(
time
.
millitimer
,
delayfunc
)
...
@@ -46,13 +46,13 @@ cancel = q.cancel
...
@@ -46,13 +46,13 @@ cancel = q.cancel
# Emptiness check must check both queues
# Emptiness check must check both queues
#
#
def
empty
():
def
empty
():
return
q
.
empty
()
and
WindowParent
.
CountW
indows
()
=
0
return
q
.
empty
()
and
mainloop
.
countw
indows
()
=
0
# Run until there is nothing left to do
# Run until there is nothing left to do
#
#
def
run
():
def
run
():
while
not
empty
():
while
not
empty
():
if
q
.
empty
():
if
q
.
empty
():
WindowParent
.
Dispatch
(
stdwin
.
getevent
())
mainloop
.
dispatch
(
stdwinq
.
getevent
())
else
:
else
:
q
.
run
()
q
.
run
()
Lib/stdwin/WindowSched.py
Dosyayı görüntüle @
0d3f4678
# Combine a real-time scheduling queue and stdwin event handling.
# Combine a real-time scheduling queue and stdwin event handling.
# Uses the millisecond timer.
# Uses the millisecond timer.
import
stdwin
import
stdwin
,
stdwinq
from
stdwinevents
import
WE_TIMER
from
stdwinevents
import
WE_TIMER
import
WindowParent
import
mainloop
import
sched
import
sched
import
time
import
time
...
@@ -14,26 +14,26 @@ def delayfunc(msecs):
...
@@ -14,26 +14,26 @@ def delayfunc(msecs):
#
#
# Check for immediate stdwin event
# Check for immediate stdwin event
#
#
event
=
stdwin
.
pollevent
()
event
=
stdwin
q
.
pollevent
()
if
event
:
if
event
:
WindowParent
.
D
ispatch
(
event
)
mainloop
.
d
ispatch
(
event
)
return
return
#
#
# Use millisleep for very short delays or if there are no windows
# Use millisleep for very short delays or if there are no windows
#
#
if
msecs
<
100
or
WindowParent
.
CountW
indows
()
=
0
:
if
msecs
<
100
or
mainloop
.
countw
indows
()
=
0
:
if
msecs
>
0
:
if
msecs
>
0
:
time
.
millisleep
(
msecs
)
time
.
millisleep
(
msecs
)
return
return
#
#
# Post a timer event on an arbitrary window and wait for it
# Post a timer event on an arbitrary window and wait for it
#
#
window
=
WindowParent
.
AnyW
indow
()
window
=
mainloop
.
anyw
indow
()
window
.
settimer
(
msecs
/
100
)
window
.
settimer
(
msecs
/
100
)
event
=
stdwin
.
getevent
()
event
=
stdwin
q
.
getevent
()
window
.
settimer
(
0
)
window
.
settimer
(
0
)
if
event
[
0
]
<>
WE_TIMER
:
if
event
[
0
]
<>
WE_TIMER
:
WindowParent
.
D
ispatch
(
event
)
mainloop
.
d
ispatch
(
event
)
q
=
sched
.
scheduler
()
.
init
(
time
.
millitimer
,
delayfunc
)
q
=
sched
.
scheduler
()
.
init
(
time
.
millitimer
,
delayfunc
)
...
@@ -46,13 +46,13 @@ cancel = q.cancel
...
@@ -46,13 +46,13 @@ cancel = q.cancel
# Emptiness check must check both queues
# Emptiness check must check both queues
#
#
def
empty
():
def
empty
():
return
q
.
empty
()
and
WindowParent
.
CountW
indows
()
=
0
return
q
.
empty
()
and
mainloop
.
countw
indows
()
=
0
# Run until there is nothing left to do
# Run until there is nothing left to do
#
#
def
run
():
def
run
():
while
not
empty
():
while
not
empty
():
if
q
.
empty
():
if
q
.
empty
():
WindowParent
.
Dispatch
(
stdwin
.
getevent
())
mainloop
.
dispatch
(
stdwinq
.
getevent
())
else
:
else
:
q
.
run
()
q
.
run
()
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