X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e9159fe8e8f1b3653c506805cbb79280aa2a0f38..a81c3c2383f9096ef5e96b708a0f1c1ffe7cc6a8:/wxPython/demo/Main.py diff --git a/wxPython/demo/Main.py b/wxPython/demo/Main.py index b4bca26df9..a741bc01ff 100644 --- a/wxPython/demo/Main.py +++ b/wxPython/demo/Main.py @@ -25,6 +25,7 @@ _treeList = [ 'wxImageFromStream', 'RowColSizer', 'Unicode', + 'wxFileHistory', ]), ('Windows', ['wxFrame', 'wxDialog', 'wxMiniFrame', @@ -64,7 +65,7 @@ _treeList = [ 'ActiveXWrapper_Acrobat', 'ActiveXWrapper_IE', 'wxDragImage', "wxProcess", "FancyText", "OOR", "wxWave", 'wxJoystick', 'DrawXXXList', 'ErrorDialogs', 'wxMimeTypesManager', - 'ContextHelp', 'SplitTree', 'Unicode', + 'ContextHelp', 'SplitTree', 'Unicode', 'wxFileHistory', ]), ('wxPython Library', ['Layoutf', 'wxScrolledMessageDialog', @@ -132,6 +133,7 @@ class wxPythonDemo(wxFrame): self.otherWin = None + self.showTip = true EVT_IDLE(self, self.OnIdle) EVT_CLOSE(self, self.OnCloseWindow) EVT_ICONIZE(self, self.OnIconfiy) @@ -244,8 +246,11 @@ class wxPythonDemo(wxFrame): # Set up a log on the View Log Notebook page self.log = wxTextCtrl(splitter2, -1, style = wxTE_MULTILINE|wxTE_READONLY|wxHSCROLL) + # Set the wxWindows log target to be this textctrl #wxLog_SetActiveTarget(wxLogTextCtrl(self.log)) + + # But instead of the above we want to show how to use our own wxLog class wxLog_SetActiveTarget(MyLog(self.log)) @@ -413,6 +418,25 @@ class wxPythonDemo(wxFrame): self.window = self.otherWin self.otherWin = None + if self.showTip: + self.ShowTip() + self.showTip = false + + + #--------------------------------------------- + def ShowTip(self): + try: + showTipText = open(opj("data/showTips")).read() + showTip, index = eval(showTipText) + except IOError: + showTip, index = (1, 0) + if showTip: + tp = wxCreateFileTipProvider(opj("data/tips.txt"), index) + showTip = wxShowTip(self, tp) + index = tp.GetCurrentTip() + open(opj("data/showTips"), "w").write(str( (showTip, index) )) + + #--------------------------------------------- def OnDemoMenu(self, event): try: @@ -480,21 +504,7 @@ class MySplashScreen(wxSplashScreen): def OnClose(self, evt): frame = wxPythonDemo(None, -1, "wxPython: (A Demonstration)") frame.Show(true) - self.ShowTip(frame) - self.Destroy() - - def ShowTip(self, frame): - try: - showTipText = open(opj("data/showTips")).read() - showTip, index = eval(showTipText) - except IOError: - showTip, index = (1, 0) - if showTip: - tp = wxCreateFileTipProvider(opj("data/tips.txt"), index) - showTip = wxShowTip(frame, tp) - index = tp.GetCurrentTip() - open(opj("data/showTips"), "w").write(str( (showTip, index) )) - + evt.Skip() # Make sure the default handler runs too... class MyApp(wxApp): @@ -506,7 +516,6 @@ class MyApp(wxApp): wxInitAllImageHandlers() splash = MySplashScreen() splash.Show() - wxYield() return true