mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
Merge alpha100 branch back to main trunk
This commit is contained in:
parent
2979b01ff8
commit
b6775db241
176 changed files with 5302 additions and 3668 deletions
|
@ -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
|
||||
#
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue