Removed automatic "Magic Event Methods" bindings

Added explicit bindings where needed
other assorted odds and ends


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7517 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2000-06-02 01:50:43 +00:00
parent c1af1ea6b5
commit a95ee79d9c
75 changed files with 494 additions and 238 deletions

View File

@@ -32,6 +32,7 @@ class TestPanel(wxPanel):
def __init__(self, parent, log):
wxPanel.__init__(self, parent, -1)
self.log = log
self.pdf = None
sizer = wxBoxSizer(wxVERTICAL)
btnSizer = wxBoxSizer(wxHORIZONTAL)
@@ -65,8 +66,10 @@ class TestPanel(wxPanel):
self.SetAutoLayout(true)
def __del__(self):
self.pdf.Cleanup()
self.pdf = None
if self.pdf:
self.pdf.Cleanup()
self.pdf = None
def OnOpenButton(self, event):
@@ -112,6 +115,7 @@ if __name__ == '__main__':
wxFrame.__init__(self, None, -1, "ActiveX test -- Acrobat", size=(640, 480),
style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)
self.tp = TestPanel(self, sys.stdout)
EVT_CLOSE(self, self.OnCloseWindow)
def OnCloseWindow(self, event):
self.tp.pdf.Cleanup()

View File

@@ -1,15 +1,20 @@
"""
<html><body>
This demo shows how to embed an ActiveX control in a wxPython application, (Win32 only.)
This demo shows how to embed an ActiveX control in a wxPython
application, (Win32 only.)
<p>
The MakeActiveXClass function dynamically builds a new Class on the fly, that has the
same signature and semantics as wxWindow. This means that when you call the function
you get back a new class that you can use just like wxWindow, (set the size and position,
use in a sizer, etc.) except its contents will be the COM control.
The MakeActiveXClass function dynamically builds a new Class on the
fly, that has the same signature and semantics as wxWindow. This
means that when you call the function you get back a new class that
you can use just like wxWindow, (set the size and position, use in a
sizer, etc.) except its contents will be the COM control.
<p>
This demo embeds the Internet Exploer WebBrowser control, and shows how to receive events
from the COM control. (The title bar and status bar are updated as pages change, in addition
to the log messages being shown.)
This demo embeds the Internet Exploer WebBrowser control, and shows
how to receive events from the COM control. (The title bar and status
bar are updated as pages change, in addition to the log messages being
shown.)
</body></html>
"""
@@ -30,6 +35,7 @@ if wxPlatform == '__WXMSW__':
class TestPanel(wxWindow):
def __init__(self, parent, log, frame=None):
wxWindow.__init__(self, parent, -1)#, style=wxCLIP_CHILDREN)
self.ie = None
self.log = log
self.current = "http://alldunn.com/"
self.frame = frame
@@ -83,14 +89,16 @@ class TestPanel(wxWindow):
self.SetSizer(sizer)
self.SetAutoLayout(true)
EVT_SIZE(self, self.OnSize)
def OnSize(self, evt):
self.Layout()
def __del__(self):
self.ie.Cleanup()
self.ie = None
if self.ie:
self.ie.Cleanup()
self.ie = None
def OnLocationSelect(self, evt):
url = self.location.GetStringSelection()
@@ -181,6 +189,7 @@ if __name__ == '__main__':
style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)
self.CreateStatusBar()
self.tp = TestPanel(self, sys.stdout, self)
EVT_CLOSE(self, self.OnCloseWindow)
def OnCloseWindow(self, event):
self.tp.ie.Cleanup()

View File

@@ -19,6 +19,7 @@ class DoodlePad(wxWindow):
EVT_LEFT_UP(self, self.OnLeftUp)
EVT_RIGHT_UP(self, self.OnRightUp)
EVT_MOTION(self, self.OnMotion)
EVT_PAINT(self, self.OnPaint)
def OnPaint(self, event):
@@ -153,6 +154,7 @@ class DoodleViewer(wxWindow):
self.x = self.y = 0
dt = DoodleDropTarget(self, log)
self.SetDropTarget(dt)
EVT_PAINT(self, self.OnPaint)
def SetLines(self, lines):
self.lines = lines

