Cleanup up the demo a bit

Added wxWave

Added another patch for SWIG that optimizes the generated code some
and eliminates some unused type mappings in the type registry.
(Reduces it by about half!)


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10218 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2001-05-18 21:59:59 +00:00
parent c20a12bd55
commit 493f1553fd
73 changed files with 3330 additions and 14483 deletions

View File

@@ -87,31 +87,4 @@ def runTest(frame, nb, log):
overview = """\
A checkbox is a labelled box which is either on (checkmark is visible) or off (no checkmark).
wxCheckBox()
-----------------------
Default constructor.
wxCheckBox(wxWindow* parent, wxWindowID id, const wxString& label, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxValidator& val, const wxString& name = "checkBox")
Constructor, creating and showing a checkbox.
Parameters
-------------------
parent = Parent window. Must not be NULL.
id = Checkbox identifier. A value of -1 indicates a default value.
label = Text to be displayed next to the checkbox.
pos = Checkbox position. If the position (-1, -1) is specified then a default position is chosen.
size = Checkbox size. If the default size (-1, -1) is specified then a default size is chosen.
style = Window style. See wxCheckBox.
validator = Window validator.
name = Window name.
"""

View File

@@ -87,7 +87,7 @@ if __name__ == "__main__":
def OnInit(self):
# Create an instance of our customized Frame class
frame = MyFrame(NULL, -1, "This is a test")
frame = MyFrame(None, -1, "This is a test")
frame.Show(true)
# Tell wxWindows that this is our main window

View File

