blob: 7eaf8c733c2efab2c53a6a81d349117478b698e5 [file] [log] [blame]
Just van Rossumdc3c6172001-06-19 21:37:33 +00001# copyright 1996-2001 Just van Rossum, Letterror. just@letterror.com
Just van Rossum40f9b7b1999-01-30 22:39:17 +00002
3# keep this (__main__) as clean as possible, since we are using
4# it like the "normal" interpreter.
5
Just van Rossumdc3c6172001-06-19 21:37:33 +00006__version__ = '1.0.1'
Jack Jansen815d2bf2002-01-21 23:00:52 +00007import sys
8import os
Just van Rossum40f9b7b1999-01-30 22:39:17 +00009
10def init():
11 import MacOS
Jack Jansen815d2bf2002-01-21 23:00:52 +000012 if hasattr(MacOS, 'EnableAppswitch'):
13 MacOS.EnableAppswitch(-1)
Just van Rossum40f9b7b1999-01-30 22:39:17 +000014
Jack Jansen5a6fdcd2001-08-25 12:15:04 +000015 from Carbon import Qd, QuickDraw
Just van Rossum40f9b7b1999-01-30 22:39:17 +000016 Qd.SetCursor(Qd.GetCursor(QuickDraw.watchCursor).data)
17
Jack Jansen3c06b9a2001-08-27 21:41:23 +000018 import macresource
Jack Jansen5a6fdcd2001-08-25 12:15:04 +000019 import sys, os
Jack Jansen3c06b9a2001-08-27 21:41:23 +000020 macresource.need('DITL', 468, "PythonIDE.rsrc")
Jack Jansen815d2bf2002-01-21 23:00:52 +000021 widgetrespathsegs = [sys.exec_prefix, "Mac", "Tools", "IDE", "Widgets.rsrc"]
22 widgetresfile = os.path.join(*widgetrespathsegs)
Jack Jansen3c06b9a2001-08-27 21:41:23 +000023 refno = macresource.need('CURS', 468, widgetresfile)
Jack Jansen6be89562002-08-31 01:22:37 +000024 if os.environ.has_key('PYTHONIDEPATH'):
25 # For development set this environment variable
26 ide_path = os.environ['PYTHONIDEPATH']
27 elif refno:
Jack Jansen3c06b9a2001-08-27 21:41:23 +000028 # We're not a fullblown application
Jack Jansen815d2bf2002-01-21 23:00:52 +000029 idepathsegs = [sys.exec_prefix, "Mac", "Tools", "IDE"]
30 ide_path = os.path.join(*idepathsegs)
Just van Rossum40f9b7b1999-01-30 22:39:17 +000031 else:
Jack Jansen3c06b9a2001-08-27 21:41:23 +000032 # We are a fully frozen application
33 ide_path = sys.argv[0]
Just van Rossum99ec5a51999-01-31 23:17:56 +000034 if ide_path not in sys.path:
35 sys.path.insert(0, ide_path)
Just van Rossum40f9b7b1999-01-30 22:39:17 +000036
37
38init()
39del init
40
41import PythonIDEMain