summaryrefslogtreecommitdiffstats
path: root/Mac/Lib
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>2001-03-08 23:10:37 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>2001-03-08 23:10:37 (GMT)
commite5c9474f0fbe22b5e2494bfcc5e0e97a25e121c5 (patch)
treee535c7555fb7cd650c7138a2c9899aafae3af1ac /Mac/Lib
parent53ebe562f5e9b6b4fe9ae597c7cdab9590e15f2b (diff)
downloadcpython-e5c9474f0fbe22b5e2494bfcc5e0e97a25e121c5.zip
cpython-e5c9474f0fbe22b5e2494bfcc5e0e97a25e121c5.tar.gz
cpython-e5c9474f0fbe22b5e2494bfcc5e0e97a25e121c5.tar.bz2
Default waittime in the eventloop is now None. At low level it will then be set to GetCaretTime().
Diffstat (limited to 'Mac/Lib')
-rw-r--r--Mac/Lib/FrameWork.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/Mac/Lib/FrameWork.py b/Mac/Lib/FrameWork.py
index 4454c67..8a2ef17 100644
--- a/Mac/Lib/FrameWork.py
+++ b/Mac/Lib/FrameWork.py
@@ -144,12 +144,11 @@ class Application:
# event type.
# Normally, however, you'd just define handlers for individual
# events.
- # (XXX I'm not sure if using default parameter values is the right
- # way to define the mask and wait time passed to WaitNextEvent.)
schedparams = (0, 0) # By default disable Python's event handling
+ default_wait = None # By default we wait GetCaretTime in WaitNextEvent
- def mainloop(self, mask = everyEvent, wait = 0):
+ def mainloop(self, mask = everyEvent, wait = None):
self.quitting = 0
saveparams = apply(MacOS.SchedParams, self.schedparams)
try:
@@ -169,7 +168,7 @@ class Application:
while self.do1event(mask, wait=0):
pass
- def do1event(self, mask = everyEvent, wait = 0):
+ def do1event(self, mask = everyEvent, wait = None):
ok, event = self.getevent(mask, wait)
if IsDialogEvent(event):
if self.do_dialogevent(event):
@@ -182,10 +181,14 @@ class Application:
def idle(self, event):
pass
- def getevent(self, mask = everyEvent, wait = 0):
+ def getevent(self, mask = everyEvent, wait = None):
if self.needmenubarredraw:
DrawMenuBar()
self.needmenubarredraw = 0
+ if wait is None:
+ wait = self.default_wait
+ if wait is None:
+ wait = GetCaretTime()
ok, event = WaitNextEvent(mask, wait)
return ok, event