summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib
diff options
context:
space:
mode:
authorRonald Oussoren <ronaldoussoren@mac.com>2009-03-04 21:35:38 (GMT)
committerRonald Oussoren <ronaldoussoren@mac.com>2009-03-04 21:35:38 (GMT)
commitde3dfc1635390678895fbfff9caef986357efab7 (patch)
tree8c3d8fa116aaa3f7062981c43313bf6a6445c6b2 /Lib/idlelib
parent5302a3011e06ad87b08855d37a230e45df596325 (diff)
downloadcpython-de3dfc1635390678895fbfff9caef986357efab7.zip
cpython-de3dfc1635390678895fbfff9caef986357efab7.tar.gz
cpython-de3dfc1635390678895fbfff9caef986357efab7.tar.bz2
Merged revisions 70176 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r70176 | ronald.oussoren | 2009-03-04 22:35:05 +0100 (Wed, 04 Mar 2009) | 2 lines Fixes issues 3883 and 5194 ........
Diffstat (limited to 'Lib/idlelib')
-rw-r--r--Lib/idlelib/Bindings.py4
-rw-r--r--Lib/idlelib/EditorWindow.py2
-rw-r--r--Lib/idlelib/MultiCall.py3
-rw-r--r--Lib/idlelib/configDialog.py16
-rw-r--r--Lib/idlelib/keybindingDialog.py4
-rw-r--r--Lib/idlelib/macosxSupport.py8
6 files changed, 25 insertions, 12 deletions
diff --git a/Lib/idlelib/Bindings.py b/Lib/idlelib/Bindings.py
index a3c9fc4..1853ff9 100644
--- a/Lib/idlelib/Bindings.py
+++ b/Lib/idlelib/Bindings.py
@@ -10,6 +10,7 @@ windows.
"""
import sys
from configHandler import idleConf
+import macosxSupport
menudefs = [
# underscore prefixes character to underscore
@@ -80,8 +81,7 @@ menudefs = [
]),
]
-import sys
-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 8d35198c..104b63b 100644
--- a/Lib/idlelib/EditorWindow.py
+++ b/Lib/idlelib/EditorWindow.py
@@ -368,7 +368,7 @@ class EditorWindow(object):
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 51de639..b228f57 100644
--- a/Lib/idlelib/MultiCall.py
+++ b/Lib/idlelib/MultiCall.py
@@ -33,6 +33,7 @@ import sys
import string
import re
import Tkinter
+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;
@@ -45,7 +46,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/configDialog.py b/Lib/idlelib/configDialog.py
index acab053..2f66d09 100644
--- a/Lib/idlelib/configDialog.py
+++ b/Lib/idlelib/configDialog.py
@@ -19,6 +19,7 @@ from tabbedpages import TabbedPageSet
from keybindingDialog import GetKeysDialog
from configSectionNameDialog import GetCfgSectionNameDialog
from configHelpSourceEdit import GetHelpSourceDialog
+import macosxSupport
class ConfigDialog(Toplevel):
@@ -69,18 +70,25 @@ class ConfigDialog(Toplevel):
page_names=['Fonts/Tabs','Highlighting','Keys','General'])
frameActionButtons = Frame(self,pady=2)
#action buttons
+ if macosxSupport.runningAsOSXApp():
+ # Changing the default padding on OSX results in unreadable
+ # text in the buttons
+ paddingArgs={}
+ else:
+ paddingArgs={'padx':6, 'pady':3}
+
self.buttonHelp = Button(frameActionButtons,text='Help',
command=self.Help,takefocus=FALSE,
- padx=6,pady=3)
+ **paddingArgs)
self.buttonOk = Button(frameActionButtons,text='Ok',
command=self.Ok,takefocus=FALSE,
- padx=6,pady=3)
+ **paddingArgs)
self.buttonApply = Button(frameActionButtons,text='Apply',
command=self.Apply,takefocus=FALSE,
- padx=6,pady=3)
+ **paddingArgs)
self.buttonCancel = Button(frameActionButtons,text='Cancel',
command=self.Cancel,takefocus=FALSE,
- padx=6,pady=3)
+ **paddingArgs)
self.CreatePageFontTab()
self.CreatePageHighlight()
self.CreatePageKeys()
diff --git a/Lib/idlelib/keybindingDialog.py b/Lib/idlelib/keybindingDialog.py
index 1ce7ff4..d6d1f18 100644
--- a/Lib/idlelib/keybindingDialog.py
+++ b/Lib/idlelib/keybindingDialog.py
@@ -132,8 +132,8 @@ class GetKeysDialog(Toplevel):
order is also important: key binding equality depends on it, so
config-keys.def must use the same ordering.
"""
- import sys
- if sys.platform == 'darwin' and sys.argv[0].count('.app'):
+ import macosxSupport
+ 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 279b1cc..98b35b6 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):
"""