diff options
author | Ronald Oussoren <ronaldoussoren@mac.com> | 2009-02-12 15:01:44 (GMT) |
---|---|---|
committer | Ronald Oussoren <ronaldoussoren@mac.com> | 2009-02-12 15:01:44 (GMT) |
commit | 827822ef3f389548ca2ac11b11c5e498f45fe78a (patch) | |
tree | 94532be2aa8126ef966cff4f1f7c0d7d35871b37 /Lib/idlelib | |
parent | de09acf2984b6699aa7a45c2ea2429c6da5f046e (diff) | |
download | cpython-827822ef3f389548ca2ac11b11c5e498f45fe78a.zip cpython-827822ef3f389548ca2ac11b11c5e498f45fe78a.tar.gz cpython-827822ef3f389548ca2ac11b11c5e498f45fe78a.tar.bz2 |
Fix for issue5194, based on a patch by Ned Deily.
Diffstat (limited to 'Lib/idlelib')
-rw-r--r-- | Lib/idlelib/Bindings.py | 3 | ||||
-rw-r--r-- | Lib/idlelib/EditorWindow.py | 2 | ||||
-rw-r--r-- | Lib/idlelib/MultiCall.py | 3 | ||||
-rw-r--r-- | Lib/idlelib/keybindingDialog.py | 3 | ||||
-rw-r--r-- | Lib/idlelib/macosxSupport.py | 8 |
5 files changed, 13 insertions, 6 deletions
diff --git a/Lib/idlelib/Bindings.py b/Lib/idlelib/Bindings.py index 13e2a33..74a93d3 100644 --- a/Lib/idlelib/Bindings.py +++ b/Lib/idlelib/Bindings.py @@ -10,6 +10,7 @@ windows. """ import sys from idlelib.configHandler import idleConf +from idlelib import macosxSupport menudefs = [ # underscore prefixes character to underscore @@ -80,7 +81,7 @@ menudefs = [ ]), ] -if sys.platform == 'darwin' and '.app' in sys.executable: +if macosxSupport.runningAsOSXApp(): # Running as a proper MacOS application bundle. This block restructures # the menus a little to make them conform better to the HIG. diff --git a/Lib/idlelib/EditorWindow.py b/Lib/idlelib/EditorWindow.py index 1512c46..38ae7b6 100644 --- a/Lib/idlelib/EditorWindow.py +++ b/Lib/idlelib/EditorWindow.py @@ -363,7 +363,7 @@ class EditorWindow(object): underline, label = prepstr(label) menudict[name] = menu = Menu(mbar, name=name) mbar.add_cascade(label=label, menu=menu, underline=underline) - if sys.platform == 'darwin' and '.framework' in sys.executable: + if macosxSupport.runningAsOSXApp(): # Insert the application menu menudict['application'] = menu = Menu(mbar, name='apple') mbar.add_cascade(label='IDLE', menu=menu) diff --git a/Lib/idlelib/MultiCall.py b/Lib/idlelib/MultiCall.py index 1c40638..47f402d 100644 --- a/Lib/idlelib/MultiCall.py +++ b/Lib/idlelib/MultiCall.py @@ -32,6 +32,7 @@ Each function will be called at most once for each event. import sys import re import tkinter +from idlelib import macosxSupport # the event type constants, which define the meaning of mc_type MC_KEYPRESS=0; MC_KEYRELEASE=1; MC_BUTTONPRESS=2; MC_BUTTONRELEASE=3; @@ -44,7 +45,7 @@ MC_SHIFT = 1<<0; MC_CONTROL = 1<<2; MC_ALT = 1<<3; MC_META = 1<<5 MC_OPTION = 1<<6; MC_COMMAND = 1<<7 # define the list of modifiers, to be used in complex event types. -if sys.platform == "darwin" and sys.executable.count(".app"): +if macosxSupport.runningAsOSXApp(): _modifiers = (("Shift",), ("Control",), ("Option",), ("Command",)) _modifier_masks = (MC_SHIFT, MC_CONTROL, MC_OPTION, MC_COMMAND) else: diff --git a/Lib/idlelib/keybindingDialog.py b/Lib/idlelib/keybindingDialog.py index f5d32ef..b99c5e0 100644 --- a/Lib/idlelib/keybindingDialog.py +++ b/Lib/idlelib/keybindingDialog.py @@ -4,6 +4,7 @@ Dialog for building Tkinter accelerator key bindings from tkinter import * import tkinter.messagebox as tkMessageBox import string +from idlelib import macosxSupport class GetKeysDialog(Toplevel): def __init__(self,parent,title,action,currentKeySequences): @@ -133,7 +134,7 @@ class GetKeysDialog(Toplevel): config-keys.def must use the same ordering. """ import sys - if sys.platform == 'darwin' and sys.argv[0].count('.app'): + if macosxSupport.runningAsOSXApp(): self.modifiers = ['Shift', 'Control', 'Option', 'Command'] else: self.modifiers = ['Control', 'Alt', 'Shift'] diff --git a/Lib/idlelib/macosxSupport.py b/Lib/idlelib/macosxSupport.py index 9f92b6c..e759157 100644 --- a/Lib/idlelib/macosxSupport.py +++ b/Lib/idlelib/macosxSupport.py @@ -6,8 +6,12 @@ import sys import tkinter def runningAsOSXApp(): - """ Returns True iff running from the IDLE.app bundle on OSX """ - return (sys.platform == 'darwin' and 'IDLE.app' in sys.argv[0]) + """ + Returns True if Python is running from within an app on OSX. + If so, assume that Python was built with Aqua Tcl/Tk rather than + X11 Tck/Tk. + """ + return (sys.platform == 'darwin' and '.app' in sys.executable) def addOpenEventSupport(root, flist): """ |