blob: 19d6af125211264aa206b20e353a6aa36dbb2be0 [file] [log] [blame]
Jack Jansen4892ab71996-09-24 15:35:50 +00001"""twit - The Window-Independent Tracer.
2
3Interface:
4twit.main() Enter debugger in inactive interactive state
5twit.run(stmt, globals, locals) Enter debugger and start running stmt
6twit.post_mortem(traceback) Enter debugger in post-mortem mode on traceback
7twit.pm() Enter debugger in pm-mode on sys.last_traceback
8
9main program: nothing but a bit of glue to put it all together.
10
11Jack Jansen, CWI, August 1996."""
12
13import os
14if os.name == 'mac':
Jack Jansen5c303881996-09-25 14:08:40 +000015# Not supported in distributed 1.4b3:
16## import MacOS
17## MacOS.splash(515) # Try to show the splash screen
Jack Jansen4892ab71996-09-24 15:35:50 +000018 import mactwit_app; twit_app = mactwit_app
Jack Jansen4892ab71996-09-24 15:35:50 +000019else:
20 try:
21 import _tkinter
22 have_tk = 1
23 except ImportError:
24 have_tk = 0
25 if have_tk:
Jack Jansen4892ab71996-09-24 15:35:50 +000026 import tktwit_app; twit_app = tktwit_app
27 else:
Jack Jansena1560cf1996-09-26 16:26:05 +000028 print 'Please implementent machine-dependent code and try again:-)'
Jack Jansen4892ab71996-09-24 15:35:50 +000029 sys.exit(1)
30
Jack Jansen4892ab71996-09-24 15:35:50 +000031import sys
Jack Jansen4892ab71996-09-24 15:35:50 +000032
33def main():
34 twit_app.Initialize()
Jack Jansen5c303881996-09-25 14:08:40 +000035## if os.name == 'mac':
36## MacOS.splash()
Jack Jansena1560cf1996-09-26 16:26:05 +000037 twit_app.Twit('none', None)
Jack Jansen4892ab71996-09-24 15:35:50 +000038
39def run(statement, globals=None, locals=None):
40 twit_app.Initialize()
Jack Jansena1560cf1996-09-26 16:26:05 +000041 twit_app.Twit('run', (statement, globals, locals))
Jack Jansen4892ab71996-09-24 15:35:50 +000042
43def post_mortem(t):
Jack Jansen4892ab71996-09-24 15:35:50 +000044 Initialize()
Jack Jansena1560cf1996-09-26 16:26:05 +000045 twit_app.Twit('pm', t)
Jack Jansen4892ab71996-09-24 15:35:50 +000046
47def pm():
48 post_mortem(sys.last_traceback)
49
50if __name__ == '__main__':
51 main()
52
53