There are now three possible ways to run the IDE:

- this file dropped onto the interpreter
- applet built by BuildApplet (contains only __main__)
- applet built by BuildIDE (contains all IDE modules)
This commit is contained in:
Just van Rossum 1999-01-30 23:49:45 +00:00
parent 4f0d1f5469
commit a7a7193363
1 changed files with 13 additions and 6 deletions

View File

@ -13,16 +13,23 @@ def init():
import Qd, QuickDraw import Qd, QuickDraw
Qd.SetCursor(Qd.GetCursor(QuickDraw.watchCursor).data) Qd.SetCursor(Qd.GetCursor(QuickDraw.watchCursor).data)
import Res import Res, sys, os
try: try:
Res.GetResource('DITL', 468) Res.GetResource('DITL', 468)
except Res.Error: except Res.Error:
# we're not an applet # we're not an applet
Res.OpenResFile('Widgets.rsrc') Res.OpenResFile(os.path.join(sys.exec_prefix, ":Mac:Tools:IDE:PythonIDE.rsrc"))
Res.OpenResFile('PythonIDE.rsrc') Res.OpenResFile(os.path.join(sys.exec_prefix, ":Mac:Tools:IDE:Widgets.rsrc"))
sys.path.append(os.path.join(sys.exec_prefix, ":Mac:Tools:IDE"))
else: else:
# we're an applet # we're an applet
import sys try:
Res.GetResource('CURS', 468)
except Res.Error:
Res.OpenResFile(os.path.join(sys.exec_prefix, ":Mac:Tools:IDE:Widgets.rsrc"))
sys.path.append(os.path.join(sys.exec_prefix, ":Mac:Tools:IDE"))
else:
# we're a full blown applet
if sys.argv[0] not in sys.path: if sys.argv[0] not in sys.path:
sys.path[2:2] = [sys.argv[0]] sys.path[2:2] = [sys.argv[0]]