View File

@@ -29,6 +29,7 @@ class MyFrame(wxFrame):
# Associate some events with methods of this class
EVT_SIZE(self, self.OnSize)
EVT_MOVE(self, self.OnMove)
EVT_CLOSE(self, self.OnCloseWindow)
# Add a panel and some controls to display the size and position
panel = wxPanel(self, -1)

View File

@@ -78,6 +78,7 @@ class wxPythonDemo(wxFrame):
self.otherWin = None
EVT_IDLE(self, self.OnIdle)
EVT_CLOSE(self, self.OnCloseWindow)
self.Centre(wxBOTH)
self.CreateStatusBar(1, wxST_SIZEGRIP)

View File

@@ -292,6 +292,8 @@ class TestFrame(wxFrame):
self.CreateStatusBar()
self.SetStatusText("Resize this frame to see how the sizers respond...")
self.sizer.FitWindow(self)
EVT_CLOSE(self, self.OnCloseWindow)
EVT_SIZE(self, self.OnSize)
def OnSize(self, event):
@@ -378,6 +380,7 @@ if __name__ == '__main__':
EVT_MENU(self, 200, self.OnExit)
self.panel = TestSelectionPanel(self, self)
self.SetSize(wxSize(400, 380))
EVT_CLOSE(self, self.OnCloseWindow)
def OnCloseWindow(self, event):
self.Destroy()

View File

@@ -481,6 +481,7 @@ class TestFrame(wxFrame):
self.SetAutoLayout(true)
self.SetSizer(self.sizer)
EVT_CLOSE(self, self.OnCloseWindow)
def OnCloseWindow(self, event):
self.MakeModal(false)
@@ -563,6 +564,7 @@ if __name__ == '__main__':
EVT_MENU(self, 200, self.OnExit)
self.panel = TestSelectionPanel(self, self)
self.SetSize(wxSize(400, 380))
EVT_CLOSE(self, self.OnCloseWindow)
def OnCloseWindow(self, event):
self.Destroy()

View File

@@ -43,6 +43,7 @@ class HTMLTextView(wxFrame):
wxFrame.__init__(self, parent, id, title, wxPyDefaultPosition,
wxSize(600,400))
EVT_CLOSE(self, self.OnCloseWindow)
self.mainmenu = wxMenuBar()
menu = wxMenu()
@@ -155,6 +156,7 @@ class AppStatusBar(wxStatusBar):
self.SetStatusWidths([-1, 100])
self.but = wxButton(self, 1001, "Refresh")
EVT_BUTTON(self, 1001, parent.OnViewRefresh)
EVT_SIZE(self, self.OnSize)
self.OnSize(None)
def logprint(self,x):

View File

@@ -77,6 +77,9 @@ class GraphWindow(wxWindow):
self.colors = [ wxRED, wxGREEN, wxBLUE, wxCYAN,
wxNamedColour("Yellow"), wxNamedColor("Navy") ]
EVT_ERASE_BACKGROUND(self, self.OnEraseBackground)
EVT_PAINT(self, self.OnPaint)
def SetValue(self, index, value):
assert index < len(self.values)
@@ -185,6 +188,7 @@ class TestFrame(wxFrame):
for t in self.threads:
t.Start()
EVT_CLOSE(self, self.OnCloseWindow)
def OnUpdate(self, evt):

View File

@@ -124,6 +124,8 @@ class HangmanWnd(wxWindow):
else:
self.font = wxFont(10, wxMODERN, wxNORMAL, wxNORMAL)
self.SetFocus()
EVT_PAINT(self, self.OnPaint)
def StartGame(self, word):
self.word = word
@@ -252,6 +254,7 @@ class HangmanDemoFrame(wxFrame):
def __init__(self, wf, parent, id, pos, size):
wxFrame.__init__(self, parent, id, "Hangman demo", pos, size)
self.demo = HangmanDemo(wf, self, -1, wxDefaultPosition, wxDefaultSize)
EVT_CLOSE(self, self.OnCloseWindow)
def OnCloseWindow(self, event):
self.demo.timer.Stop()

