diff options
author | Walter Dörwald <walter@livinglogic.de> | 2002-09-11 20:36:02 (GMT) |
---|---|---|
committer | Walter Dörwald <walter@livinglogic.de> | 2002-09-11 20:36:02 (GMT) |
commit | aaab30e00cc3e8d90c71b8657c284feeb4ac1413 (patch) | |
tree | d055e0bd374770014d9afdff1b961418b1828584 /Tools/idle/EditorWindow.py | |
parent | 6a0477b099560a452e37fe77c3850bf232487c16 (diff) | |
download | cpython-aaab30e00cc3e8d90c71b8657c284feeb4ac1413.zip cpython-aaab30e00cc3e8d90c71b8657c284feeb4ac1413.tar.gz cpython-aaab30e00cc3e8d90c71b8657c284feeb4ac1413.tar.bz2 |
Apply diff2.txt from SF patch http://www.python.org/sf/572113
(with one small bugfix in bgen/bgen/scantools.py)
This replaces string module functions with string methods
for the stuff in the Tools directory. Several uses of
string.letters etc. are still remaining.
Diffstat (limited to 'Tools/idle/EditorWindow.py')
-rw-r--r-- | Tools/idle/EditorWindow.py | 15 |
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) |