[Python-checkins] CVS: python/dist/src/Mac/Tools/IDE Wwindows.py,1.13,1.13.8.1

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


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

Modified Files:
      Tag: release22-maint
	Wwindows.py 
Log Message:
Backport of 1.15 and 1.16:
- Added minimal support for floating windows.
- 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.



Index: Wwindows.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/Wwindows.py,v
retrieving revision 1.13
retrieving revision 1.13.8.1
diff -C2 -d -r1.13 -r1.13.8.1
*** Wwindows.py	2 Nov 2001 19:09:34 -0000	1.13
--- Wwindows.py	24 Feb 2002 23:21:35 -0000	1.13.8.1
***************
*** 8,11 ****
--- 8,16 ----
  from types import InstanceType, StringType
  
+ if hasattr(Win, "FrontNonFloatingWindow"):
+ 	MyFrontWindow = Win.FrontNonFloatingWindow
+ else:
+ 	MyFrontWindow = Win.FrontWindow
+ 
  
  class Window(FrameWork.Window, Wbase.SelectableWidget):
***************
*** 456,460 ****
  	
  	def mainloop(self):
! 		saveyield = MacOS.EnableAppswitch(-1)
  		while not self.done:
  			#self.do1event()
--- 461,466 ----
  	
  	def mainloop(self):
! 		if hasattr(MacOS, 'EnableAppswitch'):
! 			saveyield = MacOS.EnableAppswitch(-1)
  		while not self.done:
  			#self.do1event()
***************
*** 466,470 ****
  						Events.mUpMask, 
  						10)
! 		MacOS.EnableAppswitch(saveyield)
  	
  	def do1event(self, mask = Events.everyEvent, wait = 0):
--- 472,477 ----
  						Events.mUpMask, 
  						10)
! 		if hasattr(MacOS, 'EnableAppswitch'):
! 			MacOS.EnableAppswitch(saveyield)
  	
  	def do1event(self, mask = Events.everyEvent, wait = 0):
***************
*** 487,493 ****
  	def do_key(self, event):
  		(what, message, when, where, modifiers) = event
! 		w = Win.FrontWindow()
! 		if w <> self.wid:
! 			return
  		c = chr(message & Events.charCodeMask)
  		if modifiers & Events.cmdKey:
--- 494,500 ----
  	def do_key(self, event):
  		(what, message, when, where, modifiers) = event
! 		#w = Win.FrontWindow()
! 		#if w <> self.wid:
! 		#	return
  		c = chr(message & Events.charCodeMask)
  		if modifiers & Events.cmdKey:
***************
*** 551,555 ****
  	import W
  	app = W.getapplication()
! 	wid = Win.FrontWindow()
  	if wid and app._windows.has_key(wid):
  		window = app._windows[wid]
--- 558,562 ----
  	import W
  	app = W.getapplication()
! 	wid = MyFrontWindow()
  	if wid and app._windows.has_key(wid):
  		window = app._windows[wid]
***************
*** 565,570 ****
  			1) == 1:
  		from Carbon import Scrap
! 		Scrap.ZeroScrap()
! 		Scrap.PutScrap('TEXT', stuff)
  
  
--- 572,582 ----
  			1) == 1:
  		from Carbon import Scrap
! 		if hasattr(Scrap, 'PutScrap'):
! 			Scrap.ZeroScrap()
! 			Scrap.PutScrap('TEXT', stuff)
! 		else:
! 			Scrap.ClearCurrentScrap()
! 			sc = Scrap.GetCurrentScrap()
! 			sc.PutScrapFlavor('TEXT', 0, stuff)