Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
2c83815c
Commit
2c83815c
authored
Aug 16, 1991
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Used mainloop instead of WindowParent functions
parent
3ddd85bd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
20 deletions
+20
-20
Lib/lib-stdwin/WindowSched.py
Lib/lib-stdwin/WindowSched.py
+10
-10
Lib/stdwin/WindowSched.py
Lib/stdwin/WindowSched.py
+10
-10
No files found.
Lib/lib-stdwin/WindowSched.py
View file @
2c83815c
# Combine a real-time scheduling queue and stdwin event handling.
# Uses the millisecond timer.
import
stdwin
import
stdwin
,
stdwinq
from
stdwinevents
import
WE_TIMER
import
WindowParent
import
mainloop
import
sched
import
time
...
...
@@ -14,26 +14,26 @@ def delayfunc(msecs):
#
# Check for immediate stdwin event
#
event
=
stdwin
.
pollevent
()
event
=
stdwin
q
.
pollevent
()
if
event
:
WindowParent
.
D
ispatch
(
event
)
mainloop
.
d
ispatch
(
event
)
return
#
# 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
:
time
.
millisleep
(
msecs
)
return
#
# Post a timer event on an arbitrary window and wait for it
#
window
=
WindowParent
.
AnyW
indow
()
window
=
mainloop
.
anyw
indow
()
window
.
settimer
(
msecs
/
100
)
event
=
stdwin
.
getevent
()
event
=
stdwin
q
.
getevent
()
window
.
settimer
(
0
)
if
event
[
0
]
<>
WE_TIMER
:
WindowParent
.
D
ispatch
(
event
)
mainloop
.
d
ispatch
(
event
)
q
=
sched
.
scheduler
().
init
(
time
.
millitimer
,
delayfunc
)
...
...
@@ -46,13 +46,13 @@ cancel = q.cancel
# Emptiness check must check both queues
#
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
#
def
run
():
while
not
empty
():
if
q
.
empty
():
WindowParent
.
Dispatch
(
stdwin
.
getevent
())
mainloop
.
dispatch
(
stdwinq
.
getevent
())
else
:
q
.
run
()
Lib/stdwin/WindowSched.py
View file @
2c83815c
# Combine a real-time scheduling queue and stdwin event handling.
# Uses the millisecond timer.
import
stdwin
import
stdwin
,
stdwinq
from
stdwinevents
import
WE_TIMER
import
WindowParent
import
mainloop
import
sched
import
time
...
...
@@ -14,26 +14,26 @@ def delayfunc(msecs):
#
# Check for immediate stdwin event
#
event
=
stdwin
.
pollevent
()
event
=
stdwin
q
.
pollevent
()
if
event
:
WindowParent
.
D
ispatch
(
event
)
mainloop
.
d
ispatch
(
event
)
return
#
# 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
:
time
.
millisleep
(
msecs
)
return
#
# Post a timer event on an arbitrary window and wait for it
#
window
=
WindowParent
.
AnyW
indow
()
window
=
mainloop
.
anyw
indow
()
window
.
settimer
(
msecs
/
100
)
event
=
stdwin
.
getevent
()
event
=
stdwin
q
.
getevent
()
window
.
settimer
(
0
)
if
event
[
0
]
<>
WE_TIMER
:
WindowParent
.
D
ispatch
(
event
)
mainloop
.
d
ispatch
(
event
)
q
=
sched
.
scheduler
().
init
(
time
.
millitimer
,
delayfunc
)
...
...
@@ -46,13 +46,13 @@ cancel = q.cancel
# Emptiness check must check both queues
#
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
#
def
run
():
while
not
empty
():
if
q
.
empty
():
WindowParent
.
Dispatch
(
stdwin
.
getevent
())
mainloop
.
dispatch
(
stdwinq
.
getevent
())
else
:
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