]> granicus.if.org Git - python/commitdiff
Patch 543222. Disable script bindings in shell window.
authorRaymond Hettinger <python@rcn.com>
Tue, 21 May 2002 17:00:20 +0000 (17:00 +0000)
committerRaymond Hettinger <python@rcn.com>
Tue, 21 May 2002 17:00:20 +0000 (17:00 +0000)
Tools/idle/EditorWindow.py
Tools/idle/PyShell.py
Tools/idle/ScriptBinding.py

index 47d2242a4d410637e93db944ca4aa7475f554777..9535261f5c0be7395baa2748ca2bb03f7104c542 100644 (file)
@@ -95,6 +95,7 @@ class EditorWindow:
     about_text = about_text
 
     vars = {}
+    runnable = False    # Shell window cannot Import Module or Run Script
 
     def __init__(self, flist=None, filename=None, key=None, root=None):
         edconf = idleconf.getsection('EditorWindow')
index 2c471dee27985d5ef2907113d3e0de0e2e622804..cf854d3c3b389f4362e525cae133e29b14e68a01 100644 (file)
@@ -76,6 +76,7 @@ class PyShellEditorWindow(EditorWindow):
 
     # Regular text edit window when a shell is present
     # XXX ought to merge with regular editor window
+    runnable = True  # Shell not present, enable Import Module and Run Script
 
     def __init__(self, *args):
         apply(EditorWindow.__init__, (self,) + args)
index 4071681b7fd16864b7bcb1ae1523c81f53981233..19a20b259d4e0bd876a4a134129c3c4422363a78 100644 (file)
@@ -51,6 +51,9 @@ class ScriptBinding:
     ]
 
     def __init__(self, editwin):
+        if not editwin.runnable:
+            self.menudefs = []
+            self.keydefs = {}        
         self.editwin = editwin
         # Provide instance variables referenced by Debugger
         # XXX This should be done differently