summaryrefslogtreecommitdiffstats
path: root/Mac/Tools/twit/twit.py
blob: 9db908e32c86ce15b16ba3b04e1bed974c2913c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
"""twit - The Window-Independent Tracer.

Interface:
twit.main()						Enter debugger in inactive interactive state
twit.run(stmt, globals, locals)	Enter debugger and start running stmt
twit.post_mortem(traceback)		Enter debugger in post-mortem mode on traceback
twit.pm()						Enter debugger in pm-mode on sys.last_traceback

main program: nothing but a bit of glue to put it all together.

Jack Jansen, CWI, August 1996."""

import os
if os.name == 'mac':
	import MacOS
	MacOS.splash(515)	# Try to show the splash screen
	import mactwit_app; twit_app = mactwit_app
else:
	try:
		import _tkinter
		have_tk = 1
	except ImportError:
		have_tk = 0
	if have_tk:
		import tktwit_app; twit_app = tktwit_app
	else:
		print 'Please implementent machine-dependent code and try again:-)'
		sys.exit(1)
	
import sys
	
def main():
	twit_app.Initialize()
	if os.name == 'mac':
		MacOS.splash()
	twit_app.Twit('none', None)
	
def run(statement, globals=None, locals=None):
	twit_app.Initialize()
	twit_app.Twit('run', (statement, globals, locals))

def post_mortem(t):
	Initialize()
	twit_app.Twit('pm', t)
	
def pm():
	post_mortem(sys.last_traceback)
	
if __name__ == '__main__':
	main()