[Python-checkins] CVS: python/dist/src/Mac/Lib FrameWork.py,1.45,1.46

Jack Jansen jackjansen@users.sourceforge.net
Mon, 10 Dec 2001 08:08:16 -0800


Update of /cvsroot/python/python/dist/src/Mac/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv13006/python/Mac/Lib

Modified Files:
	FrameWork.py 
Log Message:
The new menu initialization code would also add the SIOUX menus if a (frozen) Python program had installed its own menubar previously. We now guard against this, with a bit of a hack: FrameWork uses the same Menu ID as Sioux, and the init code checks that the text in the menu is "About SIOUX" before replacing it.

Index: FrameWork.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Lib/FrameWork.py,v
retrieving revision 1.45
retrieving revision 1.46
diff -C2 -d -r1.45 -r1.46
*** FrameWork.py	2001/08/25 12:04:51	1.45
--- FrameWork.py	2001/12/10 16:08:14	1.46
***************
*** 31,35 ****
--- 31,38 ----
  SCROLLBARWIDTH = 16		# Again, not a clue...
  
+ # Trick to forestall a set of SIOUX menus being added to our menubar
+ SIOUX_APPLEMENU_ID=32000
  
+ 
  # Map event 'what' field to strings
  eventname = {}
***************
*** 443,448 ****
  		self.menus = None
  	
! 	def addmenu(self, title, after = 0):
! 		id = self.getnextid()
  		if DEBUG: print 'Newmenu', title, id # XXXX
  		m = NewMenu(id, title)
--- 446,452 ----
  		self.menus = None
  	
! 	def addmenu(self, title, after = 0, id=None):
! 		if id == None:
! 			id = self.getnextid()
  		if DEBUG: print 'Newmenu', title, id # XXXX
  		m = NewMenu(id, title)
***************
*** 508,514 ****
  	"One menu."
  	
! 	def __init__(self, bar, title, after=0):
  		self.bar = bar
! 		self.id, self.menu = self.bar.addmenu(title, after)
  		bar.menus[self.id] = self
  		self.items = []
--- 512,518 ----
  	"One menu."
  	
! 	def __init__(self, bar, title, after=0, id=None):
  		self.bar = bar
! 		self.id, self.menu = self.bar.addmenu(title, after, id)
  		bar.menus[self.id] = self
  		self.items = []
***************
*** 676,680 ****
  	
  	def __init__(self, bar, abouttext="About me...", aboutcallback=None):
! 		Menu.__init__(self, bar, "\024")
  		if MacOS.runtimemodel == 'ppc':
  			self.additem(abouttext, None, aboutcallback)
--- 680,684 ----
  	
  	def __init__(self, bar, abouttext="About me...", aboutcallback=None):
! 		Menu.__init__(self, bar, "\024", id=SIOUX_APPLEMENU_ID)
  		if MacOS.runtimemodel == 'ppc':
  			self.additem(abouttext, None, aboutcallback)