diff Mac/Tools/IDE/PythonIDEMain.py @ 22672:86ce9ee14045 legacy-trunk

Allow file without filetype as long as they end in ".py". Added a -D flag (can really only be specified on OSX commandline) to not revector sys.stderr, for debugging the IDE itself. Not sure whether this should stay.
author Jack Jansen <jack.jansen@cwi.nl>
date Fri, 29 Mar 2002 21:23:47 +0000
parents da008b5c5035
children 57811c355f3a
line wrap: on
line diff
--- a/Mac/Tools/IDE/PythonIDEMain.py	Fri Mar 29 21:21:28 2002 +0000
+++ b/Mac/Tools/IDE/PythonIDEMain.py	Fri Mar 29 21:23:47 2002 +0000
@@ -6,6 +6,7 @@
 import Wapplication
 import W
 import os
+import sys
 import macfs
 import MacOS
 
@@ -42,9 +43,16 @@
 				self.quitevent)
 		import PyConsole, PyEdit
 		Splash.wait()
+		# With -D option (OSX command line only) keep stderr, for debugging the IDE
+		# itself.
+		debug_stderr = None
+		if sys.argv[1] == '-D':
+			debug_stderr = sys.stderr
+			del sys.argv[1]
 		PyConsole.installoutput()
 		PyConsole.installconsole()
-		import sys
+		if debug_stderr:
+			sys.stderr = debug_stderr
 		for path in sys.argv[1:]:
 			self.opendoc(path)
 		try:
@@ -171,6 +179,8 @@
 		fcreator, ftype = macfs.FSSpec(path).GetCreatorType()
 		if ftype == 'TEXT':
 			self.openscript(path)
+		elif ftype == '\0\0\0\0' and path[-3:] == '.py':
+			self.openscript(path)
 		else:
 			W.Message("Can't open file of type '%s'." % ftype)