[Python-checkins] CVS: python/dist/src/Mac/Tools/IDE PyConsole.py,1.9,1.10 PyDebugger.py,1.8,1.9 PyDocSearch.py,1.8,1.9 PyEdit.py,1.26,1.27 PythonIDE.py,1.8,1.9 PythonIDEMain.py,1.14,1.15 Wapplication.py,1.14,1.15 Wwindows.py,1.14,1.15

Jack Jansen jackjansen@users.sourceforge.net
2002年1月21日 15:00:55 -0800


Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE
In directory usw-pr-cvs1:/tmp/cvs-serv6050
Modified Files:
	PyConsole.py PyDebugger.py PyDocSearch.py PyEdit.py 
	PythonIDE.py PythonIDEMain.py Wapplication.py Wwindows.py 
Log Message:
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: PyConsole.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/PyConsole.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** PyConsole.py	2001年12月27日 10:29:07	1.9
--- PyConsole.py	2002年01月21日 23:00:52	1.10
***************
*** 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
***************
*** 276,280 ****
 	
 	def write(self, text):
! 		oldyield = MacOS.EnableAppswitch(-1)
 		try:
 			self._buf = self._buf + text
--- 278,283 ----
 	
 	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):
--- 285,290 ----
 				self.flush()
 		finally:
! 			if hasattr(MacOS, 'EnableAppswitch'):
! 				MacOS.EnableAppswitch(oldyield)
 	
 	def flush(self):
Index: PyDebugger.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/PyDebugger.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** PyDebugger.py	2001年11月18日 14:12:43	1.8
--- PyDebugger.py	2002年01月21日 23:00:52	1.9
***************
*** 497,501 ****
 		try:
 			try:
! 				MacOS.EnableAppswitch(0)
 				if self.quitting:
 					# returning None is not enough, a former BdbQuit exception
--- 497,502 ----
 		try:
 			try:
! 				if hasattr(MacOS, 'EnableAppswitch'):
! 					MacOS.EnableAppswitch(0)
 				if self.quitting:
 					# returning None is not enough, a former BdbQuit exception
***************
*** 513,517 ****
 				return self.trace_dispatch
 			finally:
! 				MacOS.EnableAppswitch(-1)
 		except KeyboardInterrupt:
 			self.set_step()
--- 514,519 ----
 				return self.trace_dispatch
 			finally:
! 				if hasattr(MacOS, 'EnableAppswitch'):
! 					MacOS.EnableAppswitch(-1)
 		except KeyboardInterrupt:
 			self.set_step()
Index: PyDocSearch.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/PyDocSearch.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** PyDocSearch.py	2001年12月03日 19:27:38	1.8
--- PyDocSearch.py	2002年01月21日 23:00:52	1.9
***************
*** 123,127 ****
 	hits = {}
 	try:
! 		MacOS.EnableAppswitch(0)
 		try:
 			for do, name in books:
--- 123,128 ----
 	hits = {}
 	try:
! 		if hasattr(MacOS, 'EnableAppswitch'):
! 			MacOS.EnableAppswitch(0)
 		try:
 			for do, name in books:
***************
*** 146,150 ****
 						hits[fullpath] = filehits
 		finally:
! 			MacOS.EnableAppswitch(-1)
 			status.close()
 	except KeyboardInterrupt:
--- 147,152 ----
 						hits[fullpath] = filehits
 		finally:
! 			if hasattr(MacOS, 'EnableAppswitch'):
! 				MacOS.EnableAppswitch(-1)
 			status.close()
 	except KeyboardInterrupt:
Index: PyEdit.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/PyEdit.py,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** PyEdit.py	2001年11月18日 14:12:43	1.26
--- PyEdit.py	2002年01月21日 23:00:52	1.27
***************
*** 1129,1133 ****
 				PyDebugger.startfromhere()
 		elif not haveThreading:
! 			MacOS.EnableAppswitch(0)
 		try:
 			if profiling:
--- 1129,1134 ----
 				PyDebugger.startfromhere()
 		elif not haveThreading:
! 			if hasattr(MacOS, 'EnableAppswitch'):
! 				MacOS.EnableAppswitch(0)
 		try:
 			if profiling:
***************
*** 1146,1150 ****
 		finally:
 			if not haveThreading:
