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

Jack Jansen jackjansen@users.sourceforge.net
Sun, 24 Feb 2002 15:12:49 -0800


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

Modified Files:
      Tag: release22-maint
	PyConsole.py 
Log Message:
Backport of 1.9-1.11:
- Flush screen buffer upon console.flush() and output.flush().
This fixes bug #511992.
- Changes by Donovan Preston (and a few minor ones by me) to make IDE run under
MachoPython. Mainly making sure we don't call routines that don't exist
and representing pathnames in a os.separator-neutral format.

These shouldn't interfere too much with Just's work on the next generation IDE,
I hope.
- Modified version of patch #496882: echo SimpleStdin readline()
input to stdout.



Index: PyConsole.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/PyConsole.py,v
retrieving revision 1.8
retrieving revision 1.8.14.1
diff -C2 -d -r1.8 -r1.8.14.1
*** PyConsole.py	25 Aug 2001 12:09:34 -0000	1.8
--- PyConsole.py	24 Feb 2002 23:12:47 -0000	1.8.14.1
***************
*** 76,82 ****
  				text = self.get()[self._inputstart:selstart]
  				text = string.join(string.split(text, "\r"), "\n")
! 				saveyield = MacOS.EnableAppswitch(0)
  				self.pyinteractive.executeline(text, self, self._namespace)
! 				MacOS.EnableAppswitch(saveyield)
  				selstart, selend = self.getselection()
  				self._inputstart = selstart
--- 76,84 ----
  				text = self.get()[self._inputstart:selstart]
  				text = string.join(string.split(text, "\r"), "\n")
! 				if hasattr(MacOS, 'EnableAppswitch'):
! 					saveyield = MacOS.EnableAppswitch(0)
  				self.pyinteractive.executeline(text, self, self._namespace)
! 				if hasattr(MacOS, 'EnableAppswitch'):
! 					MacOS.EnableAppswitch(saveyield)
  				selstart, selend = self.getselection()
  				self._inputstart = selstart
***************
*** 107,110 ****
--- 109,114 ----
  		self.ted.WEClearUndo()
  		self.updatescrollbars()
+ 		if Qd.QDIsPortBuffered(self._parentwindow.wid):
+ 			Qd.QDFlushPortBuffer(self._parentwindow.wid, None)
  	
  	def selection_ok(self):
***************
*** 276,280 ****
  	
  	def write(self, text):
! 		oldyield = MacOS.EnableAppswitch(-1)
  		try:
  			self._buf = self._buf + text
--- 280,285 ----
  	
  	def write(self, text):
! 		if hasattr(MacOS, 'EnableAppswitch'):
! 			oldyield = MacOS.EnableAppswitch(-1)
  		try:
  			self._buf = self._buf + text
***************
*** 282,286 ****
  				self.flush()
  		finally:
! 			MacOS.EnableAppswitch(oldyield)
  	
  	def flush(self):
--- 287,292 ----
  				self.flush()
  		finally:
! 			if hasattr(MacOS, 'EnableAppswitch'):
! 				MacOS.EnableAppswitch(oldyield)
  	
  	def flush(self):
***************
*** 295,298 ****
--- 301,306 ----
  		self.w.outputtext.updatescrollbars()
  		self.w.outputtext.ted.WEFeatureFlag(WASTEconst.weFReadOnly, 1)
+ 		if Qd.QDIsPortBuffered(self.w.wid):
+ 			Qd.QDFlushPortBuffer(self.w.wid, None)
  	
  	def show(self):
***************
*** 355,359 ****
  		if rv is None:
  			return ""
! 		return rv + '\n'
  
  
--- 363,369 ----
  		if rv is None:
  			return ""
! 		rv = rv + "\n"  # readline should include line terminator
! 		sys.stdout.write(rv)  # echo user's reply
! 		return rv