mirror of
https://github.com/python/cpython.git
synced 2025-07-30 22:54:16 +00:00
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.
This commit is contained in:
parent
6a0477b099
commit
aaab30e00c
70 changed files with 271 additions and 346 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue