diff Mac/Tools/IDE/PythonIDE.py @ 19515:546ef318ba5d legacy-trunk

Use the new macresource module to open the accompanying resource file (if needed).
author Jack Jansen <jack.jansen@cwi.nl>
date Mon, 27 Aug 2001 21:41:23 +0000
parents 42b2f1936254
children ec750e37671b
line wrap: on
line diff
--- a/Mac/Tools/IDE/PythonIDE.py	Mon Aug 27 21:37:45 2001 +0000
+++ b/Mac/Tools/IDE/PythonIDE.py	Mon Aug 27 21:41:23 2001 +0000
@@ -13,25 +13,17 @@
 	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)