summaryrefslogtreecommitdiff
path: root/Lib/idlelib/ScriptBinding.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2011-05-17 18:32:26 -0500
committerBenjamin Peterson <benjamin@python.org>2011-05-17 18:32:26 -0500
commitd021f72abfbff732fdb25da7965fe0316a86c3b3 (patch)
treef255e7db3b357ac3301cc9440f29dc1de4bc699e /Lib/idlelib/ScriptBinding.py
parent6116d4a1d1ecd6e9b94cfaa524b9b7cd5a6b5447 (diff)
parent2c5e28ebc21b8517cfaa3075dabb81f963be0303 (diff)
downloadcpython-git-d021f72abfbff732fdb25da7965fe0316a86c3b3.tar.gz
merge heads
Diffstat (limited to 'Lib/idlelib/ScriptBinding.py')
-rw-r--r--Lib/idlelib/ScriptBinding.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/Lib/idlelib/ScriptBinding.py b/Lib/idlelib/ScriptBinding.py
index 9a16e3c779..1139b30784 100644
--- a/Lib/idlelib/ScriptBinding.py
+++ b/Lib/idlelib/ScriptBinding.py
@@ -26,6 +26,7 @@ import tkMessageBox
from idlelib import PyShell
from idlelib.configHandler import idleConf
+from idlelib import macosxSupport
IDENTCHARS = string.ascii_letters + string.digits + "_"
@@ -53,6 +54,9 @@ class ScriptBinding:
self.flist = self.editwin.flist
self.root = self.editwin.root
+ if macosxSupport.runningAsOSXApp():
+ self.editwin.text_frame.bind('<<run-module-event-2>>', self._run_module_event)
+
def check_module_event(self, event):
filename = self.getfilename()
if not filename:
@@ -166,6 +170,19 @@ class ScriptBinding:
interp.runcode(code)
return 'break'
+ if macosxSupport.runningAsOSXApp():
+ # Tk-Cocoa in MacOSX is broken until at least
+ # Tk 8.5.9, and without this rather
+ # crude workaround IDLE would hang when a user
+ # tries to run a module using the keyboard shortcut
+ # (the menu item works fine).
+ _run_module_event = run_module_event
+
+ def run_module_event(self, event):
+ self.editwin.text_frame.after(200,
+ lambda: self.editwin.text_frame.event_generate('<<run-module-event-2>>'))
+ return 'break'
+
def getfilename(self):
"""Get source filename. If not saved, offer to save (or create) file