]> git.saurik.com Git - wxWidgets.git/blobdiff - utils/wxPython/demo/Main.py
Damn broken pipes.
[wxWidgets.git] / utils / wxPython / demo / Main.py
index 56cc784729d85aae1e2c427ecc4512565ef64390..aa3d1776daf58d1b91864ba7fd055203924df105 100644 (file)
@@ -13,7 +13,7 @@
 
 import sys, os
 from   wxPython.wx import *
 
 import sys, os
 from   wxPython.wx import *
-
+from   wxPython.lib.splashscreen import SplashScreen
 
 #---------------------------------------------------------------------------
 
 
 #---------------------------------------------------------------------------
 
@@ -21,9 +21,12 @@ _useSplitter       = true
 _useNestedSplitter = true
 
 _treeList = [
 _useNestedSplitter = true
 
 _treeList = [
+    ('New since last release', ['wxMVCTree', 'wxVTKRenderWindow',
+                                'FileBrowseButton']),
+
     ('Managed Windows', ['wxFrame', 'wxDialog', 'wxMiniFrame']),
 
     ('Managed Windows', ['wxFrame', 'wxDialog', 'wxMiniFrame']),
 
-    ('Miscellaneous Windows', ['wxGrid', 'wxSashWindow',
+    ('Non-Managed Windows', ['wxGrid', 'wxSashWindow',
                                'wxScrolledWindow', 'wxSplitterWindow',
                                'wxStatusBar', 'wxToolBar', 'wxNotebook',
                                'wxHtmlWindow']),
                                'wxScrolledWindow', 'wxSplitterWindow',
                                'wxStatusBar', 'wxToolBar', 'wxNotebook',
                                'wxHtmlWindow']),
@@ -40,12 +43,15 @@ _treeList = [
 
     ('Window Layout', ['wxLayoutConstraints', 'Sizers', 'OldSizers']),
 
 
     ('Window Layout', ['wxLayoutConstraints', 'Sizers', 'OldSizers']),
 
-    ('Miscellaneous', ['wxTimer', 'wxValidator', 'wxGLCanvas', 'DialogUnits',
-                       'wxImage', 'PrintFramework', 'wxOGL']),
+    ('Miscellaneous', [ 'DragAndDrop', 'CustomDragAndDrop', 'FontEnumerator',
+                        'wxTimer', 'wxValidator', 'wxGLCanvas', 'DialogUnits',
+                        'wxImage', 'PrintFramework', 'wxOGL', 'PythonEvents',
+                        'Threads']),
 
 
-    ('wxPython Library', ['OldSizers', 'Layoutf', 'wxScrolledMessageDialog',
+    ('wxPython Library', ['Layoutf', 'wxScrolledMessageDialog',
                           'wxMultipleChoiceDialog', 'wxPlotCanvas', 'wxFloatBar',
                           'wxMultipleChoiceDialog', 'wxPlotCanvas', 'wxFloatBar',
-                          'PyShell']),
+                          'PyShell', 'wxCalendar', 'wxMVCTree', 'wxVTKRenderWindow',
+                          'FileBrowseButton',]),
 
     ('Cool Contribs', ['pyTree', 'hangman', 'SlashDot', 'XMLtreeview']),
 
 
     ('Cool Contribs', ['pyTree', 'hangman', 'SlashDot', 'XMLtreeview']),
 
@@ -57,6 +63,8 @@ class wxPythonDemo(wxFrame):
     def __init__(self, parent, id, title):
         wxFrame.__init__(self, parent, -1, title, size = (725, 550))
 
     def __init__(self, parent, id, title):
         wxFrame.__init__(self, parent, -1, title, size = (725, 550))
 
+        self.cwd = os.getcwd()
+
         if wxPlatform == '__WXMSW__':
             self.icon = wxIcon('bitmaps/mondrian.ico', wxBITMAP_TYPE_ICO)
             self.SetIcon(self.icon)
         if wxPlatform == '__WXMSW__':
             self.icon = wxIcon('bitmaps/mondrian.ico', wxBITMAP_TYPE_ICO)
             self.SetIcon(self.icon)
@@ -160,6 +168,7 @@ class wxPythonDemo(wxFrame):
         (w, self.charHeight) = self.log.GetTextExtent('X')
         self.WriteText('wxPython Demo Log:\n')
 
         (w, self.charHeight) = self.log.GetTextExtent('X')
         self.WriteText('wxPython Demo Log:\n')
 
+        self.Show(true)
 
         # add the windows to the splitter and split it.
         if _useSplitter:
 
         # add the windows to the splitter and split it.
         if _useSplitter:
@@ -194,6 +203,9 @@ class wxPythonDemo(wxFrame):
                 self.tree.EnsureVisible(selectedDemo)
 
 
                 self.tree.EnsureVisible(selectedDemo)
 
 
+        self.WriteText('window handle: %s\n' % self.GetHandle())
+
+
     #---------------------------------------------
     def WriteText(self, text):
         self.log.WriteText(text)
     #---------------------------------------------
     def WriteText(self, text):
         self.log.WriteText(text)
@@ -230,6 +242,7 @@ class wxPythonDemo(wxFrame):
 
     #---------------------------------------------
     def RunDemo(self, itemText):
 
     #---------------------------------------------
     def RunDemo(self, itemText):
+        os.chdir(self.cwd)
         if self.nb.GetPageCount() == 3:
             if self.nb.GetSelection() == 2:
                 self.nb.SetSelection(0)
         if self.nb.GetPageCount() == 3:
             if self.nb.GetSelection() == 2:
                 self.nb.SetSelection(0)
@@ -243,9 +256,11 @@ class wxPythonDemo(wxFrame):
 
         else:
             if os.path.exists(itemText + '.py'):
 
         else:
             if os.path.exists(itemText + '.py'):
+                wxBeginBusyCursor()
                 self.GetDemoFile(itemText + '.py')
                 module = __import__(itemText, globals())
                 self.SetOverview(itemText, module.overview)
                 self.GetDemoFile(itemText + '.py')
                 module = __import__(itemText, globals())
                 self.SetOverview(itemText, module.overview)
+                wxEndBusyCursor()
 
                 # in case runTest is modal, make sure things look right...
                 self.nb.Refresh();
 
                 # in case runTest is modal, make sure things look right...
                 self.nb.Refresh();
@@ -256,7 +271,7 @@ class wxPythonDemo(wxFrame):
                     self.nb.AddPage(self.window, 'Demo')
                     #self.nb.ResizeChildren()
                     self.nb.SetSelection(2)
                     self.nb.AddPage(self.window, 'Demo')
                     #self.nb.ResizeChildren()
                     self.nb.SetSelection(2)
-                    self.nb.ResizeChildren()
+                    #self.nb.ResizeChildren()
                     #if self.window.GetAutoLayout():
                     #    self.window.Layout()
 
                     #if self.window.GetAutoLayout():
                     #    self.window.Layout()
 
@@ -345,7 +360,16 @@ class MyApp(wxApp):
         wxImage_AddHandler(wxJPEGHandler())
         wxImage_AddHandler(wxPNGHandler())
         wxImage_AddHandler(wxGIFHandler())
         wxImage_AddHandler(wxJPEGHandler())
         wxImage_AddHandler(wxPNGHandler())
         wxImage_AddHandler(wxGIFHandler())
-        frame = wxPythonDemo(NULL, -1, "wxPython: (A Demonstration)")
+
+        self.splash = SplashScreen(None, bitmapfile='bitmaps/splash.gif',
+                              duration=4000, callback=self.AfterSplash)
+        self.splash.Show(true)
+        wxYield()
+        return true
+
+    def AfterSplash(self):
+        self.splash.Close(true)
+        frame = wxPythonDemo(None, -1, "wxPython: (A Demonstration)")
         frame.Show(true)
         self.SetTopWindow(frame)
         return true
         frame.Show(true)
         self.SetTopWindow(frame)
         return true