mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	Use FSpCreateResFile() in stead of CreateResFile().
Don't call OpenDeskAcc() and AppendResMenu() on Carbon.
This commit is contained in:
		
							parent
							
								
									bf21bef254
								
							
						
					
					
						commit
						01a2d9e281
					
				
					 9 changed files with 14 additions and 18 deletions
				
			
		|  | @ -14,6 +14,7 @@ | ||||||
| import Scrap | import Scrap | ||||||
| import os | import os | ||||||
| import macfs | import macfs | ||||||
|  | import MACFS | ||||||
| import regsub | import regsub | ||||||
| import string | import string | ||||||
| import htmllib | import htmllib | ||||||
|  | @ -243,7 +244,7 @@ def menu_save(self): | ||||||
| 		try: | 		try: | ||||||
| 			rf = Res.FSpOpenResFile(self.path, 3) | 			rf = Res.FSpOpenResFile(self.path, 3) | ||||||
| 		except Res.Error: | 		except Res.Error: | ||||||
| 			Res.CreateResFile(self.path) | 			Res.FSpCreateResFile(self.path, '????', 'TEXT', MACFS.smAllScripts) | ||||||
| 			rf = Res.FSpOpenResFile(self.path, 3) | 			rf = Res.FSpOpenResFile(self.path, 3) | ||||||
| 		styles = Res.Resource('') | 		styles = Res.Resource('') | ||||||
| 		soup = Res.Resource('') | 		soup = Res.Resource('') | ||||||
|  |  | ||||||
|  | @ -14,6 +14,7 @@ | ||||||
| import Scrap | import Scrap | ||||||
| import os | import os | ||||||
| import macfs | import macfs | ||||||
|  | import MACFS | ||||||
| 
 | 
 | ||||||
