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:
@@ -304,6 +304,7 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
class TestApp(wxApp):
|
class TestApp(wxApp):
|
||||||
def OnInit(self):
|
def OnInit(self):
|
||||||
|
wxInitAllImageHandlers()
|
||||||
self.MakeFrame()
|
self.MakeFrame()
|
||||||
return true
|
return true
|
||||||
|
|
||||||
|
@@ -126,7 +126,7 @@ class TestPanel(wxPanel):
|
|||||||
EVT_WINDOW_DESTROY(self, self.OnDestroy)
|
EVT_WINDOW_DESTROY(self, self.OnDestroy)
|
||||||
|
|
||||||
def OnDestroy(self, event):
|
def OnDestroy(self, event):
|
||||||
self.log.write("got it")
|
self.log.write("got destroy event")
|
||||||
event.Skip()
|
event.Skip()
|
||||||
|
|
||||||
def OnStartAnimation(self, event):
|
def OnStartAnimation(self, event):
|
||||||
@@ -155,7 +155,7 @@ class TestPanel(wxPanel):
|
|||||||
|
|
||||||
def runTest(frame, nb, log):
|
def runTest(frame, nb, log):
|
||||||
if wxPlatform == "__WXMAC__":
|
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")
|
"Sorry")
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
|
@@ -52,6 +52,8 @@ class RunDemoApp(wxApp):
|
|||||||
menuBar.Append(menu, "&File")
|
menuBar.Append(menu, "&File")
|
||||||
frame.SetMenuBar(menuBar)
|
frame.SetMenuBar(menuBar)
|
||||||
frame.Show(true)
|
frame.Show(true)
|
||||||
|
EVT_CLOSE(frame, self.OnCloseFrame)
|
||||||
|
|
||||||
win = self.demoModule.runTest(frame, frame, Log())
|
win = self.demoModule.runTest(frame, frame, Log())
|
||||||
|
|
||||||
# a window will be returned if the demo does not create
|
# 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
|
# so set the frame to a good size for showing stuff
|
||||||
frame.SetSize((640, 480))
|
frame.SetSize((640, 480))
|
||||||
win.SetFocus()
|
win.SetFocus()
|
||||||
|
self.window = win
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# otherwise the demo made its own frame, so just put a
|
# otherwise the demo made its own frame, so just put a
|
||||||
@@ -84,6 +87,13 @@ class RunDemoApp(wxApp):
|
|||||||
def OnButton(self, evt):
|
def OnButton(self, evt):
|
||||||
self.frame.Close(true)
|
self.frame.Close(true)
|
||||||
|
|
||||||
|
|
||||||
|
def OnCloseFrame(self, evt):
|
||||||
|
if hasattr(self, "window") and hasattr(self.window, "ShutdownDemo"):
|
||||||
|
self.window.ShutdownDemo()
|
||||||
|
evt.Skip()
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
@@ -16,7 +16,7 @@ class DragShape:
|
|||||||
|
|
||||||
def HitTest(self, pt):
|
def HitTest(self, pt):
|
||||||
rect = self.GetRect()
|
rect = self.GetRect()
|
||||||
return rect.Inside(pt.x, pt.y)
|
return rect.InsideXY(pt.x, pt.y)
|
||||||
|
|
||||||
|
|
||||||
def GetRect(self):
|
def GetRect(self):
|
||||||
@@ -274,3 +274,10 @@ def runTest(frame, nb, log):
|
|||||||
|
|
||||||
overview = """\
|
overview = """\
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
import sys,os
|
||||||
|
import run
|
||||||
|
run.main(['', os.path.basename(sys.argv[0])])
|
||||||
|
|
||||||
|
@@ -114,3 +114,11 @@ def runTest(frame, nb, log):
|
|||||||
|
|
||||||
overview = """\
|
overview = """\
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
import sys,os
|
||||||
|
import run
|
||||||
|
run.main(['', os.path.basename(sys.argv[0])])
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user