]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/demo/Main.py
corrected assert even better
[wxWidgets.git] / wxPython / demo / Main.py
index b4bca26df9ac6f47998daf6c9d4b7e12fbcad920..a741bc01ffa0c5272f500908fb784a409ae3164b 100644 (file)
@@ -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