From 76bad8564276aa51111588e976e2a288bd09a77a Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Tue, 21 Jan 2003 00:04:37 +0000 Subject: [PATCH] More Python2 migrations, patch from KA. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@18838 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- wxPython/distrib/make_installer.py | 6 +++--- wxPython/tests/gridtest.py | 2 +- wxPython/tests/hangman.py | 2 +- wxPython/tests/tabs.py | 1 - wxPython/tests/txml.py | 4 ++-- wxPython/tests/val.py | 3 +-- wxPython/tests/wxPlotCanvas.py | 1 - wxPython/wxPython/tools/XRCed/params.py | 2 +- wxPython/wxPython/tools/XRCed/xrced.py | 2 +- wxPython/wxPython/tools/img2img.py | 4 ++-- wxPython/wxPython/tools/img2py.py | 2 +- 11 files changed, 13 insertions(+), 16 deletions(-) diff --git a/wxPython/distrib/make_installer.py b/wxPython/distrib/make_installer.py index e75b23d43f..ec21e78356 100644 --- a/wxPython/distrib/make_installer.py +++ b/wxPython/distrib/make_installer.py @@ -7,7 +7,7 @@ will be created. """ -import sys, os, string, time +import sys, os, time KEEP_TEMPS = 0 ISCC = r"%s\InnoSetup2Ex\ISCC.exe %s" @@ -335,7 +335,7 @@ def find_DLLs(): proc.close() for line in lines: if line[:6] == " wx": - WXDLL = string.strip(line) + WXDLL = line.strip() if line[:10] == " python": PYTHONVER = line[10] + '.' + line[11] @@ -370,7 +370,7 @@ def main(): # Starting with 2.3.3 the hybrid build is the release build too, so # no need to label it that way. - ##if string.find(WXDLL, "h") != -1: + ##if WXDLL.find("h") != -1: ## PYVER = PYVER + "-hybrid" MSLU='' diff --git a/wxPython/tests/gridtest.py b/wxPython/tests/gridtest.py index c4988db150..8635051d5c 100644 --- a/wxPython/tests/gridtest.py +++ b/wxPython/tests/gridtest.py @@ -104,7 +104,7 @@ class MyCellEditor(wxPyGridCellEditor): elif key < 256 and key >= 0 and chr(key) in string.printable: ch = chr(key) if not evt.ShiftDown(): - ch = string.lower(ch) + ch = ch.lower() if ch is not None: # Replace the text. Other option would be to append it. diff --git a/wxPython/tests/hangman.py b/wxPython/tests/hangman.py index d9fed0ec19..c735372bf4 100644 --- a/wxPython/tests/hangman.py +++ b/wxPython/tests/hangman.py @@ -14,7 +14,7 @@ Have fun with it, Harm van der Heijden (H.v.d.Heijden@phys.tue.nl)""" -import random,re,string +import random,re from wxPython.wx import * class WordFetcher: diff --git a/wxPython/tests/tabs.py b/wxPython/tests/tabs.py index 1af9a13cfb..46d946bc62 100644 --- a/wxPython/tests/tabs.py +++ b/wxPython/tests/tabs.py @@ -1,5 +1,4 @@ from wxPython.wx import * -import string, sys class Test: def __init__(self): diff --git a/wxPython/tests/txml.py b/wxPython/tests/txml.py index 9c87e276dc..c8ea85f53c 100644 --- a/wxPython/tests/txml.py +++ b/wxPython/tests/txml.py @@ -3,7 +3,7 @@ Build a GUI Tree (wxWindows) from an XML file using pyExpat """ -import sys,string +import sys from xml.parsers import pyexpat from wxPython.wx import * @@ -59,7 +59,7 @@ def EndElement( name ): def CharacterData ( data ): global NodeStack - if string.strip(data): + if data.strip(): app.tree.AppendItem(NodeStack[-1],data) diff --git a/wxPython/tests/val.py b/wxPython/tests/val.py index 9a05123019..d36f0c092c 100644 --- a/wxPython/tests/val.py +++ b/wxPython/tests/val.py @@ -1,5 +1,4 @@ from wxPython.wx import * -import string class floatValidator(wxPyValidator): @@ -24,7 +23,7 @@ class floatValidator(wxPyValidator): if self.obj and self.attrName: tc = wxPyTypeCast(self.GetWindow(), "wxTextCtrl") text = tc.GetValue() - setattr(self.obj, self.attrName, string.atof(text)) + setattr(self.obj, self.attrName, float(text)) return true diff --git a/wxPython/tests/wxPlotCanvas.py b/wxPython/tests/wxPlotCanvas.py index 05c0efde1d..c65e7011fb 100644 --- a/wxPython/tests/wxPlotCanvas.py +++ b/wxPython/tests/wxPlotCanvas.py @@ -20,7 +20,6 @@ Original comment follows below: """ from wxPython import wx -import string # Not everybody will have Numeric, so let's be cool about it... try: diff --git a/wxPython/wxPython/tools/XRCed/params.py b/wxPython/wxPython/tools/XRCed/params.py index 57f739aef9..fd0d990200 100644 --- a/wxPython/wxPython/tools/XRCed/params.py +++ b/wxPython/wxPython/tools/XRCed/params.py @@ -62,7 +62,7 @@ class ParamBinaryOr(PPanel): dlg = wxDialog(self, -1, 'Choices') topSizer = wxBoxSizer(wxVERTICAL) listBox = wxCheckListBox(dlg, -1, choices=self.values, size=(250,200)) - value = map(string.strip, string.split(self.text.GetValue(), '|')) + value = map(string.strip, self.text.GetValue().split('|')) if value == ['']: value = [] ignored = [] for i in value: diff --git a/wxPython/wxPython/tools/XRCed/xrced.py b/wxPython/wxPython/tools/XRCed/xrced.py index 0a3ebbfd70..b6334b71f3 100644 --- a/wxPython/wxPython/tools/XRCed/xrced.py +++ b/wxPython/wxPython/tools/XRCed/xrced.py @@ -672,7 +672,7 @@ class Frame(wxFrame): except: (etype, value, tb) =sys.exc_info() tblist =traceback.extract_tb(tb)[1:] - msg =string.join(traceback.format_exception_only(etype, value) + msg =' '.join(traceback.format_exception_only(etype, value) +traceback.format_list(tblist)) print msg diff --git a/wxPython/wxPython/tools/img2img.py b/wxPython/wxPython/tools/img2img.py index 802ac73ad1..202b731276 100644 --- a/wxPython/wxPython/tools/img2img.py +++ b/wxPython/wxPython/tools/img2img.py @@ -10,7 +10,7 @@ #---------------------------------------------------------------------- -import sys, os, glob, getopt, string +import sys, os, glob, getopt from wxPython.wx import * if wxPlatform == "__WXGTK__": @@ -20,7 +20,7 @@ if wxPlatform == "__WXGTK__": wxInitAllImageHandlers() def convert(file, maskClr, outputDir, outputName, outType, outExt): - if string.lower(os.path.splitext(file)[1]) == ".ico": + if os.path.splitext(file)[1].lower() == ".ico": icon = wxIcon(file, wxBITMAP_TYPE_ICO) img = wxBitmapFromIcon(icon) else: diff --git a/wxPython/wxPython/tools/img2py.py b/wxPython/wxPython/tools/img2py.py index e401be78b4..719b19d483 100644 --- a/wxPython/wxPython/tools/img2py.py +++ b/wxPython/wxPython/tools/img2py.py @@ -56,7 +56,7 @@ Options: # -import sys, os, glob, getopt, tempfile, string +import sys, os, glob, getopt, tempfile import cPickle, cStringIO, zlib import img2img from wxPython import wx