demo tweaks

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@19268 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2003-02-20 19:18:42 +00:00
parent 6ceec818b2
commit 3b2012561d
5 changed files with 29 additions and 3 deletions

View File

@@ -304,6 +304,7 @@ if __name__ == '__main__':
class TestApp(wxApp):
def OnInit(self):
wxInitAllImageHandlers()
self.MakeFrame()
return true

View File

@@ -126,7 +126,7 @@ class TestPanel(wxPanel):
EVT_WINDOW_DESTROY(self, self.OnDestroy)
def OnDestroy(self, event):
self.log.write("got it")
self.log.write("got destroy event")
event.Skip()
def OnStartAnimation(self, event):
@@ -155,7 +155,7 @@ class TestPanel(wxPanel):
def runTest(frame, nb, log):
if wxPlatform == "__WXMAC__":
wxMessageBox("This demo currently fails on the Mac, I think because of the lack of EVT_WINDOW_DESTROY...",
wxMessageBox("This demo currently fails on the Mac.",
"Sorry")
return
else:

View File

@@ -52,6 +52,8 @@ class RunDemoApp(wxApp):
menuBar.Append(menu, "&File")
frame.SetMenuBar(menuBar)
frame.Show(true)
EVT_CLOSE(frame, self.OnCloseFrame)
win = self.demoModule.runTest(frame, frame, Log())
# a window will be returned if the demo does not create
@@ -60,6 +62,7 @@ class RunDemoApp(wxApp):
# so set the frame to a good size for showing stuff
frame.SetSize((640, 480))
win.SetFocus()
self.window = win
else:
# otherwise the demo made its own frame, so just put a
@@ -84,6 +87,13 @@ class RunDemoApp(wxApp):
def OnButton(self, evt):
self.frame.Close(true)
def OnCloseFrame(self, evt):
if hasattr(self, "window") and hasattr(self.window, "ShutdownDemo"):
self.window.ShutdownDemo()
evt.Skip()
#----------------------------------------------------------------------------

View File

@@ -16,7 +16,7 @@ class DragShape:
def HitTest(self, pt):
rect = self.GetRect()
return rect.Inside(pt.x, pt.y)
return rect.InsideXY(pt.x, pt.y)
def GetRect(self):
@@ -274,3 +274,10 @@ def runTest(frame, nb, log):
overview = """\
"""
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])

View File

@@ -114,3 +114,11 @@ def runTest(frame, nb, log):
overview = """\
"""
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])