summaryrefslogtreecommitdiffstats
path: root/Tools/idle/EditorWindow.py
diff options
context:
space:
mode:
Diffstat (limited to 'Tools/idle/EditorWindow.py')
-rw-r--r--Tools/idle/EditorWindow.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/Tools/idle/EditorWindow.py b/Tools/idle/EditorWindow.py
index e8b63ff..c0ae556 100644
--- a/Tools/idle/EditorWindow.py
+++ b/Tools/idle/EditorWindow.py
@@ -1,6 +1,5 @@
import sys
import os
-import string
import re
import imp
from Tkinter import *
@@ -221,7 +220,7 @@ class EditorWindow:
self.text.after_idle(self.set_line_and_column)
def set_line_and_column(self, event=None):
- line, column = string.split(self.text.index(INSERT), '.')
+ line, column = self.text.index(INSERT).split('.')
self.status_bar.set_label('column', 'Col: %s' % column)
self.status_bar.set_label('line', 'Ln: %s' % line)
@@ -344,14 +343,14 @@ class EditorWindow:
except TclError:
name = ""
else:
- name = string.strip(name)
+ name = name.strip()
if not name:
name = tkSimpleDialog.askstring("Module",
"Enter the name of a Python module\n"
"to search on sys.path and open:",
parent=self.text)
if name:
- name = string.strip(name)
+ name = name.strip()
if not name:
return
# XXX Ought to insert current file's directory in front of path
@@ -408,7 +407,7 @@ class EditorWindow:
f.close()
except IOError:
return False
- return line[:2] == '#!' and string.find(line, 'python') >= 0
+ return line.startswith('#!') and 'python' in line
def close_hook(self):
if self.flist:
@@ -580,7 +579,7 @@ class EditorWindow:
if keydefs:
self.apply_bindings(keydefs)
for vevent in keydefs.keys():
- methodname = string.replace(vevent, "-", "_")
+ methodname = vevent.replace("-", "_")
while methodname[:1] == '<':
methodname = methodname[1:]
while methodname[-1:] == '>':
@@ -700,7 +699,7 @@ class EditorWindow:
def prepstr(s):
# Helper to extract the underscore from a string, e.g.
# prepstr("Co_py") returns (2, "Copy").
- i = string.find(s, '_')
+ i = s.find('_')
if i >= 0:
s = s[:i] + s[i+1:]
return i, s
@@ -717,7 +716,7 @@ def get_accelerator(keydefs, event):
if not keylist:
return ""
s = keylist[0]
- s = re.sub(r"-[a-z]\b", lambda m: string.upper(m.group()), s)
+ s = re.sub(r"-[a-z]\b", lambda m: m.group().upper(), s)
s = re.sub(r"\b\w+\b", lambda m: keynames.get(m.group(), m.group()), s)
s = re.sub("Key-", "", s)
s = re.sub("Control-", "Ctrl-", s)