View File

@@ -37,7 +37,8 @@ class RunDemoApp(wxApp):
def OnInit(self):
wxInitAllImageHandlers()
frame = wxFrame(None, -1, "RunDemo: " + self.name, size=(0,0))
frame = wxFrame(None, -1, "RunDemo: " + self.name, size=(0,0),
style=wxNO_FULL_REPAINT_ON_RESIZE|wxDEFAULT_FRAME_STYLE)
frame.CreateStatusBar()
frame.Show(true)
win = self.demoModule.runTest(frame, frame, Log())
@@ -80,7 +81,6 @@ def main(argv):
name = argv[1]
if name[-3:] == '.py':
name = name[:-3]
print name
module = __import__(name)

View File

@@ -175,8 +175,6 @@ class TestPanel(wxPanel):
text = '%s CLICK %02d/%02d/%d' % (evt.click, evt.day, evt.month, evt.year) # format date
self.log.WriteText('Date Selected: ' + text + '\n')
def OnCloseWindow(self, event):
self.Destroy()
# set the highlighted days for the calendar
@@ -317,6 +315,7 @@ class CalenDlg(wxDialog):
class CalendFrame(wxFrame):
def __init__(self, parent, id, title, log):
wxFrame.__init__(self, parent, id, title, wxPyDefaultPosition, wxSize(400, 400))
EVT_CLOSE(self, self.OnCloseWindow)
self.log = log
self.CreateStatusBar()
@@ -574,9 +573,6 @@ class PrintCalend:
return year, month
def OnCloseWindow(self, event):
self.Destroy()
def GetTotalPages(self):
self.pg_cnt = 1
return self.pg_cnt

View File

@@ -49,6 +49,7 @@ class TestFloatBar(wxFrame):
tb.Realize()
self.tb = tb
EVT_CLOSE(self, self.OnCloseWindow)
def OnCloseWindow(self, event):

View File

@@ -11,6 +11,8 @@ class MyFrame(wxFrame):
button = wxButton(panel, 1003, "Close Me")
button.SetPosition(wxPoint(15, 15))
EVT_BUTTON(self, 1003, self.OnCloseMe)
EVT_CLOSE(self, self.OnCloseWindow)
def OnCloseMe(self, event):
self.Close(true)

View File

@@ -59,6 +59,8 @@ else:
def __init__(self, parent):
wxGLCanvas.__init__(self, parent, -1)
EVT_ERASE_BACKGROUND(self, self.OnEraseBackground)
EVT_SIZE(self, self.OnSize)
EVT_PAINT(self, self.OnPaint)
self.init = false
def OnEraseBackground(self, event):
@@ -148,6 +150,8 @@ else:
def __init__(self, parent):
wxGLCanvas.__init__(self, parent, -1)
EVT_ERASE_BACKGROUND(self, self.OnEraseBackground)
EVT_SIZE(self, self.OnSize)
EVT_PAINT(self, self.OnPaint)
self.init = false
def OnEraseBackground(self, event):

View File

@@ -93,6 +93,7 @@ class TestListCtrlPanel(wxPanel):
self.list.SetItemState(5, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED)
self.currentItem = 0
EVT_SIZE(self, self.OnSize)
EVT_LIST_ITEM_SELECTED(self, tID, self.OnItemSelected)
EVT_LIST_DELETE_ITEM(self, tID, self.OnItemDelete)
EVT_LIST_COL_CLICK(self, tID, self.OnColClick)

View File

@@ -53,6 +53,7 @@ class TestMaskWindow(wxScrolledWindow):
self.SetScrollbars(20, 20, 700/20, 460/20)
EVT_PAINT(self, self.OnPaint)
def OnPaint (self, e):

View File

@@ -10,6 +10,7 @@ class MyMiniFrame(wxMiniFrame):
button = wxButton(panel, 1003, "Close Me")
button.SetPosition(wxPoint(15, 15))
EVT_BUTTON(self, 1003, self.OnCloseMe)
EVT_CLOSE(self, self.OnCloseWindow)
def OnCloseMe(self, event):
self.Close(true)

