annotate Mac/Tools/IDE/PythonIDE.py @ 22031:761075280a95 2.2

Backport of 1.9: 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 Sun, 24 Feb 2002 23:16:25 +0000
parents 546ef318ba5d
children 4c4f92b0af90
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18167
c5ac6f055c62 Some long overdue maintainance. Made all IDE sources 7-bit-clean, to avoid any further encoding conversion troubles.
Just van Rossum <just@letterror.com>
parents: 11424
diff changeset
1 # copyright 1996-2001 Just van Rossum, Letterror. just@letterror.com
10047
a0b06891d286 First Checked In.
Just van Rossum <just@lettererror.com>
parents:
diff changeset
2
a0b06891d286 First Checked In.
Just van Rossum <just@lettererror.com>
parents:
diff changeset
3 # keep this (__main__) as clean as possible, since we are using
a0b06891d286 First Checked In.
Just van Rossum <just@lettererror.com>
parents:
diff changeset
4 # it like the "normal" interpreter.
a0b06891d286 First Checked In.
Just van Rossum <just@lettererror.com>
parents:
diff changeset
5
18167
c5ac6f055c62 Some long overdue maintainance. Made all IDE sources 7-bit-clean, to avoid any further encoding conversion troubles.
Just van Rossum <just@letterror.com>
parents: 11424
diff changeset
6 __version__ = '1.0.1'
22031
761075280a95 Backport of 1.9:
Jack Jansen <jack.jansen@cwi.nl>
parents: 19515
diff changeset
7 import sys
761075280a95 Backport of 1.9:
Jack Jansen <jack.jansen@cwi.nl>
parents: 19515
diff changeset
8 import os
10047
a0b06891d286 First Checked In.
Just van Rossum <just@lettererror.com>
parents:
diff changeset
9
a0b06891d286 First Checked In.
Just van Rossum <just@lettererror.com>
parents:
diff changeset
10 def init():
a0b06891d286 First Checked In.
Just van Rossum <just@lettererror.com>
parents:
diff changeset
11 import MacOS
22031
761075280a95 Backport of 1.9:
Jack Jansen <jack.jansen@cwi.nl>
parents: 19515
diff changeset
12 if hasattr(MacOS, 'EnableAppswitch'):
761075280a95 Backport of 1.9:
Jack Jansen <jack.jansen@cwi.nl>
parents: 19515
diff changeset
13 MacOS.EnableAppswitch(-1)
10047
a0b06891d286 First Checked In.
Just van Rossum <just@lettererror.com>
parents:
diff changeset
14
19488
42b2f1936254 Import the MacOS toolbox modules from the Carbon package.
Jack Jansen <jack.jansen@cwi.nl>
parents: 18167
diff changeset
15 from Carbon import Qd, QuickDraw
10047
a0b06891d286 First Checked In.
Just van Rossum <just@lettererror.com>
parents:
diff changeset
16 Qd.SetCursor(Qd.GetCursor(QuickDraw.watchCursor).data)
a0b06891d286 First Checked In.
Just van Rossum <just@lettererror.com>
parents:
diff changeset
17
19515
546ef318ba5d Use the new macresource module to open the accompanying resource file (if needed).
Jack Jansen <jack.jansen@cwi.nl>
parents: 19488
diff changeset
18 import macresource
19488
42b2f1936254 Import the MacOS toolbox modules from the Carbon package.
Jack Jansen <jack.jansen@cwi.nl>
parents: 18167
diff changeset
19 import sys, os
19515
546ef318ba5d Use the new macresource module to open the accompanying resource file (if needed).
Jack Jansen <jack.jansen@cwi.nl>
parents: 19488
diff changeset
20 macresource.need('DITL', 468, "PythonIDE.rsrc")
22031
761075280a95 Backport of 1.9:
Jack Jansen <jack.jansen@cwi.nl>
parents: 19515
diff changeset
21 widgetrespathsegs = [sys.exec_prefix, "Mac", "Tools", "IDE", "Widgets.rsrc"]
761075280a95 Backport of 1.9:
Jack Jansen <jack.jansen@cwi.nl>
parents: 19515
diff changeset
22 widgetresfile = os.path.join(*widgetrespathsegs)
19515
546ef318ba5d Use the new macresource module to open the accompanying resource file (if needed).
Jack Jansen <jack.jansen@cwi.nl>
parents: 19488
diff changeset
23 refno = macresource.need('CURS', 468, widgetresfile)
546ef318ba5d Use the new macresource module to open the accompanying resource file (if needed).
Jack Jansen <jack.jansen@cwi.nl>
parents: 19488
diff changeset
24 if refno:
546ef318ba5d Use the new macresource module to open the accompanying resource file (if needed).
Jack Jansen <jack.jansen@cwi.nl>
parents: 19488
diff changeset
25 # We're not a fullblown application
22031
761075280a95 Backport of 1.9:
Jack Jansen <jack.jansen@cwi.nl>
parents: 19515
diff changeset
26 idepathsegs = [sys.exec_prefix, "Mac", "Tools", "IDE"]
761075280a95 Backport of 1.9:
Jack Jansen <jack.jansen@cwi.nl>
parents: 19515
diff changeset
27 ide_path = os.path.join(*idepathsegs)
10047
a0b06891d286 First Checked In.
Just van Rossum <just@lettererror.com>
parents:
diff changeset
28 else:
19515
546ef318ba5d Use the new macresource module to open the accompanying resource file (if needed).
Jack Jansen <jack.jansen@cwi.nl>
parents: 19488
diff changeset
29 # We are a fully frozen application
546ef318ba5d Use the new macresource module to open the accompanying resource file (if needed).
Jack Jansen <jack.jansen@cwi.nl>
parents: 19488
diff changeset
30 ide_path = sys.argv[0]
10050
66858fdf467e Add $(APPLICATION) or :Mac:Tools:IDE at the very start of sys.path to improve startup time -- jvr
Just van Rossum <just@lettererror.com>
parents: 10049
diff changeset
31 if ide_path not in sys.path:
66858fdf467e Add $(APPLICATION) or :Mac:Tools:IDE at the very start of sys.path to improve startup time -- jvr
Just van Rossum <just@lettererror.com>
parents: 10049
diff changeset
32 sys.path.insert(0, ide_path)
10047
a0b06891d286 First Checked In.
Just van Rossum <just@lettererror.com>
parents:
diff changeset
33
a0b06891d286 First Checked In.
Just van Rossum <just@lettererror.com>
parents:
diff changeset
34
a0b06891d286 First Checked In.
Just van Rossum <just@lettererror.com>
parents:
diff changeset
35 init()
a0b06891d286 First Checked In.
Just van Rossum <just@lettererror.com>
parents:
diff changeset
36 del init
a0b06891d286 First Checked In.
Just van Rossum <just@lettererror.com>
parents:
diff changeset
37
a0b06891d286 First Checked In.
Just van Rossum <just@lettererror.com>
parents:
diff changeset
38 import PythonIDEMain