]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Used mainloop instead of WindowParent functions
authorGuido van Rossum <guido@python.org>
Fri, 16 Aug 1991 13:22:53 +0000 (13:22 +0000)
committerGuido van Rossum <guido@python.org>
Fri, 16 Aug 1991 13:22:53 +0000 (13:22 +0000)
Lib/lib-stdwin/WindowSched.py
Lib/stdwin/WindowSched.py

index 8c9151cedf4b6f213f524df5fd5585e69dc2348f..912531752d484ba4ccbe4c1c16bd61f4e0fba697 100644 (file)
@@ -1,9 +1,9 @@
 # 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 = stdwinq.pollevent()
        if event:
-               WindowParent.Dispatch(event)
+               mainloop.dispatch(event)
                return
        #
        # Use millisleep for very short delays or if there are no windows
        #
-       if msecs < 100 or WindowParent.CountWindows() = 0:
+       if msecs < 100 or mainloop.countwindows() = 0:
                if msecs > 0:
                        time.millisleep(msecs)
                return
        #
        # Post a timer event on an arbitrary window and wait for it
        #
-       window = WindowParent.AnyWindow()
+       window = mainloop.anywindow()
        window.settimer(msecs/100)
-       event = stdwin.getevent()
+       event = stdwinq.getevent()
        window.settimer(0)
        if event[0] <> WE_TIMER:
-               WindowParent.Dispatch(event)
+               mainloop.dispatch(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.CountWindows() = 0
+       return q.empty() and mainloop.countwindows() = 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()
index 8c9151cedf4b6f213f524df5fd5585e69dc2348f..912531752d484ba4ccbe4c1c16bd61f4e0fba697 100755 (executable)
@@ -1,9 +1,9 @@
 # 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 = stdwinq.pollevent()
        if event:
-               WindowParent.Dispatch(event)
+               mainloop.dispatch(event)
                return
        #
        # Use millisleep for very short delays or if there are no windows
        #
-       if msecs < 100 or WindowParent.CountWindows() = 0:
+       if msecs < 100 or mainloop.countwindows() = 0:
                if msecs > 0:
                        time.millisleep(msecs)
                return
        #
        # Post a timer event on an arbitrary window and wait for it
        #
-       window = WindowParent.AnyWindow()
+       window = mainloop.anywindow()
        window.settimer(msecs/100)
-       event = stdwin.getevent()
+       event = stdwinq.getevent()
        window.settimer(0)
        if event[0] <> WE_TIMER:
-               WindowParent.Dispatch(event)
+               mainloop.dispatch(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.CountWindows() = 0
+       return q.empty() and mainloop.countwindows() = 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()