! 				MacOS.EnableAppswitch(-1)
 	except W.AlertError, detail:
 		raise W.AlertError, detail
--- 1147,1152 ----
 		finally:
 			if not haveThreading:
! 				if hasattr(MacOS, 'EnableAppswitch'):
! 					MacOS.EnableAppswitch(-1)
 	except W.AlertError, detail:
 		raise W.AlertError, detail
Index: PythonIDE.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/PythonIDE.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** PythonIDE.py	2001年08月27日 21:39:22	1.8
--- PythonIDE.py	2002年01月21日 23:00:52	1.9
***************
*** 5,13 ****
 
 __version__ = '1.0.1'
! 
 
 def init():
 	import MacOS
! 	MacOS.EnableAppswitch(-1)
 	
 	from Carbon import Qd, QuickDraw
--- 5,15 ----
 
 __version__ = '1.0.1'
! import sys
! import os
 
 def init():
 	import MacOS
! 	if hasattr(MacOS, 'EnableAppswitch'):
! 		MacOS.EnableAppswitch(-1)
 	
 	from Carbon import Qd, QuickDraw
***************
*** 17,25 ****
 	import sys, os
 	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 are a fully frozen application
--- 19,29 ----
 	import sys, os
 	macresource.need('DITL', 468, "PythonIDE.rsrc")
! 	widgetrespathsegs = [sys.exec_prefix, "Mac", "Tools", "IDE", "Widgets.rsrc"]
! 	widgetresfile = os.path.join(*widgetrespathsegs)
 	refno = macresource.need('CURS', 468, widgetresfile)
 	if refno:
 		# We're not a fullblown application
! 		idepathsegs = [sys.exec_prefix, "Mac", "Tools", "IDE"]
! 		ide_path = os.path.join(*idepathsegs)
 	else:
 		# We are a fully frozen application
Index: PythonIDEMain.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/PythonIDEMain.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** PythonIDEMain.py	2001年11月02日 19:30:21	1.14
--- PythonIDEMain.py	2002年01月21日 23:00:52	1.15
***************
*** 8,12 ****
--- 8,17 ----
 import os
 import macfs
+ import MacOS
 
+ if MacOS.runtimemodel == 'macho':
+ 	ELIPSES = '...'
+ else:
+ 	ELIPSES = '\xc9'
 
 class PythonIDE(Wapplication.Application):
***************
*** 51,61 ****
 		m = Wapplication.Menu(self.menubar, "File")
 		newitem = FrameWork.MenuItem(m, "New", "N", 'new')
! 		openitem = FrameWork.MenuItem(m, "Open\xc9", "O", 'open')
 		FrameWork.Separator(m)
 		closeitem = FrameWork.MenuItem(m, "Close", "W", 'close')
 		saveitem = FrameWork.MenuItem(m, "Save", "S", 'save')
! 		saveasitem = FrameWork.MenuItem(m, "Save as\xc9", None, 'save_as')
 		FrameWork.Separator(m)
! 		saveasappletitem = FrameWork.MenuItem(m, "Save as Applet\xc9", None, 'save_as_applet')
 		FrameWork.Separator(m)
 		quititem = FrameWork.MenuItem(m, "Quit", "Q", 'quit')
--- 56,66 ----
 		m = Wapplication.Menu(self.menubar, "File")
 		newitem = FrameWork.MenuItem(m, "New", "N", 'new')
! 		openitem = FrameWork.MenuItem(m, "Open"+ELIPSES, "O", 'open')
 		FrameWork.Separator(m)
 		closeitem = FrameWork.MenuItem(m, "Close", "W", 'close')
 		saveitem = FrameWork.MenuItem(m, "Save", "S", 'save')
! 		saveasitem = FrameWork.MenuItem(m, "Save as"+ELIPSES, None, 'save_as')
 		FrameWork.Separator(m)
! 		saveasappletitem = FrameWork.MenuItem(m, "Save as Applet"+ELIPSES, None, 'save_as_applet')
 		FrameWork.Separator(m)
 		quititem = FrameWork.MenuItem(m, "Quit", "Q", 'quit')
***************
*** 72,76 ****
 		sellineitem = FrameWork.MenuItem(m, "Select line", "L", "selectline")
 		FrameWork.Separator(m)
