[Python-checkins] CVS: python/dist/src/Mac/Tools/IDE PyConsole.py,1.4,1.5

Jack Jansen jackjansen@users.sourceforge.net
Sat, 26 May 2001 13:01:44 -0700


Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE
In directory usw-pr-cvs1:/tmp/cvs-serv26394/Python/Mac/Tools/IDE

Modified Files:
	PyConsole.py 
Log Message:
When reading from stdin (with the dialog box) use any partial line on
stdout as the prompt. This makes raw_input() and print "xxx", ; sys.stdin.readline() work a bit more palatable. 

Index: PyConsole.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/PyConsole.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** PyConsole.py	2001/05/17 12:36:35	1.4
--- PyConsole.py	2001/05/26 20:01:41	1.5
***************
*** 341,346 ****
  	def readline(self):
  		import EasyDialogs
  		sys.stdout.flush()
! 		rv = EasyDialogs.AskString("")
  		if rv is None:
  			return ""
--- 341,353 ----
  	def readline(self):
  		import EasyDialogs
+ 		# A trick to make the input dialog box a bit more palatable
+ 		if hasattr(sys.stdout, '_buf'):
+ 			prompt = sys.stdout._buf
+ 		else:
+ 			prompt = ""
+ 		if not prompt:
+ 			prompt = "Stdin input:"
  		sys.stdout.flush()
! 		rv = EasyDialogs.AskString(prompt)
  		if rv is None:
  			return ""