@@ -23,7 +23,7 @@ import images
_treeList = [
('New since last release', ['ColourSelect', 'ImageBrowser', 'infoframe',
'ColourDB', 'wxToggleButton', 'OOR',
'ColourDB', 'wxToggleButton', 'OOR', 'wxWave',
]),
('Managed Windows', ['wxFrame', 'wxDialog', 'wxMiniFrame']),
@@ -53,7 +53,7 @@ _treeList = [
'wxImage', 'wxMask', 'PrintFramework', 'wxOGL',
'PythonEvents', 'Threads',
'ActiveXWrapper_Acrobat', 'ActiveXWrapper_IE',
'wxDragImage', "wxProcess", "FancyText", "OOR",
'wxDragImage', "wxProcess", "FancyText", "OOR", "wxWave",
]),
('wxPython Library', ['Layoutf', 'wxScrolledMessageDialog',

View File

@@ -27,7 +27,7 @@ class TestPanel(wxPanel):
btns.Add(self.btn2)
btns.Add(50, -1, 1, wxEXPAND)
sizer.Add(btns, 0, wxEXPAND|wxLEFT|wxRIGHT|wxBOTTOM, 5)
sizer.Add(btns, 0, wxEXPAND|wxLEFT|wxRIGHT|wxBOTTOM, 25)
self.SetSizer(sizer)
self.SetAutoLayout(true)

View File

@@ -553,7 +553,7 @@ if __name__ == '__main__':
class MainFrame(wxFrame):
def __init__(self):
wxFrame.__init__(self, NULL, -1, "Testing...")
wxFrame.__init__(self, None, -1, "Testing...")
self.CreateStatusBar()
mainmenu = wxMenuBar()

View File

@@ -352,7 +352,7 @@ class AppFrame(wxFrame):
if __name__ == '__main__':
class MyApp(wxApp):
def OnInit(self):
frame = AppFrame(NULL, -1, "Slashdot Breaking News")
frame = AppFrame(None, -1, "Slashdot Breaking News")
frame.Show(true)
self.SetTopWindow(frame)
return true
@@ -366,7 +366,7 @@ if __name__ == '__main__':
# if running as part of the Demo Framework...
def runTest(frame, nb, log):
win = AppFrame(NULL, -1, "Slashdot Breaking News")
win = AppFrame(None, -1, "Slashdot Breaking News")
frame.otherWin = win
win.Show(true)

View File

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

BIN
wxPython/demo/data/plan.wav Normal file

Binary file not shown.

View File

@@ -103,7 +103,7 @@ class MyApp(wxApp):
def OnInit(self):
frame = MyFrame(NULL, -1, "This is a test")
frame = MyFrame(None, -1, "This is a test")
frame.Show(true)
self.SetTopWindow(frame)

View File

@@ -25,7 +25,7 @@ command_lines = [
"-a -n TestMask bmp_source/testmask.bmp images.py",
"-a -n Test2 bmp_source/test2.bmp images.py",
"-a -n Robin bmp_source/robin.jpg images.py",
# "-a -n Robin bmp_source/robin.jpg images.py",
"-a -n Bulb1 bmp_source/lb1.bmp images.py",
"-a -n Bulb2 bmp_source/lb2.bmp images.py",

View File

@@ -431,7 +431,7 @@ class MyApp(wxApp):
else:
defaultfile = ""
wf = WordFetcher(defaultfile)
frame = MyFrame(NULL, wf)
frame = MyFrame(None, wf)
self.SetTopWindow(frame)
frame.Show(TRUE)
return TRUE

File diff suppressed because it is too large Load Diff

View File

@@ -83,6 +83,7 @@ class pyTree(wx.wxTreeCtrl):
wx.EVT_TREE_ITEM_COLLAPSED(self, self.GetId(), self.OnItemCollapsed)
wx.EVT_TREE_SEL_CHANGED(self, self.GetId(), self.OnSelChanged)
self.output = None
self.Expand(self.root)
def SetOutput(self, output):
@@ -111,6 +112,8 @@ class pyTree(wx.wxTreeCtrl):
will again figure out what the offspring is.
"""
item = event.GetItem()
if self.IsExpanded(item): # This event can happen twice in the self.Expand call
return
obj = self.GetPyData( item )
lst = dir(obj)
for key in lst:
@@ -186,7 +189,7 @@ if __name__ == '__main__':
def __init__(self):
"""Make a splitter window; left a tree, right a textctrl. Wow."""
import __main__
wx.wxFrame.__init__(self, wx.NULL, -1, "PyTreeItemData Test",
wx.wxFrame.__init__(self, None, -1, "PyTreeItemData Test",
wx.wxDefaultPosition, wx.wxSize(800,500))
split = wx.wxSplitterWindow(self, -1)
tree = pyTree(split, -1, __main__)

View File

@@ -20,42 +20,50 @@ class VtkFrame(wxFrame):
coneActor = vtk.vtkActor()
coneActor.SetMapper(coneMapper)
ren.AddActor(coneActor)
#---------------------------------------------------------------------------
wxEVT_ADD_CONE = 25015
def EVT_ADD_CONE(win, func):
win.Connect(-1, -1, wxEVT_ADD_CONE, func)
class AddCone(wxPyEvent):
def __init__(self):
wxPyEvent.__init__(self)
self.SetEventType(wxEVT_ADD_CONE)
class HiddenCatcher(wxFrame):
"""
The "catcher" frame in the second thread.
It is invisible. It's only job is to receive
Events from the main thread, and create
Events from the main thread, and create
the appropriate windows.
"""
"""
def __init__(self):
wxFrame.__init__(self, NULL,-1,'')
wxFrame.__init__(self, None, -1, '')
EVT_ADD_CONE(self, self.AddCone)
def AddCone(self,evt):
def AddCone(self,evt):
add_cone()
#---------------------------------------------------------------------------
class SecondThreadApp(wxApp):
"""
wxApp that lives in the second thread.
"""
"""
def OnInit(self):
catcher = HiddenCatcher()
#self.SetTopWindow(catcher)
self.catcher =catcher
return true
#---------------------------------------------------------------------------
def add_cone():
frame = VtkFrame(NULL, -1, "Cone")
def add_cone():
frame = VtkFrame(None, -1, "Cone")
frame.Show(true)

View File

@@ -419,7 +419,7 @@ class PrintCalend:
pdd.SetPrintData(self.printData)
printer = wxPrinter(pdd)
printout = SetPrintout(self)
frame = wxFrame(NULL, -1, "Test")
frame = wxFrame(None, -1, "Test")
if not printer.Print(frame, printout):
wxMessageBox("There was a problem printing.\nPerhaps your current printer is not set correctly?", "Printing", wxOK)
else:
@@ -594,7 +594,7 @@ class SetPrintout(wxPrintout):
class MyApp(wxApp):
def OnInit(self):
frame = CalendFrame(NULL, -1, "Test Calendar")
frame = CalendFrame(None, -1, "Test Calendar")
frame.Show(true)
self.SetTopWindow(frame)
return true

View File

@@ -50,31 +50,4 @@ def runTest(frame, nb, log):
overview = """\
A checkbox is a labelled box which is either on (checkmark is visible) or off (no checkmark).
wxCheckBox()
-----------------------
Default constructor.
wxCheckBox(wxWindow* parent, wxWindowID id, const wxString& label, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxValidator& val, const wxString& name = "checkBox")
Constructor, creating and showing a checkbox.
Parameters
-------------------
parent = Parent window. Must not be NULL.
id = Checkbox identifier. A value of -1 indicates a default value.
label = Text to be displayed next to the checkbox.
pos = Checkbox position. If the position (-1, -1) is specified then a default position is chosen.
size = Checkbox size. If the default size (-1, -1) is specified then a default size is chosen.
style = Window style. See wxCheckBox.
validator = Window validator.
name = Window name.
"""

View File

@@ -43,34 +43,4 @@ def runTest(frame, nb, log):
overview = """\
A choice item is used to select one of a list of strings. Unlike a listbox, only the selection is visible until the user pulls down the menu of choices.
wxChoice()
-------------------
Default constructor.
wxChoice(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, int n, const wxString choices[], long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = "choice")
Constructor, creating and showing a choice.
Parameters
-------------------
parent = Parent window. Must not be NULL.
id = Window identifier. A value of -1 indicates a default value.
pos = Window position.
size = Window size. If the default size (-1, -1) is specified then the choice is sized appropriately.
n = Number of strings with which to initialise the choice control.
choices = An array of strings with which to initialise the choice control.
style = Window style. See wxChoice.
validator = Window validator.
name = Window name.
"""

View File

@@ -27,11 +27,5 @@ def runTest(frame, nb, log):
overview = """\
This class represents the colour chooser dialog.
wxColourDialog()
------------------------------
wxColourDialog(wxWindow* parent, wxColourData* data = NULL)
Constructor. Pass a parent window, and optionally a pointer to a block of colour data, which will be copied to the colour dialog's colour data.
"""

View File

@@ -49,35 +49,4 @@ def runTest(frame, nb, log):
overview = """\
A combobox is like a combination of an edit control and a listbox. It can be displayed as static list with editable or read-only text field; or a drop-down list with text field; or a drop-down list without a text field.
A combobox permits a single selection only. Combobox items are numbered from zero.
wxComboBox()
-----------------------
Default constructor.
wxComboBox(wxWindow* parent, wxWindowID id, const wxString& value = "", const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, int n, const wxString choices[], long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = "comboBox")
Constructor, creating and showing a combobox.
Parameters
-------------------
parent = Parent window. Must not be NULL.
id = Window identifier. A value of -1 indicates a default value.
pos = Window position.
size = Window size. If the default size (-1, -1) is specified then the window is sized appropriately.
n = Number of strings with which to initialise the control.
choices = An array of strings with which to initialise the control.
style = Window style. See wxComboBox.
validator = Window validator.
name = Window name.
"""

View File

@@ -233,7 +233,7 @@ overview = """\
def _test():
class MyApp(wxApp):
def OnInit(self):
frame = wxFrame(NULL, -1, "GL Demos", wxDefaultPosition, wxSize(600,300))
frame = wxFrame(None, -1, "GL Demos", wxDefaultPosition, wxSize(600,300))
#win = ConeCanvas(frame)
MySplitter(frame)
frame.Show(TRUE)

View File

@@ -124,35 +124,4 @@ def runTest(frame, nb, log):
overview = """\
A listbox is used to select one or more of a list of strings. The strings are displayed in a scrolling box, with the selected string(s) marked in reverse video. A listbox can be single selection (if an item is selected, the previous selection is removed) or multiple selection (clicking an item toggles the item on or off independently of other selections).
List box elements are numbered from zero.
wxListBox()
---------------------
Default constructor.
wxListBox(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, int n, const wxString choices[] = NULL, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = "listBox")
Constructor, creating and showing a list box.
Parameters
-------------------
parent = Parent window. Must not be NULL.
id = Window identifier. A value of -1 indicates a default value.
pos = Window position.
size = Window size. If the default size (-1, -1) is specified then the window is sized appropriately.
n = Number of strings with which to initialise the control.
choices = An array of strings with which to initialise the control.
style = Window style. See wxListBox.
validator = Window validator.
name = Window name.
"""

View File

@@ -241,29 +241,4 @@ def runTest(frame, nb, log):
overview = """\
A list control presents lists in a number of formats: list view, report view, icon view and small icon view. Elements are numbered from zero.
wxListCtrl()
------------------------
Default constructor.
wxListCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxLC_ICON, const wxValidator& validator = wxDefaultValidator, const wxString& name = "listCtrl")
Constructor, creating and showing a list control.
Parameters
-------------------
parent = Parent window. Must not be NULL.
id = Window identifier. A value of -1 indicates a default value.
pos = Window position.
size = Window size. If the default size (-1, -1) is specified then the window is sized appropriately.
style = Window style. See wxListCtrl.
validator = Window validator.
name = Window name.
"""

View File

@@ -50,37 +50,6 @@ def runTest(frame, nb, log):
overview = """\
A radio box item is used to select one of number of mutually exclusive choices. It is displayed as a vertical column or horizontal row of labelled buttons.
wxRadioBox()
----------------------
Default constructor.
wxRadioBox(wxWindow* parent, wxWindowID id, const wxString& label, const wxPoint& point = wxDefaultPosition, const wxSize& size = wxDefaultSize, int n = 0, const wxString choices[] = NULL, int majorDimension = 0, long style = wxRA_SPECIFY_COLS, const wxValidator& validator = wxDefaultValidator, const wxString& name = "radioBox")
Constructor, creating and showing a radiobox.
Parameters
-------------------
parent = Parent window. Must not be NULL.
id = Window identifier. A value of -1 indicates a default value.
label = Label for the static box surrounding the radio buttons.
pos = Window position. If the position (-1, -1) is specified then a default position is chosen.
size = Window size. If the default size (-1, -1) is specified then a default size is chosen.
n = Number of choices with which to initialize the radiobox.
choices = An array of choices with which to initialize the radiobox.
majorDimension = Specifies the maximum number of rows (if style contains wxRA_SPECIFY_ROWS) or columns (if style contains wxRA_SPECIFY_COLS) for a two-dimensional radiobox.
style = Window style. See wxRadioBox.
validator = Window validator.
name = Window name.
"""

View File

@@ -28,32 +28,5 @@ def runTest(frame, nb, log):
overview = """\
This class represents a dialog that shows a list of strings, and allows the user to select one. Double-clicking on a list item is equivalent to single-clicking and then pressing OK.
wxSingleChoiceDialog()
---------------------------------------------
wxSingleChoiceDialog(wxWindow* parent, const wxString& message, const wxString& caption, int n, const wxString* choices, char** clientData = NULL, long style = wxOK | wxCANCEL | wxCENTRE, const wxPoint& pos = wxDefaultPosition)
Constructor, taking an array of wxString choices and optional client data.
Parameters
-------------------
parent = Parent window.
message = Message to show on the dialog.
caption = The dialog caption.
n = The number of choices.
choices = An array of strings, or a string list, containing the choices.
style = A dialog style (bitlist) containing flags chosen from the following:
wxOK Show an OK button.
wxCANCEL Show a Cancel button.
wxCENTRE Centre the message. Not Windows.
pos = Dialog position.
"""

View File

@@ -20,7 +20,11 @@ class TestPanel(wxPanel):
wxStaticBitmap(self, -1, bmp, wxPoint(80, 50),
wxSize(bmp.GetWidth(), bmp.GetHeight()))
bmp = images.getRobinBitmap()
# This one doesn't convert to the embedded format very well,
# (lots of colors so it explodes in size and takes a noticable
# amount of time to convert back to a bitmap.) So we'll just
# do it the old way
bmp = wxBitmap('bitmaps/robin.jpg', wxBITMAP_TYPE_JPEG)
wxStaticBitmap(self, -1, bmp, (80, 150))
wxStaticText(self, -1, "Hey, if Ousterhout can do it, so can I.",

View File

@@ -43,31 +43,6 @@ def runTest(frame, nb, log):
overview = '''\
A static text control displays one or more lines of read-only text.
wxStaticText()
-------------------------
Default constructor.
wxStaticText(wxWindow* parent, wxWindowID id, const wxString& label = "", const wxPoint& pos, const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = "staticText")
Constructor, creating and showing a text control.
Parameters
-------------------
parent = Parent window. Should not be NULL.
id = Control identifier. A value of -1 denotes a default value.
label = Text label.
pos = Window position.
size = Window size.
style = Window style. See wxStaticText.
name = Window name.
'''
#---------------------------------------------------------------------------

View File

@@ -176,29 +176,4 @@ def runTest(frame, nb, log):
overview = """\
A tree control presents information as a hierarchy, with items that may be expanded to show further items. Items in a tree control are referenced by wxTreeItemId handles.
wxTreeCtrl()
-------------------------
Default constructor.
wxTreeCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTR_HAS_BUTTONS, const wxValidator& validator = wxDefaultValidator, const wxString& name = "listCtrl")
Constructor, creating and showing a tree control.
Parameters
-------------------
parent = Parent window. Must not be NULL.
id = Window identifier. A value of -1 indicates a default value.
pos = Window position.
size = Window size. If the default size (-1, -1) is specified then the window is sized appropriately.
style = Window style. See wxTreeCtrl.
validator = Window validator.
name = Window name.
"""

36
wxPython/demo/wxWave.py Normal file
View File

@@ -0,0 +1,36 @@
from wxPython.wx import *
#----------------------------------------------------------------------
class TestPanel(wxPanel):
def __init__(self, parent):
wxPanel.__init__(self, parent, -1)
b = wxButton(self, -1, "Play Sound", (25, 25))
EVT_BUTTON(self, b.GetId(), self.OnButton)
def OnButton(self, evt):
try:
import time
if int(time.time()) % 2 == 1:
wave = wxWave('data/anykey.wav')
else:
wave = wxWave('data/plan.wav')
wave.Play()
except NotImplementedError, v:
wxMessageBox(str(v), "Exception Message")
#----------------------------------------------------------------------
def runTest(frame, nb, log):
win = TestPanel(nb)
return win
#----------------------------------------------------------------------
overview = """\
"""