Migrated demo code to not import string module. (Patch from Kevin Altis)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@18718 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import sys, string
|
||||
import sys
|
||||
|
||||
from wxPython.wx import *
|
||||
from wxPython.html import *
|
||||
@@ -46,7 +46,7 @@ demo item so you can learn how to use the classes yourself.</p>
|
||||
def __init__(self, parent):
|
||||
wxDialog.__init__(self, parent, -1, 'About the wxPython demo',)
|
||||
html = wxHtmlWindow(self, -1, size=(420, -1))
|
||||
py_version = string.split(sys.version)[0]
|
||||
py_version = sys.version.split()[0]
|
||||
html.SetPage(self.text % (wx.__version__, py_version))
|
||||
btn = html.FindWindowById(wxID_OK)
|
||||
btn.SetDefault()
|
||||
|
@@ -2,6 +2,7 @@
|
||||
from wxPython.wx import *
|
||||
from wxPython.grid import *
|
||||
|
||||
import string
|
||||
#---------------------------------------------------------------------------
|
||||
class MyCellEditor(wxPyGridCellEditor):
|
||||
"""
|
||||
@@ -143,7 +144,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:
|
||||
# For this example, replace the text. Normally we would append it.
|
||||
|
@@ -47,6 +47,14 @@ class HugeTableGrid(wxGrid):
|
||||
# a reference to it and call it's Destroy method later.
|
||||
self.SetTable(table, true)
|
||||
|
||||
EVT_GRID_CELL_RIGHT_CLICK(self, self.OnRightDown) #added
|
||||
|
||||
def OnRightDown(self, event): #added
|
||||
print "hello"
|
||||
print self.GetSelectedRows() #added
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
@@ -1,7 +1,7 @@
|
||||
from wxPython.wx import *
|
||||
from wxPython.grid import *
|
||||
|
||||
import string, random
|
||||
import random
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
@@ -11,7 +11,7 @@
|
||||
# Licence: wxWindows license
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
import sys, os, time, string
|
||||
import sys, os, time
|
||||
from wxPython.wx import *
|
||||
from wxPython.html import wxHtmlWindow
|
||||
|
||||
@@ -225,7 +225,7 @@ class MyTP(wxPyTipProvider):
|
||||
|
||||
def opj(path):
|
||||
"""Convert paths to the platform-specific separator"""
|
||||
return apply(os.path.join, tuple(string.split(path, '/')))
|
||||
return apply(os.path.join, tuple(path.split('/')))
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
@@ -513,7 +513,7 @@ class wxPythonDemo(wxFrame):
|
||||
self.curOverview = text
|
||||
lead = text[:6]
|
||||
if lead != '<html>' and lead != '<HTML>':
|
||||
text = string.join(string.split(text, '\n'), '<br>')
|
||||
text = '<br>'.join(text.split('\n'))
|
||||
self.ovr.SetPage(text)
|
||||
self.nb.SetPageText(0, name)
|
||||
|
||||
|
@@ -47,11 +47,11 @@ class TablePanel(wxPanel):
|
||||
data = []
|
||||
while 1:
|
||||
text = file.readline()
|
||||
text = string.strip(text)
|
||||
text = text.strip()
|
||||
if not text:
|
||||
break
|
||||
|
||||
list_val = string.splitfields(text,'\t')
|
||||
list_val = text.split('\t')
|
||||
data.append(list_val)
|
||||
file.close()
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
|
||||
import string, sys
|
||||
import sys
|
||||
|
||||
py2 = sys.version[0] == '2'
|
||||
|
||||
@@ -76,7 +76,7 @@ else:
|
||||
self.nodeStack = self.nodeStack[:-1]
|
||||
|
||||
def CharacterData(self, data ):
|
||||
if string.strip(data):
|
||||
if data.strip():
|
||||
if py2:
|
||||
data = data.encode()
|
||||
self.AppendItem(self.nodeStack[-1], data)
|
||||
|
@@ -6,7 +6,7 @@ This is a way to save the startup time when running img2py on lots of
|
||||
files...
|
||||
"""
|
||||
|
||||
import sys, string
|
||||
import sys
|
||||
from wxPython.tools import img2py
|
||||
|
||||
|
||||
@@ -100,6 +100,6 @@ command_lines = [
|
||||
|
||||
|
||||
for line in command_lines:
|
||||
args = string.split(line)
|
||||
args = line.split()
|
||||
img2py.main(args)
|
||||
|
||||
|
@@ -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 *
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ class WordFetcher:
|
||||
m = reg.search(self.words[index:])
|
||||
if m and len(m.groups()[0]) >= self.min_length: break
|
||||
n = n - 1
|
||||
if n: return string.lower(m.groups()[0])
|
||||
if n: return m.groups()[0].lower()
|
||||
return "error"
|
||||
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
|
||||
|
||||
import sys, string
|
||||
import sys
|
||||
|
||||
from wxPython.wx import *
|
||||
from wxPython.html import *
|
||||
@@ -43,7 +43,7 @@ class TestHtmlPanel(wxPanel):
|
||||
import About
|
||||
wxPanel.__init__(self, parent, id, size=size)
|
||||
self.html = wxHtmlWindow(self, -1, wxPoint(5,5), wxSize(400, 350))
|
||||
py_version = string.split(sys.version)[0]
|
||||
py_version = sys.version.split()[0]
|
||||
self.html.SetPage(About.MyAboutBox.text % (wx.__version__, py_version))
|
||||
ir = self.html.GetInternalRepresentation()
|
||||
self.html.SetSize( (ir.GetWidth()+5, ir.GetHeight()+5) )
|
||||
|
@@ -1,4 +1,3 @@
|
||||
import string
|
||||
from wxPython.wx import *
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
@@ -35,7 +34,7 @@ class TestComboBox(wxPanel):
|
||||
cb = wxComboBox(self, 501, "default value", wxPoint(90, 80), wxSize(95, -1),
|
||||
[], wxCB_SIMPLE)
|
||||
for item in sampleList:
|
||||
cb.Append(item, string.upper(item))
|
||||
cb.Append(item, item.upper())
|
||||
EVT_COMBOBOX(self, 501, self.EvtComboBox)
|
||||
EVT_TEXT(self, 501, self.EvtText)
|
||||
|
||||
|
@@ -1,6 +1,5 @@
|
||||
|
||||
from wxPython.wx import *
|
||||
import string
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
@@ -1,8 +1,6 @@
|
||||
|
||||
from wxPython.wx import *
|
||||
|
||||
import string
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class wxFindPrefixListBox(wxListBox):
|
||||
@@ -17,11 +15,11 @@ class wxFindPrefixListBox(wxListBox):
|
||||
def FindPrefix(self, prefix):
|
||||
self.log.WriteText('Looking for prefix: %s\n' % prefix)
|
||||
if prefix:
|
||||
prefix = string.lower(prefix)
|
||||
prefix = prefix.lower()
|
||||
length = len(prefix)
|
||||
for x in range(self.Number()):
|
||||
text = self.GetString(x)
|
||||
text = string.lower(text)
|
||||
text = text.lower()
|
||||
if text[:length] == prefix:
|
||||
self.log.WriteText('Prefix %s is found.\n' % prefix)
|
||||
return x
|
||||
|
@@ -1,8 +1,6 @@
|
||||
|
||||
from wxPython.wx import *
|
||||
|
||||
import string
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
class TestPanel(wxPanel):
|
||||
|
@@ -1,8 +1,6 @@
|
||||
|
||||
from wxPython.wx import *
|
||||
|
||||
import string
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
class TestPanel(wxPanel):
|
||||
|
@@ -1,8 +1,6 @@
|
||||
|
||||
from wxPython.wx import *
|
||||
|
||||
import string
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
class TestPanel(wxPanel):
|
||||
|
@@ -1,8 +1,6 @@
|
||||
|
||||
from wxPython.wx import *
|
||||
from Main import opj
|
||||
|
||||
import string
|
||||
import images
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
@@ -45,7 +45,7 @@ class PythonSTC(wxStyledTextCtrl):
|
||||
self.CmdKeyAssign(ord('N'), wxSTC_SCMOD_CTRL, wxSTC_CMD_ZOOMOUT)
|
||||
|
||||
self.SetLexer(wxSTC_LEX_PYTHON)
|
||||
self.SetKeyWords(0, string.join(keyword.kwlist))
|
||||
self.SetKeyWords(0, " ".join(keyword.kwlist))
|
||||
|
||||
self.SetProperty("fold", "1")
|
||||
self.SetProperty("tab.timmy.whinge.level", "1")
|
||||
@@ -151,7 +151,7 @@ class PythonSTC(wxStyledTextCtrl):
|
||||
#lst = []
|
||||
#for x in range(50000):
|
||||
# lst.append('%05d' % x)
|
||||
#st = string.join(lst)
|
||||
#st = " ".join(lst)
|
||||
#print len(st)
|
||||
#self.AutoCompShow(0, st)
|
||||
|
||||
@@ -167,7 +167,7 @@ class PythonSTC(wxStyledTextCtrl):
|
||||
kw.sort() # Python sorts are case sensitive
|
||||
self.AutoCompSetIgnoreCase(false) # so this needs to match
|
||||
|
||||
self.AutoCompShow(0, string.join(kw))
|
||||
self.AutoCompShow(0, " ".join(kw))
|
||||
else:
|
||||
event.Skip()
|
||||
|
||||
|
@@ -105,7 +105,7 @@ class TestPanel(wxPanel):
|
||||
start, end = self.tc.GetSelection()
|
||||
text = self.tc.GetValue()
|
||||
if wxPlatform == "__WXMSW__": # This is why GetStringSelection was added
|
||||
text = string.replace(text, '\n', '\r\n')
|
||||
text = text.replace('\n', '\r\n')
|
||||
self.log.write("GetSelection(): (%d, %d)\n"
|
||||
"\tGetStringSelection(): %s\n"
|
||||
"\tSelectedText: %s\n" %
|
||||
|
@@ -15,7 +15,7 @@ class TestPanel(wxPanel):
|
||||
self.log = log
|
||||
panel = wxPanel(self, -1)
|
||||
buttons = wxBoxSizer(wxHORIZONTAL)
|
||||
for word in string.split("These are toggle buttons"):
|
||||
for word in "These are toggle buttons".split():
|
||||
b = wxToggleButton(panel, -1, word)
|
||||
EVT_TOGGLEBUTTON(self, b.GetId(), self.OnToggle)
|
||||
buttons.Add(b, flag=wxALL, border=5)
|
||||
|
Reference in New Issue
Block a user