The demo framework can now notify the individual samples before it

switches to another, in case they need to shut down something or free
resources, etc.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@18625 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2003-01-07 19:59:45 +00:00
parent 3fc4d88ac7
commit ba74ca2dcc
2 changed files with 12 additions and 1 deletions

View File

@@ -239,6 +239,7 @@ class wxPythonDemo(wxFrame):
self.cwd = os.getcwd()
self.curOverview = ""
self.window = None
icon = images.getMondrianIcon()
self.SetIcon(icon)
@@ -453,6 +454,10 @@ class wxPythonDemo(wxFrame):
if self.nb.GetPageCount() == 3:
if self.nb.GetSelection() == 2:
self.nb.SetSelection(0)
# inform the window that it's time to quit if it cares
if self.window is not None:
if hasattr(self.window, "ShutdownDemo"):
self.window.ShutdownDemo()
wxSafeYield() # in case the page has pending events
self.nb.DeletePage(2)
@@ -479,7 +484,7 @@ class wxPythonDemo(wxFrame):
wxSafeYield()
self.window = module.runTest(self, self.nb, self) ###
if self.window:
if self.window is not None:
self.nb.AddPage(self.window, 'Demo')
self.nb.SetSelection(2)
self.nb.Refresh() # without this wxMac has troubles showing the just added page

View File

@@ -145,6 +145,12 @@ class TestPanel(wxPanel):
self.otherThrobber.Start()
self.otherThrobber.SetLabel("Stop")
def ShutdownDemo(self):
print "ShutdownDemo"
self.otherThrobber.Rest()
for t in self.throbbers.keys():
self.throbbers[t]['throbber'].Rest()
#----------------------------------------------------------------------