! 		finditem = FrameWork.MenuItem(m, "Find\xc9", "F", "find")
 		findagainitem = FrameWork.MenuItem(m, "Find again", 'G', "findnext")
 		enterselitem = FrameWork.MenuItem(m, "Enter search string", "E", "entersearchstring")
--- 77,81 ----
 		sellineitem = FrameWork.MenuItem(m, "Select line", "L", "selectline")
 		FrameWork.Separator(m)
! 		finditem = FrameWork.MenuItem(m, "Find"+ELIPSES, "F", "find")
 		findagainitem = FrameWork.MenuItem(m, "Find again", 'G', "findnext")
 		enterselitem = FrameWork.MenuItem(m, "Enter search string", "E", "entersearchstring")
***************
*** 85,94 ****
 		runselitem = FrameWork.MenuItem(m, "Run selection", None, 'runselection')
 		FrameWork.Separator(m)
! 		moditem = FrameWork.MenuItem(m, "Module browser\xc9", "M", self.domenu_modulebrowser)
 		FrameWork.Separator(m)
 		mm = FrameWork.SubMenu(m, "Preferences")
! 		FrameWork.MenuItem(mm, "Set Scripts folder\xc9", None, self.do_setscriptsfolder)
! 		FrameWork.MenuItem(mm, "Editor default settings\xc9", None, self.do_editorprefs)
! 		FrameWork.MenuItem(mm, "Set default window font\xc9", None, self.do_setwindowfont)
 		
 		self.openwindowsmenu = Wapplication.Menu(self.menubar, 'Windows')
--- 90,99 ----
 		runselitem = FrameWork.MenuItem(m, "Run selection", None, 'runselection')
 		FrameWork.Separator(m)
! 		moditem = FrameWork.MenuItem(m, "Module browser"+ELIPSES, "M", self.domenu_modulebrowser)
 		FrameWork.Separator(m)
 		mm = FrameWork.SubMenu(m, "Preferences")
! 		FrameWork.MenuItem(mm, "Set Scripts folder"+ELIPSES, None, self.do_setscriptsfolder)
! 		FrameWork.MenuItem(mm, "Editor default settings"+ELIPSES, None, self.do_editorprefs)
! 		FrameWork.MenuItem(mm, "Set default window font"+ELIPSES, None, self.do_setwindowfont)
 		
 		self.openwindowsmenu = Wapplication.Menu(self.menubar, 'Windows')
***************
*** 111,115 ****
 				if not os.path.exists(path):
 					os.mkdir(path)
! 					f = open(os.path.join(path, "Place your scripts here\xc9"), "w")
 					f.close()
 			fss = macfs.FSSpec(path)
--- 116,120 ----
 				if not os.path.exists(path):
 					os.mkdir(path)
! 					f = open(os.path.join(path, "Place your scripts here"+ELIPSES), "w")
 					f.close()
 			fss = macfs.FSSpec(path)
***************
*** 160,164 ****
 	
 	def getabouttext(self):
! 		return "About Python IDE\xc9"
 	
 	def do_about(self, id, item, window, event):
--- 165,169 ----
 	
 	def getabouttext(self):
! 		return "About Python IDE"+ELIPSES
 	
 	def do_about(self, id, item, window, event):
Index: Wapplication.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/Wapplication.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** Wapplication.py	2001年11月18日 14:12:43	1.14
--- Wapplication.py	2002年01月21日 23:00:52	1.15
***************
*** 29,33 ****
 		import W
 		self.quitting = 0
! 		saveyield = MacOS.EnableAppswitch(-1)
 		try:
 			while not self.quitting:
--- 29,34 ----
 		import W
 		self.quitting = 0
! 		if hasattr(MacOS, 'EnableAppswitch'):
! 			saveyield = MacOS.EnableAppswitch(-1)
 		try:
 			while not self.quitting:
***************
*** 35,53 ****
 					self.do1event(mask, wait)
 				except W.AlertError, detail:
! 					MacOS.EnableAppswitch(-1)
 					W.Message(detail)
 				except self.DebuggerQuit:
! 					MacOS.EnableAppswitch(-1)
 				except:
! 					MacOS.EnableAppswitch(-1)
 					import PyEdit
 					PyEdit.tracebackwindow.traceback()
 		finally:
