diff options
Diffstat (limited to 'Lib/lib-stdwin')
-rw-r--r-- | Lib/lib-stdwin/WindowSched.py | 11 | ||||
-rw-r--r-- | Lib/lib-stdwin/filewin.py | 6 | ||||
-rw-r--r-- | Lib/lib-stdwin/wdb.py | 8 |
3 files changed, 14 insertions, 11 deletions
diff --git a/Lib/lib-stdwin/WindowSched.py b/Lib/lib-stdwin/WindowSched.py index 56ca6f8..b2fbe76 100644 --- a/Lib/lib-stdwin/WindowSched.py +++ b/Lib/lib-stdwin/WindowSched.py @@ -1,5 +1,5 @@ # Combine a real-time scheduling queue and stdwin event handling. -# Uses the millisecond timer. +# Keeps times in milliseconds. import stdwin, stdwinq from stdwinevents import WE_TIMER @@ -19,11 +19,11 @@ def delayfunc(msecs): mainloop.dispatch(event) return # - # Use millisleep for very short delays or if there are no windows + # Use sleep for very short delays or if there are no windows # if msecs < 100 or mainloop.countwindows() == 0: if msecs > 0: - time.millisleep(msecs) + time.sleep(msecs * 0.001) return # # Post a timer event on an arbitrary window and wait for it @@ -35,7 +35,10 @@ def delayfunc(msecs): if event[0] <> WE_TIMER: mainloop.dispatch(event) -q = sched.scheduler(time.millitimer, delayfunc) +def millitimer(): + return int(1000 * time.time()) + +q = sched.scheduler(millitimer, delayfunc) # Export functions enter, enterabs and cancel just like a scheduler # diff --git a/Lib/lib-stdwin/filewin.py b/Lib/lib-stdwin/filewin.py index a03c3f7..df6aa7d 100644 --- a/Lib/lib-stdwin/filewin.py +++ b/Lib/lib-stdwin/filewin.py @@ -2,19 +2,19 @@ # File windows, a subclass of textwin (which is a subclass of gwin) import textwin -import builtin +import __builtin__ # FILE WINDOW def open_readonly(fn): # Open a file window - fp = builtin.open(fn, 'r') + fp = __builtin__.open(fn, 'r') w = textwin.open_readonly(fn, fp.read()) w.fn = fn return w def open(fn): # Open a file window - fp = builtin.open(fn, 'r') + fp = __builtin__.open(fn, 'r') w = textwin.open(fn, fp.read()) w.fn = fn return w diff --git a/Lib/lib-stdwin/wdb.py b/Lib/lib-stdwin/wdb.py index d5c28bb..4018ab1 100644 --- a/Lib/lib-stdwin/wdb.py +++ b/Lib/lib-stdwin/wdb.py @@ -241,7 +241,7 @@ class Wdb(bdb.Bdb, basewin.BaseWindow): # Window debugger stdwin.fleep() def draw(self, detail): - import linecache, codehack, string + import linecache, string d = self.win.begindrawing() try: h, v = 0, 0 @@ -252,7 +252,7 @@ class Wdb(bdb.Bdb, basewin.BaseWindow): # Window debugger else: s = ' ' s = s + fn + '(' + `lineno` + ')' - s = s + codehack.getcodename(f.f_code) + s = s + f.f_code.co_name if f.f_locals.has_key('__args__'): args = f.f_locals['__args__'] if args is not None: @@ -286,6 +286,8 @@ def runcall(*args): try: apply(x.runcall, args) finally: x.close() +def set_trace(): + Wdb().set_trace() # Post-Mortem interface @@ -304,6 +306,4 @@ def pm(): TESTCMD = 'import x; x.main()' def test(): - import linecache - linecache.checkcache() run(TESTCMD) |