View File

@@ -17,6 +17,7 @@ class TestSashWindow(wxPanel):
EVT_SASH_DRAGGED_RANGE(self, self.ID_WINDOW_TOP,
self.ID_WINDOW_BOTTOM, self.OnSashDrag)
EVT_SIZE(self, self.OnSize)
# Create some layout windows

View File

@@ -12,9 +12,12 @@ class MyCanvas(wxScrolledWindow):
self.maxHeight = 1000
self.SetBackgroundColour(wxNamedColor("WHITE"))
self.Connect(-1, -1, wxEVT_LEFT_DOWN, self.OnLeftButtonEvent)
self.Connect(-1, -1, wxEVT_LEFT_UP, self.OnLeftButtonEvent)
self.Connect(-1, -1, wxEVT_MOTION, self.OnLeftButtonEvent)
EVT_LEFT_DOWN(self, self.OnLeftButtonEvent)
EVT_LEFT_UP(self, self.OnLeftButtonEvent)
EVT_MOTION(self, self.OnLeftButtonEvent)
EVT_PAINT(self, self.OnPaint)
self.SetCursor(wxStockCursor(wxCURSOR_PENCIL))
bmp = wxBitmap('bitmaps/test2.bmp', wxBITMAP_TYPE_BMP)
@@ -109,7 +112,6 @@ class MyCanvas(wxScrolledWindow):
self.CaptureMouse()
elif event.Dragging():
print event.GetPosition()
dc = wxClientDC(self)
self.PrepareDC(dc)
dc.BeginDrawing()

View File

@@ -10,6 +10,7 @@ class CustomStatusBar(wxStatusBar):
wxStatusBar.__init__(self, parent, -1)
self.SetFieldsCount(3)
self.log = log
EVT_SIZE(self, self.OnSize)
self.SetStatusText("A Custom StatusBar...", 0)
@@ -62,6 +63,7 @@ class TestCustomStatusBar(wxFrame):
self.sb = CustomStatusBar(self, log)
self.SetStatusBar(self.sb)
EVT_CLOSE(self, self.OnCloseWindow)
def OnCloseWindow(self, event):
self.sb.timer.Stop()

View File

@@ -9,7 +9,8 @@ class TestPanel(wxPanel):
self.log = log
wxStaticText(self, -1, "wxTextCtrl", wxPoint(5, 25), wxSize(75, 20))
wxTextCtrl(self, 10, "", wxPoint(80, 25), wxSize(150, 20))
t = wxTextCtrl(self, 10, "Test it out and see", wxPoint(80, 25), wxSize(150, 20))
t.SetInsertionPoint(0)
EVT_TEXT(self, 10, self.EvtText)
wxStaticText(self, -1, "Passsword", wxPoint(5, 50), wxSize(75, 20))
@@ -17,7 +18,8 @@ class TestPanel(wxPanel):
EVT_TEXT(self, 20, self.EvtText)
wxStaticText(self, -1, "Multi-line", wxPoint(5, 75), wxSize(75, 20))
wxTextCtrl(self, 30, "", wxPoint(80, 75), wxSize(200, 150), wxTE_MULTILINE)
t = wxTextCtrl(self, 30, "How does it work with a long line of text set in the control", wxPoint(80, 75), wxSize(200, 150), wxTE_MULTILINE)
t.SetInsertionPoint(0)
EVT_TEXT(self, 30, self.EvtText)
def EvtText(self, event):

View File

@@ -55,6 +55,7 @@ class TestToolBar(wxFrame):
size=(150,-1), style=wxCB_DROPDOWN))
tb.Realize()
EVT_CLOSE(self, self.OnCloseWindow)
def OnCloseWindow(self, event):

View File

@@ -22,6 +22,7 @@ class MyTreeCtrl(wxTreeCtrl):
class TestTreeCtrlPanel(wxPanel):
def __init__(self, parent, log):
wxPanel.__init__(self, parent, -1)
EVT_SIZE(self, self.OnSize)
self.log = log
tID = NewId()