Kevin O's demo modules fixup patch

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24778 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2003-12-11 19:55:48 +00:00
parent 0221a4c390
commit 372bde9b72
21 changed files with 76 additions and 72 deletions

View File

@@ -56,7 +56,7 @@ class TestColourSelect(wx.Panel):
# show a button with all default values
self.colourDefaults = csel.ColourSelect(self, -1)
self.colourDefaults.Bind(csel.EVT_COLOURSELECT, self.OnSelectColour, self.colourDefaults.GetId())
self.Bind(csel.EVT_COLOURSELECT, self.OnSelectColour, id=self.colourDefaults.GetId())
buttonSizer.AddMany([
(wx.StaticText(self, -1, "Default Colour/Size"), 0, wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL),

View File

@@ -43,8 +43,8 @@ class TestPanel(wx.Panel):
cBtnText.SetHelpText("Some helpful text...")
s = wx.BoxSizer(wx.HORIZONTAL)
s.Add(cBtn, 0, wxALL, 5)
s.Add(cBtnText, 0, wxALL, 5)
s.Add(cBtn, 0, wx.ALL, 5)
s.Add(cBtnText, 0, wx.ALL, 5)
sizer.Add((20,20))
sizer.Add(s)

View File

@@ -247,10 +247,10 @@ class CustomDnDPanel(wx.Panel):
rbox.Add(rb1)
rbox.Add(rb2)
box.Add(text1, 0, wxALL, 10)
box.Add(rbox, 0, wxALIGN_CENTER)
box.Add(text1, 0, wx.ALL, 10)
box.Add(rbox, 0, wx.ALIGN_CENTER)
box.Add((10,90))
box.Add(text2, 0, wxALL, 10)
box.Add(text2, 0, wx.ALL, 10)
sizer.Add(box)

View File

@@ -141,8 +141,8 @@ def makeRandomColors(num):
colors = []
for i in range(num):
c = whrandom.choice(colours)
colors.append(wxNamedColour(c))
c = random.choice(colours)
colors.append(wx.NamedColour(c))
return colors

View File

@@ -62,16 +62,16 @@ class TestPanel(wx.Panel):
message2 = wx.StaticText(self, -1, txt)
message2.SetFont(f1)
targetPanel = Tile(self, log, bgColor=wxColour(80,10,10), active=0)
buttonPanel = wxPanel(self ,-1)
sizer = wxBoxSizer(wxHORIZONTAL)
targetPanel = Tile(self, log, bgColor=wx.Colour(80,10,10), active=0)
buttonPanel = wx.Panel(self ,-1)
sizer = wx.BoxSizer(wx.HORIZONTAL)
target = targetPanel.tile
sizer.Add((0,0), 1)
for factor in [0.2, 0.3, 0.4, 0.5, 0.6, 0.7]:
sizer.Add(Tile(buttonPanel, log, factor-0.05, target), 0, wxALIGN_CENTER)
sizer.Add(Tile(buttonPanel, log, factor-0.05, target), 0, wx.ALIGN_CENTER)
sizer.Add((0,0),1)
sizer.Add(Tile(buttonPanel, log, factor, target), 0, wxALIGN_CENTER)
sizer.Add(Tile(buttonPanel, log, factor, target), 0, wx.ALIGN_CENTER)
sizer.Add((0,0),1)
buttonPanel.SetAutoLayout(1)
@@ -137,7 +137,7 @@ class Tile(wx.Panel):
class InnerTile(wxPanel):
class InnerTile(wx.Panel):
IDLE_COLOR = wx.Colour( 80, 10, 10)
START_COLOR = wx.Colour(200, 70, 50)
FINAL_COLOR = wx.Colour( 20, 80,240)

View File

@@ -21,9 +21,9 @@ class HugeTable(gridlib.PyGridTableBase):
gridlib.PyGridTableBase.__init__(self)
self.log = log
self.odd=wxGridCellAttr()
self.odd=gridlib.GridCellAttr()
self.odd.SetBackgroundColour("sky blue")
self.even=wxGridCellAttr()
self.even=gridlib.GridCellAttr()
self.even.SetBackgroundColour("sea green")
def GetAttr(self, row, col, kind):

View File

@@ -16,9 +16,9 @@ class MyCustomRenderer(gridlib.PyGridCellRenderer):
gridlib.PyGridCellRenderer.__init__(self)
def Draw(self, grid, attr, dc, rect, row, col, isSelected):
dc.SetBackgroundMode(wxSOLID)
dc.SetBrush(wxBrush(wxBLACK, wxSOLID))
dc.SetPen(wxTRANSPARENT_PEN)
dc.SetBackgroundMode(wx.SOLID)
dc.SetBrush(wx.Brush(wx.BLACK, wx.SOLID))
dc.SetPen(wx.TRANSPARENT_PEN)
dc.DrawRectangleRect(rect)
dc.SetBackgroundMode(wx.TRANSPARENT)

View File

@@ -18,7 +18,7 @@ class TestLayoutf(wx.Panel):
wx.Panel.__init__(self, parent, -1)
self.SetAutoLayout(True)
self.Bind(EVT_BUTTON, self.OnButton, id=ID_Button)
self.Bind(wx.EVT_BUTTON, self.OnButton, id=ID_Button)
self.panelA = wx.Window(self, -1, style=wx.SIMPLE_BORDER)
self.panelA.SetBackgroundColour(wx.BLUE)

View File

@@ -42,10 +42,10 @@ class TestPanel(wx.Panel):
text.SetFont(wx.Font(24, wx.SWISS, wx.NORMAL, wx.BOLD, False))
text.SetLabel(msg)
w,h = text.GetTextExtent(msg)
text.SetSize(wxSize(w,h+1))
text.SetForegroundColour(wxBLUE)
outsideSizer.Add(text, 0, wxEXPAND|wxALL, 5)
outsideSizer.Add(wxStaticLine(self, -1), 0, wxEXPAND)
text.SetSize(wx.Size(w,h+1))
text.SetForegroundColour(wx.BLUE)
outsideSizer.Add(text, 0, wx.EXPAND|wx.ALL, 5)
outsideSizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND)
outsideSizer.Add((20,20))
self.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.BOLD, False))
@@ -55,7 +55,7 @@ class TestPanel(wx.Panel):
inSizer.Add((20,20))
inSizer.Add((20,20))
inSizer.Add(wxStaticText(self, -1,
inSizer.Add(wx.StaticText(self, -1,
"Drag URLs from your browser to\nthis window:",
style = wx.ALIGN_RIGHT),
0, wx.ALIGN_RIGHT )

View File

@@ -126,9 +126,9 @@ class TestPanel(wx.Panel):
self.Bind(wx.EVT_COMBOBOX, self.OnSelectID, combo)
combo.Select(0)
cb = wxCheckBox(self, -1, "Use custom provider")
cb = wx.CheckBox(self, -1, "Use custom provider")
fgs.Add(cb, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
self.Bind(EVT_CHECKBOX, self.OnUseCustom, cb)
self.Bind(wx.EVT_CHECKBOX, self.OnUseCustom, cb)
fgs.Add((10, 10), 0, wx.ALIGN_CENTRE|wx.ALL, 5)
fgs.Add((10, 10), 0, wx.ALIGN_CENTRE|wx.ALL, 5)

View File

@@ -15,12 +15,12 @@ class TestPanel(wx.Panel):
self.log = log
b = wx.Button(self, 10, "Default Button", (20, 20))
self.Bind(EVT_BUTTON, self.OnClick, b)
self.Bind(wx.EVT_BUTTON, self.OnClick, b)
b.SetDefault()
b.SetSize(b.GetBestSize())
b = wx.Button(self, 20, "HELLO AGAIN!", (20, 80), (120, 45))
self.Bind(EVT_BUTTON, self.OnClick, b)
self.Bind(wx.EVT_BUTTON, self.OnClick, b)
b.SetToolTipString("This is a Hello button...")
if 0: # a test case for catching wx.PyAssertionError

View File

@@ -29,7 +29,7 @@ class DragShape:
memDC = wx.MemoryDC()
memDC.SelectObject(self.bmp)
dc.Blit((self.pos.x, self.pos.y),
dc.Blit((self.pos[0], self.pos[1]),
(self.bmp.GetWidth(), self.bmp.GetHeight()),
memDC, (0, 0), op, True)
@@ -77,8 +77,8 @@ class DragCanvas(wx.ScrolledWindow):
dc.SetTextForeground(wx.RED)
dc.SetFont(font)
dc.DrawText(text, (0, 0))
dc.SelectObject(wxNullBitmap)
mask = wxMaskColour(bmp, bg_colour)
dc.SelectObject(wx.NullBitmap)
mask = wx.MaskColour(bmp, bg_colour)
bmp.SetMask(mask)
shape = DragShape(bmp)
shape.pos = (5, 100)

View File

@@ -38,7 +38,7 @@ if not haveGLCanvas:
elif not haveOpenGL:
def runTest(frame, nb, log):
dlg = wxMessageDialog(
dlg = wx.MessageDialog(
frame, 'The OpenGL package was not found. You can get it at\n'
'http://PyOpenGL.sourceforge.net/', 'Sorry', wx.OK | wx.ICON_INFORMATION
)

View File

@@ -24,7 +24,7 @@ class ButtonPanel(wx.Panel):
wx.Panel.__init__(self, parent, -1)
self.log = log
box = wxBoxSizer(wx.VERTICAL)
box = wx.BoxSizer(wx.VERTICAL)
box.Add((20, 20))
keys = buttonDefs.keys()
keys.sort()

View File

@@ -219,8 +219,8 @@ class MegaImageRenderer(Grid.PyGridCellRenderer):
dc.SetBrush(wx.Brush(wx.BLUE, wx.SOLID))
dc.SetPen(wx.Pen(wx.BLUE, 1, wx.SOLID))
else:
dc.SetBrush(wxBrush(wxWHITE, wxSOLID))
dc.SetPen(wxPen(wxWHITE, 1, wxSOLID))
dc.SetBrush(wx.Brush(wx.WHITE, wx.SOLID))
dc.SetPen(wx.Pen(wx.WHITE, 1, wx.SOLID))
dc.DrawRectangleRect(rect)
#dc.DrawRectangle((rect.x, rect.y), (rect.width, rect.height))
@@ -236,7 +236,7 @@ class MegaImageRenderer(Grid.PyGridCellRenderer):
dc.Blit((rect.x+1, rect.y+1), (width, height),
image,
(0, 0), wxCOPY, True)
(0, 0), wx.COPY, True)
class MegaFontRenderer(Grid.PyGridCellRenderer):
@@ -265,8 +265,8 @@ class MegaFontRenderer(Grid.PyGridCellRenderer):
dc.SetBrush(wx.Brush(wx.BLUE, wx.SOLID))
dc.SetPen(wx.Pen(wx.BLUE, 1, wx.SOLID))
else:
dc.SetBrush(wxBrush(wxWHITE, wxSOLID))
dc.SetPen(wxPen(wxWHITE, 1, wxSOLID))
dc.SetBrush(wx.Brush(wx.WHITE, wx.SOLID))
dc.SetPen(wx.Pen(wx.WHITE, 1, wx.SOLID))
dc.DrawRectangleRect(rect)
#dc.DrawRectangle((rect.x, rect.y), (rect.width, rect.height))

View File

@@ -11,6 +11,10 @@ import sys
import wx
import images
import ColorPanel
colourList = [ "Aquamarine", "Black", "Blue", "Blue Violet", "Brown", "Cadet Blue",
"Coral", "Cornflower Blue", "Cyan", "Dark Grey", "Dark Green",
"Dark Olive Green", "Dark Orchid", "Dark Slate Blue",
@@ -43,7 +47,7 @@ class TestLB(wx.Listbook):
# make an image list using the BlomXX images
il = wxImageList(32, 32)
il = wx.ImageList(32, 32)
for x in range(1, 15):
f = getattr(images, 'getBlom%02dBitmap' % x)
bmp = f()
@@ -59,18 +63,18 @@ class TestLB(wx.Listbook):
imID += 1
if imID == il.GetImageCount(): imID = 0
if first:
st = wxStaticText(win.win, -1,
st = wx.StaticText(win.win, -1,
"You can put nearly any type of window here,\n"
"and the list can be on any side of the Listbook",
wxPoint(10, 10))
wx.Point(10, 10))
#st.SetForegroundColour(wxWHITE)
#st.SetBackgroundColour(wxBLUE)
first = False
EVT_LISTBOOK_PAGE_CHANGED(self, self.GetId(), self.OnPageChanged)
EVT_LISTBOOK_PAGE_CHANGING(self, self.GetId(), self.OnPageChanging)
wx.EVT_LISTBOOK_PAGE_CHANGED(self, self.GetId(), self.OnPageChanged)
wx.EVT_LISTBOOK_PAGE_CHANGING(self, self.GetId(), self.OnPageChanging)
def makeColorPanel(self, color):

View File

@@ -301,7 +301,7 @@ def runTest(frame, nb, log):
# This creates some pens and brushes that the OGL library uses.
# It should be called after the app object has been created, but
# before OGL is used.
wx.OGLInitialize()
ogl.OGLInitialize()
win = TestWindow(nb, log, frame)
return win

View File

@@ -79,7 +79,7 @@ class TestPanel(scrolled.wxScrolledPanel):
panel3.SetAutoLayout(1)
panel3.SetupScrolling()
hbox = wxBoxSizer(wxHORIZONTAL)
hbox = wx.BoxSizer(wx.HORIZONTAL)
hbox.Add((20,20))
hbox.Add(panel1, 0)
hbox.Add((40, 10))

View File

@@ -13,7 +13,7 @@ BUFFERED = 1
#---------------------------------------------------------------------------
class MyCanvas(wx.ScrolledWindow):
def __init__(self, parent, id = -1):
def __init__(self, parent, id = -1, size = wx.DefaultSize):
wx.ScrolledWindow.__init__(self, parent, id, (0, 0), size=size, style=wx.SUNKEN_BORDER)
self.lines = []

View File

@@ -86,33 +86,33 @@ class PythonSTC(stc.StyledTextCtrl):
elif self.fold_symbols == 1:
# Plus for contracted folders, minus for expanded
self.MarkerDefine(wxSTC_MARKNUM_FOLDEROPEN, wxSTC_MARK_MINUS, "white", "black");
self.MarkerDefine(wxSTC_MARKNUM_FOLDER, wxSTC_MARK_PLUS, "white", "black");
self.MarkerDefine(wxSTC_MARKNUM_FOLDERSUB, wxSTC_MARK_EMPTY, "white", "black");
self.MarkerDefine(wxSTC_MARKNUM_FOLDERTAIL, wxSTC_MARK_EMPTY, "white", "black");
self.MarkerDefine(wxSTC_MARKNUM_FOLDEREND, wxSTC_MARK_EMPTY, "white", "black");
self.MarkerDefine(wxSTC_MARKNUM_FOLDEROPENMID, wxSTC_MARK_EMPTY, "white", "black");
self.MarkerDefine(wxSTC_MARKNUM_FOLDERMIDTAIL, wxSTC_MARK_EMPTY, "white", "black");
self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPEN, stc.STC_MARK_MINUS, "white", "black");
self.MarkerDefine(stc.STC_MARKNUM_FOLDER, stc.STC_MARK_PLUS, "white", "black");
self.MarkerDefine(stc.STC_MARKNUM_FOLDERSUB, stc.STC_MARK_EMPTY, "white", "black");
self.MarkerDefine(stc.STC_MARKNUM_FOLDERTAIL, stc.STC_MARK_EMPTY, "white", "black");
self.MarkerDefine(stc.STC_MARKNUM_FOLDEREND, stc.STC_MARK_EMPTY, "white", "black");
self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPENMID, stc.STC_MARK_EMPTY, "white", "black");
self.MarkerDefine(stc.STC_MARKNUM_FOLDERMIDTAIL, stc.STC_MARK_EMPTY, "white", "black");
elif self.fold_symbols == 2:
# Like a flattened tree control using circular headers and curved joins
self.MarkerDefine(wxSTC_MARKNUM_FOLDEROPEN, wxSTC_MARK_CIRCLEMINUS, "white", "#404040");
self.MarkerDefine(wxSTC_MARKNUM_FOLDER, wxSTC_MARK_CIRCLEPLUS, "white", "#404040");
self.MarkerDefine(wxSTC_MARKNUM_FOLDERSUB, wxSTC_MARK_VLINE, "white", "#404040");
self.MarkerDefine(wxSTC_MARKNUM_FOLDERTAIL, wxSTC_MARK_LCORNERCURVE, "white", "#404040");
self.MarkerDefine(wxSTC_MARKNUM_FOLDEREND, wxSTC_MARK_CIRCLEPLUSCONNECTED, "white", "#404040");
self.MarkerDefine(wxSTC_MARKNUM_FOLDEROPENMID, wxSTC_MARK_CIRCLEMINUSCONNECTED, "white", "#404040");
self.MarkerDefine(wxSTC_MARKNUM_FOLDERMIDTAIL, wxSTC_MARK_TCORNERCURVE, "white", "#404040");
self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPEN, stc.STC_MARK_CIRCLEMINUS, "white", "#404040");
self.MarkerDefine(stc.STC_MARKNUM_FOLDER, stc.STC_MARK_CIRCLEPLUS, "white", "#404040");
self.MarkerDefine(stc.STC_MARKNUM_FOLDERSUB, stc.STC_MARK_VLINE, "white", "#404040");
self.MarkerDefine(stc.STC_MARKNUM_FOLDERTAIL, stc.STC_MARK_LCORNERCURVE, "white", "#404040");
self.MarkerDefine(stc.STC_MARKNUM_FOLDEREND, stc.STC_MARK_CIRCLEPLUSCONNECTED, "white", "#404040");
self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPENMID, stc.STC_MARK_CIRCLEMINUSCONNECTED, "white", "#404040");
self.MarkerDefine(stc.STC_MARKNUM_FOLDERMIDTAIL, stc.STC_MARK_TCORNERCURVE, "white", "#404040");
elif self.fold_symbols == 3:
# Like a flattened tree control using square headers
self.MarkerDefine(wxSTC_MARKNUM_FOLDEROPEN, wxSTC_MARK_BOXMINUS, "white", "#808080")
self.MarkerDefine(wxSTC_MARKNUM_FOLDER, wxSTC_MARK_BOXPLUS, "white", "#808080")
self.MarkerDefine(wxSTC_MARKNUM_FOLDERSUB, wxSTC_MARK_VLINE, "white", "#808080")
self.MarkerDefine(wxSTC_MARKNUM_FOLDERTAIL, wxSTC_MARK_LCORNER, "white", "#808080")
self.MarkerDefine(wxSTC_MARKNUM_FOLDEREND, wxSTC_MARK_BOXPLUSCONNECTED, "white", "#808080")
self.MarkerDefine(wxSTC_MARKNUM_FOLDEROPENMID, wxSTC_MARK_BOXMINUSCONNECTED, "white", "#808080")
self.MarkerDefine(wxSTC_MARKNUM_FOLDERMIDTAIL, wxSTC_MARK_TCORNER, "white", "#808080")
self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPEN, stc.STC_MARK_BOXMINUS, "white", "#808080")
self.MarkerDefine(stc.STC_MARKNUM_FOLDER, stc.STC_MARK_BOXPLUS, "white", "#808080")
self.MarkerDefine(stc.STC_MARKNUM_FOLDERSUB, stc.STC_MARK_VLINE, "white", "#808080")
self.MarkerDefine(stc.STC_MARKNUM_FOLDERTAIL, stc.STC_MARK_LCORNER, "white", "#808080")
self.MarkerDefine(stc.STC_MARKNUM_FOLDEREND, stc.STC_MARK_BOXPLUSCONNECTED, "white", "#808080")
self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPENMID, stc.STC_MARK_BOXMINUSCONNECTED, "white", "#808080")
self.MarkerDefine(stc.STC_MARKNUM_FOLDERMIDTAIL, stc.STC_MARK_TCORNER, "white", "#808080")
self.Bind(stc.EVT_STC_UPDATEUI, self.OnUpdateUI)

