summaryrefslogtreecommitdiffstats
path: root/Mac/Tools
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>2001-08-27 21:41:23 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>2001-08-27 21:41:23 (GMT)
commit3c06b9a7d4fa144eebd4786f71c4a301726e0c3c (patch)
tree4f9cdc3420a0b7d6cd76ec44245df09628e98993 /Mac/Tools
parenta5d7da528bda145426c50ad9ded8d0707d5f302c (diff)
downloadcpython-3c06b9a7d4fa144eebd4786f71c4a301726e0c3c.zip
cpython-3c06b9a7d4fa144eebd4786f71c4a301726e0c3c.tar.gz
cpython-3c06b9a7d4fa144eebd4786f71c4a301726e0c3c.tar.bz2
Use the new macresource module to open the accompanying resource file (if needed).
Diffstat (limited to 'Mac/Tools')
-rw-r--r--Mac/Tools/IDE/PythonIDE.py24
-rw-r--r--Mac/Tools/macfreeze/macfreezegui.py14
2 files changed, 11 insertions, 27 deletions
diff --git a/Mac/Tools/IDE/PythonIDE.py b/Mac/Tools/IDE/PythonIDE.py
index bc22e79..5ebe97a 100644
--- a/Mac/Tools/IDE/PythonIDE.py
+++ b/Mac/Tools/IDE/PythonIDE.py
@@ -13,25 +13,17 @@ def init():
from Carbon import Qd, QuickDraw
Qd.SetCursor(Qd.GetCursor(QuickDraw.watchCursor).data)
- from Carbon import Res
+ import macresource
import sys, os
- try:
- Res.GetResource('DITL', 468)
- except Res.Error:
- # we're not an applet
- Res.FSpOpenResFile(os.path.join(sys.exec_prefix, ":Mac:Tools:IDE:PythonIDE.rsrc"), 1)
- Res.FSpOpenResFile(os.path.join(sys.exec_prefix, ":Mac:Tools:IDE:Widgets.rsrc"), 1)
+ macresource.need('DITL', 468, "PythonIDE.rsrc")
+ widgetresfile = os.path.join(sys.exec_prefix, ":Mac:Tools:IDE:Widgets.rsrc")
+ refno = macresource.need('CURS', 468, widgetresfile)
+ if refno:
+ # We're not a fullblown application
ide_path = os.path.join(sys.exec_prefix, ":Mac:Tools:IDE")
else:
- # we're an applet
- try:
- Res.GetResource('CURS', 468)
- except Res.Error:
- Res.FSpOpenResFile(os.path.join(sys.exec_prefix, ":Mac:Tools:IDE:Widgets.rsrc"), 1)
- ide_path = os.path.join(sys.exec_prefix, ":Mac:Tools:IDE")
- else:
- # we're a full blown applet
- ide_path = sys.argv[0]
+ # We are a fully frozen application
+ ide_path = sys.argv[0]
if ide_path not in sys.path:
sys.path.insert(0, ide_path)
diff --git a/Mac/Tools/macfreeze/macfreezegui.py b/Mac/Tools/macfreeze/macfreezegui.py
index a834138..7921a29 100644
--- a/Mac/Tools/macfreeze/macfreezegui.py
+++ b/Mac/Tools/macfreeze/macfreezegui.py
@@ -6,6 +6,7 @@ import sys
import os
import string
from Carbon import Res
+import macresource
ID_MAINDIALOG=512
@@ -54,17 +55,8 @@ def dialog(script=None):
dirname = os.path.join(dirname, 'build.'+basebase)
# Get the dialog, possibly opening the resource file (if needed)
- try:
- d = Dlg.GetNewDialog(ID_MAINDIALOG, -1)
- except Dlg.Error:
- d = None
- if d == None:
- try:
- Res.FSpOpenResFile('macfreeze.rsrc', 1)
- except Res.Error:
- d = None
- else:
- d = Dlg.GetNewDialog(ID_MAINDIALOG, -1)
+ macresource.need('DLOG', ID_MAINDIALOG, 'macfreeze.rsrc')
+ d = Dlg.GetNewDialog(ID_MAINDIALOG, -1)
if d == None:
EasyDialogs.Message("Dialog resource not found or faulty")
sys.exit(1)