! 			MacOS.EnableAppswitch(1)
 	
 	def debugger_mainloop(self, mask=FrameWork.everyEvent, wait=None):
 		import W
 		self.debugger_quitting = 0
! 		saveyield = MacOS.EnableAppswitch(-1)
 		try:
 			while not self.quitting and not self.debugger_quitting:
--- 36,59 ----
 					self.do1event(mask, wait)
 				except W.AlertError, detail:
! 					if hasattr(MacOS, 'EnableAppswitch'):
! 						MacOS.EnableAppswitch(-1)
 					W.Message(detail)
 				except self.DebuggerQuit:
! 					if hasattr(MacOS, 'EnableAppswitch'):
! 						MacOS.EnableAppswitch(-1)
 				except:
! 					if hasattr(MacOS, 'EnableAppswitch'):
! 						MacOS.EnableAppswitch(-1)
 					import PyEdit
 					PyEdit.tracebackwindow.traceback()
 		finally:
! 			if hasattr(MacOS, 'EnableAppswitch'):
! 				MacOS.EnableAppswitch(1)
 	
 	def debugger_mainloop(self, mask=FrameWork.everyEvent, wait=None):
 		import W
 		self.debugger_quitting = 0
! 		if hasattr(MacOS, 'EnableAppswitch'):
! 			saveyield = MacOS.EnableAppswitch(-1)
 		try:
 			while not self.quitting and not self.debugger_quitting:
***************
*** 60,64 ****
 					PyEdit.tracebackwindow.traceback()
 		finally:
! 			MacOS.EnableAppswitch(saveyield)
 	
 	def breathe(self, wait=1):
--- 66,71 ----
 					PyEdit.tracebackwindow.traceback()
 		finally:
! 			if hasattr(MacOS, 'EnableAppswitch'):
! 				MacOS.EnableAppswitch(saveyield)
 	
 	def breathe(self, wait=1):
***************
*** 310,326 ****
 				# xxx what to do when it's not saved???
 				# promt to save?
! 				MacOS.EnableAppswitch(0)
 				execfile(path, {'__name__': '__main__', '__file__': path})
 			except W.AlertError, detail:
! 				MacOS.EnableAppswitch(-1)
 				raise W.AlertError, detail
 			except KeyboardInterrupt:
! 				MacOS.EnableAppswitch(-1)
 			except:
! 				MacOS.EnableAppswitch(-1)
 				import PyEdit
 				PyEdit.tracebackwindow.traceback(1)
 			else:
! 				MacOS.EnableAppswitch(-1)
 			#os.chdir(cwd)
 	
--- 317,338 ----
 				# xxx what to do when it's not saved???
 				# promt to save?
! 				if hasattr(MacOS, 'EnableAppswitch'):
! 					MacOS.EnableAppswitch(0)
 				execfile(path, {'__name__': '__main__', '__file__': path})
 			except W.AlertError, detail:
! 				if hasattr(MacOS, 'EnableAppswitch'):
! 					MacOS.EnableAppswitch(-1)
 				raise W.AlertError, detail
 			except KeyboardInterrupt:
! 				if hasattr(MacOS, 'EnableAppswitch'):
! 					MacOS.EnableAppswitch(-1)
 			except:
! 				if hasattr(MacOS, 'EnableAppswitch'):
! 					MacOS.EnableAppswitch(-1)
 				import PyEdit
 				PyEdit.tracebackwindow.traceback(1)
 			else:
! 				if hasattr(MacOS, 'EnableAppswitch'):
! 					MacOS.EnableAppswitch(-1)
 			#os.chdir(cwd)
 	
Index: Wwindows.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/Wwindows.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** Wwindows.py	2001年12月31日 14:52:59	1.14
--- Wwindows.py	2002年01月21日 23:00:52	1.15
***************
*** 456,460 ****
 	
 	def mainloop(self):
! 		saveyield = MacOS.EnableAppswitch(-1)
 		while not self.done:
 			#self.do1event()
--- 456,461 ----
 	
 	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):
--- 467,472 ----
 						Events.mUpMask, 
 						10)
! 		if hasattr(MacOS, 'EnableAppswitch'):
! 			MacOS.EnableAppswitch(saveyield)
 	
 	def do1event(self, mask = Events.everyEvent, wait = 0):

AltStyle によって変換されたページ (->オリジナル) /