- if xxx.__class__ == xxxFrame:
- # Frame can't have many children,
- # but it's first child possibly can...
-# child = self.GetFirstChild(item)[0]
-# if child.IsOk() and self.GetPyData(child).__class__ == xxxPanel:
-# # Clean-up before recursive call or error
-# wxMemoryFSHandler_RemoveFile('xxx.xrc')
-# wxEndBusyCursor()
-# self.CreateTestWin(child)
-# return
- # This currently works under GTK, but not under MSW
- testWin = g.testWin = wxPreFrame()
- res.LoadOnFrame(testWin, g.frame, STD_NAME)
- # Create status bar
- testWin.panel = testWin
- testWin.CreateStatusBar()
- testWin.SetClientSize(testWin.GetBestSize())
- testWin.panel = testWin
- testWin.SetPosition(pos)
- testWin.Show(True)
- elif xxx.__class__ == xxxPanel:
- # Create new frame
- if not testWin:
- testWin = g.testWin = wxFrame(g.frame, -1, 'Panel: ' + name,
+ try:
+ if xxx.__class__ == xxxFrame:
+ # Frame can't have many children,
+ # but it's first child possibly can...
+ # child = self.GetFirstChild(item)[0]
+ # if child.IsOk() and self.GetPyData(child).__class__ == xxxPanel:
+ # # Clean-up before recursive call or error
+ # wxMemoryFSHandler_RemoveFile('xxx.xrc')
+ # wxEndBusyCursor()
+ # self.CreateTestWin(child)
+ # return
+ # This currently works under GTK, but not under MSW
+ testWin = g.testWin = wxPreFrame()
+ res.LoadOnFrame(testWin, g.frame, STD_NAME)
+ # Create status bar
+ testWin.panel = testWin
+ #testWin.CreateStatusBar()
+ testWin.SetClientSize(testWin.GetBestSize())
+ testWin.SetPosition(pos)
+ testWin.Show(True)
+ elif xxx.__class__ == xxxPanel:
+ # Create new frame
+ if not testWin:
+ testWin = g.testWin = wxFrame(g.frame, -1, 'Panel: ' + name,
+ pos=pos, name=STD_NAME)
+ testWin.panel = res.LoadPanel(testWin, STD_NAME)
+ testWin.SetClientSize(testWin.GetBestSize())
+ testWin.Show(True)
+ elif xxx.__class__ == xxxDialog:
+ testWin = g.testWin = res.LoadDialog(None, STD_NAME)
+ testWin.panel = testWin
+ testWin.Layout()
+ testWin.SetPosition(pos)
+ testWin.Show(True)
+ # Dialog's default code does not produce EVT_CLOSE
+ EVT_BUTTON(testWin, wxID_OK, self.OnCloseTestWin)
+ EVT_BUTTON(testWin, wxID_CANCEL, self.OnCloseTestWin)
+ elif xxx.__class__ == xxxWizard:
+ wiz = wxPreWizard()
+ res.LoadOnObject(wiz, None, STD_NAME, 'wxWizard')
+ # Find first page (don't know better way)
+ firstPage = None
+ for w in wiz.GetChildren():
+ if isinstance(w, wxWizardPage):
+ firstPage = w
+ break
+ if not firstPage:
+ wxLogError('Wizard is empty')
+ else:
+ # Wizard should be modal
+ self.SetItemBold(item)
+ wiz.RunWizard(w)
+ self.SetItemBold(item, False)
+ wiz.Destroy()
+ elif xxx.__class__ in [xxxWizardPage, xxxWizardPageSimple]:
+ # Create new frame
+ if not testWin:
+ testWin = g.testWin = wxFrame(g.frame, -1, 'Wizard page: ' + name,
+ pos=pos, name=STD_NAME)
+ testWin.panel = wxPrePanel()
+ res.LoadOnObject(testWin.panel, testWin, STD_NAME, 'wxPanel')
+ testWin.SetClientSize(testWin.GetBestSize())
+ testWin.Show(True)
+ elif xxx.__class__ == xxxMenuBar:
+ testWin = g.testWin = wxFrame(g.frame, -1, 'MenuBar: ' + name,
+ pos=pos, name=STD_NAME)
+ testWin.panel = None
+ # Set status bar to display help
+ testWin.CreateStatusBar()
+ testWin.menuBar = res.LoadMenuBar(STD_NAME)
+ testWin.SetMenuBar(testWin.menuBar)
+ testWin.Show(True)
+ elif xxx.__class__ == xxxToolBar:
+ testWin = g.testWin = wxFrame(g.frame, -1, 'ToolBar: ' + name,