mirror of
				https://github.com/python/cpython.git
				synced 2025-11-01 06:01:29 +00:00 
			
		
		
		
	Patch 1693258: Fix for duplicate "preferences" menu-OS X
This commit is contained in:
		
							parent
							
								
									e3b185f966
								
							
						
					
					
						commit
						9b0bcc1f4b
					
				
					 1 changed files with 31 additions and 18 deletions
				
			
		|  | @ -3,6 +3,7 @@ | ||||||
| GUI application (as opposed to an X11 application). | GUI application (as opposed to an X11 application). | ||||||
| """ | """ | ||||||
| import sys | import sys | ||||||
|  | import Tkinter | ||||||
| 
 | 
 | ||||||
| def runningAsOSXApp(): | def runningAsOSXApp(): | ||||||
|     """ Returns True iff running from the IDLE.app bundle on OSX """ |     """ Returns True iff running from the IDLE.app bundle on OSX """ | ||||||
|  | @ -23,7 +24,11 @@ def doOpenFile(*args): | ||||||
|     root.createcommand("::tk::mac::OpenDocument", doOpenFile) |     root.createcommand("::tk::mac::OpenDocument", doOpenFile) | ||||||
| 
 | 
 | ||||||
| def hideTkConsole(root): | def hideTkConsole(root): | ||||||
|  |     try: | ||||||
|         root.tk.call('console', 'hide') |         root.tk.call('console', 'hide') | ||||||
|  |     except Tkinter.TclError: | ||||||
|  |         # Some versions of the Tk framework don't have a console object | ||||||
|  |         pass | ||||||
| 
 | 
 | ||||||
| def overrideRootMenu(root, flist): | def overrideRootMenu(root, flist): | ||||||
|     """ |     """ | ||||||
|  | @ -75,15 +80,27 @@ def config_dialog(event=None): | ||||||
|         import configDialog |         import configDialog | ||||||
|         configDialog.ConfigDialog(root, 'Settings') |         configDialog.ConfigDialog(root, 'Settings') | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
|     root.bind('<<about-idle>>', about_dialog) |     root.bind('<<about-idle>>', about_dialog) | ||||||
|     root.bind('<<open-config-dialog>>', config_dialog) |     root.bind('<<open-config-dialog>>', config_dialog) | ||||||
|     if flist: |     if flist: | ||||||
|         root.bind('<<close-all-windows>>', flist.close_all_callback) |         root.bind('<<close-all-windows>>', flist.close_all_callback) | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
|  |     ###check if Tk version >= 8.4.14; if so, use hard-coded showprefs binding | ||||||
|  |     tkversion = root.tk.eval('info patchlevel') | ||||||
|  |     if tkversion >= '8.4.14': | ||||||
|  |         Bindings.menudefs[0] =  ('application', [ | ||||||
|  |                 ('About IDLE', '<<about-idle>>'), | ||||||
|  |                 None, | ||||||
|  |             ]) | ||||||
|  |         root.createcommand('::tk::mac::ShowPreferences', config_dialog) | ||||||
|  |     else: | ||||||
|         for mname, entrylist in Bindings.menudefs: |         for mname, entrylist in Bindings.menudefs: | ||||||
|             menu = menudict.get(mname) |             menu = menudict.get(mname) | ||||||
|             if not menu: |             if not menu: | ||||||
|                 continue |                 continue | ||||||
|  |             else: | ||||||
|                 for entry in entrylist: |                 for entry in entrylist: | ||||||
|                     if not entry: |                     if not entry: | ||||||
|                         menu.add_separator() |                         menu.add_separator() | ||||||
|  | @ -97,10 +114,6 @@ def command(text=root, eventname=eventname): | ||||||
|                         menu.add_command(label=label, underline=underline, |                         menu.add_command(label=label, underline=underline, | ||||||
|                         command=command, accelerator=accelerator) |                         command=command, accelerator=accelerator) | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| def setupApp(root, flist): | def setupApp(root, flist): | ||||||
|     """ |     """ | ||||||
|     Perform setup for the OSX application bundle. |     Perform setup for the OSX application bundle. | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Ronald Oussoren
						Ronald Oussoren