aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/idlelib/ScriptBinding.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/idlelib/ScriptBinding.py')
-rw-r--r--Lib/idlelib/ScriptBinding.py19
1 files changed, 9 insertions, 10 deletions
diff --git a/Lib/idlelib/ScriptBinding.py b/Lib/idlelib/ScriptBinding.py
index 6bfe128e3ce..5cb818d833b 100644
--- a/Lib/idlelib/ScriptBinding.py
+++ b/Lib/idlelib/ScriptBinding.py
@@ -18,13 +18,10 @@ XXX GvR Redesign this interface (yet again) as follows:
"""
import os
-import re
-import string
import tabnanny
import tokenize
import tkinter.messagebox as tkMessageBox
-from idlelib.EditorWindow import EditorWindow
-from idlelib import PyShell, IOBinding
+from idlelib import PyShell
from idlelib.configHandler import idleConf
from idlelib import macosxSupport
@@ -39,6 +36,7 @@ To fix case 2, change all tabs to spaces by using Edit->Select All followed \
by Format->Untabify Region and specify the number of columns used by each tab.
"""
+
class ScriptBinding:
menudefs = [
@@ -53,7 +51,7 @@ class ScriptBinding:
self.flist = self.editwin.flist
self.root = self.editwin.root
- if macosxSupport.runningAsOSXApp():
+ if macosxSupport.isCocoaTk():
self.editwin.text_frame.bind('<<run-module-event-2>>', self._run_module_event)
def check_module_event(self, event):
@@ -71,7 +69,7 @@ class ScriptBinding:
try:
tabnanny.process_tokens(tokenize.generate_tokens(f.readline))
except tokenize.TokenError as msg:
- msgtxt, (lineno, start) = msg
+ msgtxt, (lineno, start) = msg.args
self.editwin.gotoline(lineno)
self.errorbox("Tabnanny Tokenizing Error",
"Token Error: %s" % msgtxt)
@@ -114,7 +112,7 @@ class ScriptBinding:
shell.set_warning_stream(saved_stream)
def run_module_event(self, event):
- if macosxSupport.runningAsOSXApp():
+ if macosxSupport.isCocoaTk():
# 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
@@ -145,7 +143,8 @@ class ScriptBinding:
return 'break'
interp = self.shell.interp
if PyShell.use_subprocess:
- interp.restart_subprocess(with_cwd=False)
+ interp.restart_subprocess(with_cwd=False, filename=
+ self.editwin._filename_to_unicode(filename))
dirname = os.path.dirname(filename)
# XXX Too often this discards arguments the user just set...
interp.runcommand("""if 1:
@@ -198,10 +197,10 @@ class ScriptBinding:
confirm = tkMessageBox.askokcancel(title="Save Before Run or Check",
message=msg,
default=tkMessageBox.OK,
- master=self.editwin.text)
+ parent=self.editwin.text)
return confirm
def errorbox(self, title, message):
# XXX This should really be a function of EditorWindow...
- tkMessageBox.showerror(title, message, master=self.editwin.text)
+ tkMessageBox.showerror(title, message, parent=self.editwin.text)
self.editwin.text.focus_set()