| UNDOLABELS = [ # Indexed by WEGetUndoInfo() value | UNDOLABELS = [ # Indexed by WEGetUndoInfo() value | ||||||
| 	None, "", "typing", "Cut", "Paste", "Clear", "Drag", "Style"] | 	None, "", "typing", "Cut", "Paste", "Clear", "Drag", "Style"] | ||||||
|  | @ -212,7 +213,7 @@ def menu_save(self): | ||||||
| 		try: | 		try: | ||||||
| 			rf = Res.FSpOpenResFile(self.path, 3) | 			rf = Res.FSpOpenResFile(self.path, 3) | ||||||
| 		except Res.Error: | 		except Res.Error: | ||||||
| 			Res.CreateResFile(self.path) | 			Res.FSpCreateResFile(self.path, '????', 'TEXT', MACFS.smAllScripts) | ||||||
| 			rf = Res.FSpOpenResFile(self.path, 3) | 			rf = Res.FSpOpenResFile(self.path, 3) | ||||||
| 		styles = Res.Resource('') | 		styles = Res.Resource('') | ||||||
| 		soup = Res.Resource('') | 		soup = Res.Resource('') | ||||||
|  |  | ||||||
|  | @ -674,12 +674,13 @@ def __init__(self, bar, abouttext="About me...", aboutcallback=None): | ||||||
| 		Menu.__init__(self, bar, "\024") | 		Menu.__init__(self, bar, "\024") | ||||||
| 		self.additem(abouttext, None, aboutcallback) | 		self.additem(abouttext, None, aboutcallback) | ||||||
| 		self.addseparator() | 		self.addseparator() | ||||||
|  | 		if MacOS.runtimemodel == 'ppc': | ||||||
| 			self.menu.AppendResMenu('DRVR') | 			self.menu.AppendResMenu('DRVR') | ||||||
| 	 | 	 | ||||||
| 	def dispatch(self, id, item, window, event): | 	def dispatch(self, id, item, window, event): | ||||||
| 		if item == 1: | 		if item == 1: | ||||||
| 			Menu.dispatch(self, id, item, window, event) | 			Menu.dispatch(self, id, item, window, event) | ||||||
| 		else: | 		elif MacOS.runtimemodel == 'ppc': | ||||||
| 			name = self.menu.GetMenuItemText(item) | 			name = self.menu.GetMenuItemText(item) | ||||||
| 			OpenDeskAcc(name) | 			OpenDeskAcc(name) | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -140,7 +140,7 @@ def process_common(template, progress, code, rsrcname, destname, is_update, copy | ||||||
| 	try: | 	try: | ||||||
| 		output = Res.FSpOpenResFile(dest_fss, WRITE) | 		output = Res.FSpOpenResFile(dest_fss, WRITE) | ||||||
| 	except MacOS.Error: | 	except MacOS.Error: | ||||||
| 		Res.CreateResFile(destname) | 		Res.FSpCreateResFile(destname, '????', 'APPL', MACFS.smAllScripts) | ||||||
| 		output = Res.FSpOpenResFile(dest_fss, WRITE) | 		output = Res.FSpOpenResFile(dest_fss, WRITE) | ||||||
| 	 | 	 | ||||||
| 	# Copy the resources from the target specific resource template, if any | 	# Copy the resources from the target specific resource template, if any | ||||||
|  |  | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| # Generated from 'Macintosh HD:SWDev:Metrowerks Codewarrior 6.0:Metrowerks CodeWarrior:MacOS Support:Universal:Interfaces:CIncludes:Menus.h' | # Generated from "Sap:Programma's:Metrowerks CodeWarrior 6.0:Metrowerks CodeWarrior:MacOS Support:Universal:Interfaces:CIncludes:Menus.h" | ||||||
| 
 | 
 | ||||||
| def FOUR_CHAR_CODE(x): return x | def FOUR_CHAR_CODE(x): return x | ||||||
| noMark = 0                              | noMark = 0                              | ||||||
|  |  | ||||||
|  | @ -36,6 +36,7 @@ def __init__(self): | ||||||
| 		Menu.ClearMenuBar() | 		Menu.ClearMenuBar() | ||||||
| 		self.applemenu = applemenu = Menu.NewMenu(self.appleid, "\024") | 		self.applemenu = applemenu = Menu.NewMenu(self.appleid, "\024") | ||||||
| 		applemenu.AppendMenu("%s;(-" % self.getaboutmenutext()) | 		applemenu.AppendMenu("%s;(-" % self.getaboutmenutext()) | ||||||
|  | 		if MacOS.runtimemodel == 'ppc': | ||||||
| 			applemenu.AppendResMenu('DRVR') | 			applemenu.AppendResMenu('DRVR') | ||||||
| 		applemenu.InsertMenu(0) | 		applemenu.InsertMenu(0) | ||||||
| 		self.quitmenu = Menu.NewMenu(self.quitid, "File") | 		self.quitmenu = Menu.NewMenu(self.quitid, "File") | ||||||
|  | @ -93,7 +94,7 @@ def lowlevelhandler(self, event): | ||||||
| 				if id == self.appleid: | 				if id == self.appleid: | ||||||
| 					if item == 1: | 					if item == 1: | ||||||
| 						EasyDialogs.Message(self.getabouttext()) | 						EasyDialogs.Message(self.getabouttext()) | ||||||
| 					elif item > 1: | 					elif item > 1 and hasattr(Menu, 'OpenDeskAcc'): | ||||||
| 						name = self.applemenu.GetMenuItemText(item) | 						name = self.applemenu.GetMenuItemText(item) | ||||||
| 						Menu.OpenDeskAcc(name) | 						Menu.OpenDeskAcc(name) | ||||||
| 				elif id == self.quitid and item == 1: | 				elif id == self.quitid and item == 1: | ||||||
|  |  | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| # Generated from 'Macintosh HD:SWDev:Metrowerks Codewarrior 6.0:Metrowerks CodeWarrior:MacOS Support:Universal:Interfaces:CIncludes:QuickDraw.h' | # Generated from "Sap:Programma's:Metrowerks CodeWarrior 6.0:Metrowerks CodeWarrior:MacOS Support:Universal:Interfaces:CIncludes:QuickDraw.h" | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| def FOUR_CHAR_CODE(x): return x | def FOUR_CHAR_CODE(x): return x | ||||||
|  | @ -173,7 +173,7 @@ def FOUR_CHAR_CODE(x): return x | ||||||
| kCursorComponentMove = 0x0008 | kCursorComponentMove = 0x0008 | ||||||
| kCursorComponentAnimate = 0x0009 | kCursorComponentAnimate = 0x0009 | ||||||
| kCursorComponentLastReserved = 0x0050 | kCursorComponentLastReserved = 0x0050 | ||||||
| # Generated from 'Macintosh HD:SWDev:Metrowerks Codewarrior 6.0:Metrowerks CodeWarrior:MacOS Support:Universal:Interfaces:CIncludes:QuickDrawText.h' | # Generated from "Sap:Programma's:Metrowerks CodeWarrior 6.0:Metrowerks CodeWarrior:MacOS Support:Universal:Interfaces:CIncludes:QuickDrawText.h" | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| def FOUR_CHAR_CODE(x): return x | def FOUR_CHAR_CODE(x): return x | ||||||
|  |  | ||||||
|  | @ -75,7 +75,6 @@ def __init__(self): | ||||||
| 		Menu.ClearMenuBar() | 		Menu.ClearMenuBar() | ||||||
| 		self.applemenu = applemenu = Menu.NewMenu(self.appleid, "\024") | 		self.applemenu = applemenu = Menu.NewMenu(self.appleid, "\024") | ||||||
| 		applemenu.AppendMenu("All about echo...;(-") | 		applemenu.AppendMenu("All about echo...;(-") | ||||||
| 		applemenu.AppendResMenu('DRVR') |  | ||||||
| 		applemenu.InsertMenu(0) | 		applemenu.InsertMenu(0) | ||||||
| 		 | 		 | ||||||
| 		self.filemenu = Menu.NewMenu(self.fileid, 'File') | 		self.filemenu = Menu.NewMenu(self.fileid, 'File') | ||||||
|  | @ -146,9 +145,6 @@ def menuhit(self, result): | ||||||
| 			if id == self.appleid: | 			if id == self.appleid: | ||||||
| 				if item == 1: | 				if item == 1: | ||||||
| 					mymessage("Echo -- echo AppleEvents") | 					mymessage("Echo -- echo AppleEvents") | ||||||
| 				elif item > 1: |  | ||||||
| 					name = self.applemenu.GetItem(item) |  | ||||||
| 					Qd.OpenDeskAcc(name) |  | ||||||
| 			elif id == self.fileid: | 			elif id == self.fileid: | ||||||
| 				if item == 1: | 				if item == 1: | ||||||
| 					raise Quit | 					raise Quit | ||||||
|  |  | ||||||
|  | @ -56,7 +56,6 @@ def __init__(self): | ||||||
| 		Menu.ClearMenuBar() | 		Menu.ClearMenuBar() | ||||||
| 		self.applemenu = applemenu = Menu.NewMenu(self.appleid, "\024") | 		self.applemenu = applemenu = Menu.NewMenu(self.appleid, "\024") | ||||||
| 		applemenu.AppendMenu("All about echo...;(-") | 		applemenu.AppendMenu("All about echo...;(-") | ||||||
| 		applemenu.AppendResMenu('DRVR') |  | ||||||
| 		applemenu.InsertMenu(0) | 		applemenu.InsertMenu(0) | ||||||
| 		Menu.DrawMenuBar() | 		Menu.DrawMenuBar() | ||||||
| 	 | 	 | ||||||
|  | @ -105,9 +104,6 @@ def lowlevelhandler(self, event): | ||||||
| 				if id == self.appleid: | 				if id == self.appleid: | ||||||
| 					if item == 1: | 					if item == 1: | ||||||
| 						mymessage("Echo -- echo AppleEvents") | 						mymessage("Echo -- echo AppleEvents") | ||||||
| 					elif item > 1: |  | ||||||
| 						name = self.applemenu.GetItem(item) |  | ||||||
| 						Qd.OpenDeskAcc(name) |  | ||||||
| 		elif what <> autoKey: | 		elif what <> autoKey: | ||||||
| 			print "Event:", (eventname(what), message, when, (h, v), modifiers) | 			print "Event:", (eventname(what), message, when, (h, v), modifiers) | ||||||
| ##			MacOS.HandleEvent(event) | ##			MacOS.HandleEvent(event) | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Jack Jansen
						Jack Jansen