View File

@@ -71,7 +71,7 @@ class TestValidatorPanel(wx.Panel):
fgs = wx.FlexGridSizer(0, 2)
fgs.Add((1,1))
fgs.Add(wxStaticText(self, -1, "These controls have validators that limit\n"
fgs.Add(wx.StaticText(self, -1, "These controls have validators that limit\n"
"the type of characters that can be entered."))
fgs.Add((1,VSPACE)); fgs.Add((1,VSPACE))
@@ -84,14 +84,14 @@ class TestValidatorPanel(wx.Panel):
fgs.Add((1,VSPACE)); fgs.Add((1,VSPACE))
label = wx.StaticText(self, -1, "Digits Only: ")
fgs.Add(label, 0, wx.ALIGN_RIGHT|wxCENTER)
fgs.Add(label, 0, wx.ALIGN_RIGHT|wx.CENTER)
fgs.Add(wx.TextCtrl(self, -1, "", validator = MyValidator(DIGIT_ONLY)))
fgs.Add((1,VSPACE)); fgs.Add((1,VSPACE))
fgs.Add((1,VSPACE)); fgs.Add((1,VSPACE))
fgs.Add((0,0))
b = wx.Button(self, -1, "Test Dialog Validation")
self.Bind(EVT_BUTTON, self.OnDoDialog, b)
self.Bind(wx.EVT_BUTTON, self.OnDoDialog, b)
fgs.Add(b)
border = wx.BoxSizer()
@@ -174,7 +174,7 @@ class TestValidateDialog(wx.Dialog):
fgs = wx.FlexGridSizer(0, 2)
fgs.Add((1,1));
fgs.Add(wxStaticText(self, -1,
fgs.Add(wx.StaticText(self, -1,
"These controls must have text entered into them. Each\n"
"one has a validator that is checked when the Okay\n"
"button is clicked."))