Update of /cvsroot/pywin32/pywin32/Pythonwin/pywin/scintilla
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8819/scintilla
Modified Files:
IDLEenvironment.py bindings.py config.py configui.py
control.py formatter.py keycodes.py view.py
Log Message:
Replace use of string module with string methods
Index: config.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/scintilla/config.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** config.py 9 Oct 2000 22:36:38 -0000 1.5
--- config.py 9 Aug 2008 16:47:07 -0000 1.6
***************
*** 25,29 ****
import win32traceutil # Some trace statements fire before the interactive window is open.
def trace(*args):
! sys.stderr.write(string.join(map(str, args), " ") + "\n")
else:
trace = lambda *args: None
--- 25,29 ----
import win32traceutil # Some trace statements fire before the interactive window is open.
def trace(*args):
! sys.stderr.write(" ".join(map(str, args)) + "\n")
else:
trace = lambda *args: None
***************
*** 32,53 ****
def split_line(line, lineno):
! comment_pos = string.find(line, "#")
if comment_pos>=0: line = line[:comment_pos]
! sep_pos = string.rfind(line, "=")
if sep_pos == -1:
! if string.strip(line):
print "Warning: Line %d: %s is an invalid entry" % (lineno, `line`)
return None, None
return "", ""
! return string.strip(line[:sep_pos]), string.strip(line[sep_pos+1:])
def get_section_header(line):
# Returns the section if the line is a section header, else None
if line[0] == "[":
! end = string.find(line, "]")
if end==-1: end=len(line)
! rc = string.lower(line[1:end])
try:
! i = string.index(rc, ":")
return rc[:i], rc[i+1:]
except ValueError:
--- 32,53 ----
def split_line(line, lineno):
! comment_pos = line.find("#")
if comment_pos>=0: line = line[:comment_pos]
! sep_pos = line.rfind("=")
if sep_pos == -1:
! if line.strip():
print "Warning: Line %d: %s is an invalid entry" % (lineno, `line`)
return None, None
return "", ""
! return line[:sep_pos].strip(), line[sep_pos+1:].strip()
def get_section_header(line):
# Returns the section if the line is a section header, else None
if line[0] == "[":
! end = line.find("]")
if end==-1: end=len(line)
! rc = line[1:end].lower()
try:
! i = rc.index(":")
return rc[:i], rc[i+1:]
except ValueError:
***************
*** 222,226 ****
bBreak = get_section_header(line)[0] is not None # A new section is starting
if bStripComments and not bBreak:
! pos = string.find(line, "#")
if pos>=0: line=line[:pos]+"\n"
else:
--- 222,226 ----
bBreak = get_section_header(line)[0] is not None # A new section is starting
if bStripComments and not bBreak:
! pos = line.find("#")
if pos>=0: line=line[:pos]+"\n"
else:
***************
*** 243,247 ****
key, val = split_line(line, lineno)
if not key: continue
! key = string.lower(key)
l = map.get(key, [])
l.append(val)
--- 243,247 ----
key, val = split_line(line, lineno)
if not key: continue
! key = key.lower()
l = map.get(key, [])
l.append(val)
***************
*** 278,282 ****
lines.append(line)
try:
! c = compile(string.join(lines, ""), self.filename, "exec")
self._save_data("extension code", c)
except SyntaxError, details:
--- 278,282 ----
lines.append(line)
try:
! c = compile("".join(lines), self.filename, "exec")
self._save_data("extension code", c)
except SyntaxError, details:
***************
*** 294,298 ****
line, lineno, bBreak = self._readline(fp, lineno)
if bBreak: break
! line = string.strip(line)
if line:
extensions.append(line)
--- 294,298 ----
line, lineno, bBreak = self._readline(fp, lineno)
if bBreak: break
! line = line.strip()
if line:
extensions.append(line)
Index: IDLEenvironment.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/scintilla/IDLEenvironment.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** IDLEenvironment.py 29 Nov 2003 06:37:40 -0000 1.10
--- IDLEenvironment.py 9 Aug 2008 16:47:07 -0000 1.11
***************
*** 10,14 ****
from pywin.mfc.dialog import GetSimpleInput
! wordchars = string.uppercase + string.lowercase + string.digits
class TextError(Exception): # When a TclError would normally be raised.
--- 10,14 ----
from pywin.mfc.dialog import GetSimpleInput
! wordchars = string.ascii_uppercase + string.ascii_lowercase + string.digits
class TextError(Exception): # When a TclError would normally be raised.
***************
*** 44,48 ****
if not self.__dict__.has_key("_scint_lines"):
# XXX - note - assumes this is only called once the file is loaded!
! self._scint_lines = string.split(self.text.edit.GetTextRange(), "\n")
sl = self._scint_lines
i = self.i = self.i + 1
--- 44,48 ----
if not self.__dict__.has_key("_scint_lines"):
# XXX - note - assumes this is only called once the file is loaded!
! self._scint_lines = self.text.edit.GetTextRange().split("\n")
sl = self._scint_lines
i = self.i = self.i + 1
***************
*** 86,90 ****
events = filter(lambda item: item[-6:]=="_event", dir(klass))
for event in events:
! name = "<<%s>>" % (string.replace(event[:-6], "_", "-"), )
self.edit.bindings.bind(name, getattr(ext, event))
return ext
--- 86,90 ----
events = filter(lambda item: item[-6:]=="_event", dir(klass))
for event in events:
! name = "<<%s>>" % (event[:-6].replace("_", "-"), )
self.edit.bindings.bind(name, getattr(ext, event))
return ext
***************
*** 99,104 ****
if name == menu_name:
for text, event in filter(lambda item: item is not None, items):
! text = string.replace(text, "&", "&&")
! text = string.replace(text, "_", "&")
ret.append((text, event))
return ret
--- 99,104 ----
if name == menu_name:
for text, event in filter(lambda item: item is not None, items):
! text = text.replace("&", "&&")
! text = text.replace("_", "&")
ret.append((text, event))
return ret
***************
*** 203,209 ****
base, nextTokPos = _NextTok(bm, 0)
if base is None: raise ValueError, "Empty bookmark ID!"
! if string.find(base,".")>0:
try:
! line, col = string.split(base, ".", 2)
if col=="first" or col=="last":
# Tag name
--- 203,209 ----
base, nextTokPos = _NextTok(bm, 0)
if base is None: raise ValueError, "Empty bookmark ID!"
! if base.find(".")>0:
try:
! line, col = base.split(".", 2)
if col=="first" or col=="last":
# Tag name
***************
*** 339,343 ****
# pretend a trailing '\n' exists if necessary.
if checkEnd and (not ret or ret[-1] != '\n'): ret = ret + '\n'
! return string.replace(ret, "\r", "")
def index(self, spec):
try:
--- 339,343 ----
# pretend a trailing '\n' exists if necessary.
if checkEnd and (not ret or ret[-1] != '\n'): ret = ret + '\n'
! return ret.replace("\r", "")
def index(self, spec):
try:
***************
*** 352,356 ****
self.edit.SetSel((pos, pos))
# IDLE only deals with "\n" - we will be nicer
! bits = string.split(text, '\n')
self.edit.SCIAddText(bits[0])
for bit in bits[1:]:
--- 352,356 ----
self.edit.SetSel((pos, pos))
# IDLE only deals with "\n" - we will be nicer
! bits = text.split('\n')
self.edit.SCIAddText(bits[0])
for bit in bits[1:]:
Index: keycodes.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/scintilla/keycodes.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** keycodes.py 10 Apr 2000 01:57:42 -0000 1.4
--- keycodes.py 9 Aug 2008 16:47:07 -0000 1.5
***************
*** 3,7 ****
char_ranges = [
! (string.lowercase, -32),
(string.digits, 0),
("?><:[]\\", 128),
--- 3,7 ----
char_ranges = [
! (string.ascii_lowercase, -32),
(string.digits, 0),
("?><:[]\\", 128),
***************
*** 33,37 ****
names = filter(lambda entry: entry[:3]=="VK_", win32con.__dict__.keys())
for name in names:
! n = string.lower(name[3:])
val = getattr(win32con, name)
key_name_to_code[n] = val
--- 33,37 ----
names = filter(lambda entry: entry[:3]=="VK_", win32con.__dict__.keys())
for name in names:
! n = name[3:].lower()
val = getattr(win32con, name)
key_name_to_code[n] = val
***************
*** 50,54 ****
def get_scan_code(chardesc):
! return key_name_to_code.get(string.lower(chardesc))
modifiers = {
--- 50,54 ----
def get_scan_code(chardesc):
! return key_name_to_code.get(chardesc.lower())
modifiers = {
***************
*** 75,79 ****
while pos<max:
if name[pos] in "+-":
! tok = string.lower(name[start:pos])
mod = modifiers.get(tok)
if mod is None:
--- 75,79 ----
while pos<max:
if name[pos] in "+-":
! tok = name[start:pos].lower()
mod = modifiers.get(tok)
if mod is None:
***************
*** 122,126 ****
sep = "+"
if sep in parts: sep = "-"
! return string.join(map(string.capitalize, parts), sep)
def _psc(char):
--- 122,126 ----
sep = "+"
if sep in parts: sep = "-"
! return sep.join([p.capitalize() for p in parts])
def _psc(char):
Index: control.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/scintilla/control.py,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** control.py 23 Feb 2008 08:05:07 -0000 1.16
--- control.py 9 Aug 2008 16:47:07 -0000 1.17
***************
*** 65,69 ****
if style is not None:
text = map(lambda char, style=style: char+chr(style), text)
! text = string.join(text, '')
self.SendMessage(SCI_ADDSTYLEDTEXT, buffer(text))
def SCIInsertText(self, text, pos=-1):
--- 65,69 ----
if style is not None:
text = map(lambda char, style=style: char+chr(style), text)
! text = ''.join(text)
self.SendMessage(SCI_ADDSTYLEDTEXT, buffer(text))
def SCIInsertText(self, text, pos=-1):
***************
*** 179,183 ****
def SCIAutoCShow(self, text):
if type(text) in [type([]), type(())]:
! text = string.join(text)
buff = array.array('c', text + "\0")
addressBuffer = buff.buffer_info()[0]
--- 179,183 ----
def SCIAutoCShow(self, text):
if type(text) in [type([]), type(())]:
! text = ' '.join(text)
buff = array.array('c', text + "\0")
addressBuffer = buff.buffer_info()[0]
Index: configui.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/scintilla/configui.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** configui.py 5 Jul 2001 07:52:32 -0000 1.4
--- configui.py 9 Aug 2008 16:47:07 -0000 1.5
***************
*** 49,55 ****
colorizer = self.scintilla._GetColorizer()
text = colorizer.GetSampleText()
! items = string.split(text, '|', 2)
pos = len(items[0])
! self.scintilla.SCIAddText(string.join(items,''))
self.scintilla.SetSel(pos, pos)
self.scintilla.ApplyFormattingStyles()
--- 49,55 ----
colorizer = self.scintilla._GetColorizer()
text = colorizer.GetSampleText()
! items = text.split('|', 2)
pos = len(items[0])
! self.scintilla.SCIAddText(''.join(items))
self.scintilla.SetSel(pos, pos)
self.scintilla.ApplyFormattingStyles()
Index: view.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/scintilla/view.py,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** view.py 18 Jun 2008 22:12:54 -0000 1.27
--- view.py 9 Aug 2008 16:47:08 -0000 1.28
***************
*** 26,30 ****
EM_FORMATRANGE = win32con.WM_USER+57
! wordbreaks = "._" + string.uppercase + string.lowercase + string.digits
patImport=re.compile('import (?P<name>.*)')
--- 26,30 ----
EM_FORMATRANGE = win32con.WM_USER+57
! wordbreaks = "._" + string.ascii_uppercase + string.ascii_lowercase + string.digits
patImport=re.compile('import (?P<name>.*)')
***************
*** 67,73 ****
for name in _event_commands:
val = eval(name)
! name_parts = string.split(name, "_")[1:]
! name_parts = map(string.capitalize, name_parts)
! event =string.join(name_parts,'')
event_commands.append((event, val))
for name, id in _extra_event_commands:
--- 67,73 ----
for name in _event_commands:
val = eval(name)
! name_parts = name.split("_")[1:]
! name_parts = [p.capitalize() for p in name_parts]
! event = ''.join(name_parts)
event_commands.append((event, val))
for name, id in _extra_event_commands:
***************
*** 360,364 ****
def OnCmdFileLocate(self, cmd, id):
! line=string.strip(self.GetLine())
import pywin.framework.scriptutils
m = patImport.match(line)
--- 360,364 ----
def OnCmdFileLocate(self, cmd, id):
! line = self.GetLine().strip()
import pywin.framework.scriptutils
m = patImport.match(line)
***************
*** 379,383 ****
def OnCmdGotoLine(self, cmd, id):
try:
! lineNo = string.atoi(raw_input("Enter Line Number"))-1
except (ValueError, KeyboardInterrupt):
return 0
--- 379,383 ----
def OnCmdGotoLine(self, cmd, id):
try:
! lineNo = int(raw_input("Enter Line Number"))-1
except (ValueError, KeyboardInterrupt):
return 0
***************
*** 581,585 ****
after.append(char)
index=index+1
! return string.join(before,''), string.join(after,'')
def OnPrepareDC (self, dc, pInfo):
--- 581,585 ----
after.append(char)
index=index+1
! return ''.join(before), ''.join(after)
def OnPrepareDC (self, dc, pInfo):
Index: bindings.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/scintilla/bindings.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** bindings.py 7 Aug 2000 08:27:02 -0000 1.4
--- bindings.py 9 Aug 2008 16:47:07 -0000 1.5
***************
*** 99,103 ****
try:
instance = self.parent_view.idle.IDLEExtension(ext)
! name = string.replace(handler, "-", "_") + "_event"
return getattr(instance, name)
except (ImportError, AttributeError):
--- 99,103 ----
try:
instance = self.parent_view.idle.IDLEExtension(ext)
! name = handler.replace("-", "_") + "_event"
return getattr(instance, name)
except (ImportError, AttributeError):
Index: formatter.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/scintilla/formatter.py,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** formatter.py 25 Feb 2008 07:46:13 -0000 1.13
--- formatter.py 9 Aug 2008 16:47:07 -0000 1.14
***************
*** 16,20 ****
import sys, win32traceutil, win32trace
def trace(*args):
! win32trace.write(string.join(map(str, args), " ") + "\n")
else:
trace = lambda *args: None
--- 16,20 ----
import sys, win32traceutil, win32trace
def trace(*args):
! win32trace.write(' '.join(map(str, args)) + "\n")
else:
trace = lambda *args: None
***************
*** 516,530 ****
# These taken from the SciTE properties file.
source_formatter_extensions = [
! ( string.split(".py .pys .pyw"), scintillacon.SCLEX_PYTHON ),
! ( string.split(".html .htm .asp .shtml"), scintillacon.SCLEX_HTML ),
! ( string.split("c .cc .cpp .cxx .h .hh .hpp .hxx .idl .odl .php3 .phtml .inc .js"),scintillacon.SCLEX_CPP ),
! ( string.split(".vbs .frm .ctl .cls"), scintillacon.SCLEX_VB ),
! ( string.split(".pl .pm .cgi .pod"), scintillacon.SCLEX_PERL ),
! ( string.split(".sql .spec .body .sps .spb .sf .sp"), scintillacon.SCLEX_SQL ),
! ( string.split(".tex .sty"), scintillacon.SCLEX_LATEX ),
! ( string.split(".xml .xul"), scintillacon.SCLEX_XML ),
! ( string.split(".err"), scintillacon.SCLEX_ERRORLIST ),
! ( string.split(".mak"), scintillacon.SCLEX_MAKEFILE ),
! ( string.split(".bat .cmd"), scintillacon.SCLEX_BATCH ),
]
--- 516,530 ----
# These taken from the SciTE properties file.
source_formatter_extensions = [
! ( ".py .pys .pyw".split(), scintillacon.SCLEX_PYTHON ),
! ( ".html .htm .asp .shtml".split(), scintillacon.SCLEX_HTML ),
! ( "c .cc .cpp .cxx .h .hh .hpp .hxx .idl .odl .php3 .phtml .inc .js".split(), scintillacon.SCLEX_CPP ),
! ( ".vbs .frm .ctl .cls".split(), scintillacon.SCLEX_VB ),
! ( ".pl .pm .cgi .pod".split(), scintillacon.SCLEX_PERL ),
! ( ".sql .spec .body .sps .spb .sf .sp".split(), scintillacon.SCLEX_SQL ),
! ( ".tex .sty".split(), scintillacon.SCLEX_LATEX ),
! ( ".xml .xul".split(), scintillacon.SCLEX_XML ),
! ( ".err".split(), scintillacon.SCLEX_ERRORLIST ),
! ( ".mak".split(), scintillacon.SCLEX_MAKEFILE ),
! ( ".bat .cmd".split(), scintillacon.SCLEX_BATCH ),
]
***************
*** 556,560 ****
formatter_use = scintillacon.SCLEX_PYTHON
sc.SendScintilla(scintillacon.SCI_SETLEXER, formatter_use)
! keywords = string.join(kwlist)
sc.SCISetKeywords(keywords)
--- 556,560 ----
formatter_use = scintillacon.SCLEX_PYTHON
sc.SendScintilla(scintillacon.SCI_SETLEXER, formatter_use)
! keywords = ' '.join(kwlist)
sc.SCISetKeywords(keywords)
|