comparison Mac/Tools/IDE/PythonIDE.py @ 21772:ec750e37671b legacy-trunk

Changes by Donovan Preston (and a few minor ones by me) to make IDE run under MachoPython. Mainly making sure we don't call routines that don't exist and representing pathnames in a os.separator-neutral format. These shouldn't interfere too much with Just's work on the next generation IDE, I hope.
author Jack Jansen <jack.jansen@cwi.nl>
date Mon, 21 Jan 2002 23:00:52 +0000
parents 546ef318ba5d
children 4c4f92b0af90
comparison
equal deleted inserted replaced
21771:8e67d9035b69 21772:ec750e37671b
2 2
3 # keep this (__main__) as clean as possible, since we are using 3 # keep this (__main__) as clean as possible, since we are using
4 # it like the "normal" interpreter. 4 # it like the "normal" interpreter.
5 5
6 __version__ = '1.0.1' 6 __version__ = '1.0.1'
7 7 import sys
8 import os
8 9
9 def init(): 10 def init():
10 import MacOS 11 import MacOS
11 MacOS.EnableAppswitch(-1) 12 if hasattr(MacOS, 'EnableAppswitch'):
13 MacOS.EnableAppswitch(-1)
12 14
13 from Carbon import Qd, QuickDraw 15 from Carbon import Qd, QuickDraw
14 Qd.SetCursor(Qd.GetCursor(QuickDraw.watchCursor).data) 16 Qd.SetCursor(Qd.GetCursor(QuickDraw.watchCursor).data)
15 17
16 import macresource 18 import macresource
17 import sys, os 19 import sys, os
18 macresource.need('DITL', 468, "PythonIDE.rsrc") 20 macresource.need('DITL', 468, "PythonIDE.rsrc")
19 widgetresfile = os.path.join(sys.exec_prefix, ":Mac:Tools:IDE:Widgets.rsrc") 21 widgetrespathsegs = [sys.exec_prefix, "Mac", "Tools", "IDE", "Widgets.rsrc"]
22 widgetresfile = os.path.join(*widgetrespathsegs)
20 refno = macresource.need('CURS', 468, widgetresfile) 23 refno = macresource.need('CURS', 468, widgetresfile)
21 if refno: 24 if refno:
22 # We're not a fullblown application 25 # We're not a fullblown application
23 ide_path = os.path.join(sys.exec_prefix, ":Mac:Tools:IDE") 26 idepathsegs = [sys.exec_prefix, "Mac", "Tools", "IDE"]
27 ide_path = os.path.join(*idepathsegs)
24 else: 28 else:
25 # We are a fully frozen application 29 # We are a fully frozen application
26 ide_path = sys.argv[0] 30 ide_path = sys.argv[0]
27 if ide_path not in sys.path: 31 if ide_path not in sys.path:
28 sys.path.insert(0, ide_path) 32 sys.path.insert(0, ide_path)