]> git.saurik.com Git - wxWidgets.git/blobdiff - utils/wxPython/demo/Main.py
More updates to wxWindow, wxMenu, GdiImage to get minimal to work
[wxWidgets.git] / utils / wxPython / demo / Main.py
index 8d132d3334fe0653d665140e07396cac5b2bf504..b94fd779529b9b6c48da3d3c8a8995b03113a426 100644 (file)
@@ -13,7 +13,7 @@
 
 import sys, os
 from   wxPython.wx import *
-
+from   wxPython.lib.splashscreen import SplashScreen
 
 #---------------------------------------------------------------------------
 
@@ -21,11 +21,13 @@ _useSplitter       = true
 _useNestedSplitter = true
 
 _treeList = [
+    ('New since last release', []),
+
     ('Managed Windows', ['wxFrame', 'wxDialog', 'wxMiniFrame']),
 
     ('Non-Managed Windows', ['wxGrid', 'wxSashWindow',
                                'wxScrolledWindow', 'wxSplitterWindow',
-                               'wxStatusBar', 'wxToolBar', 'wxNotebook',
+                               'wxStatusBar', 'wxNotebook',
                                'wxHtmlWindow']),
 
     ('Common Dialogs', ['wxColourDialog', 'wxDirDialog', 'wxFileDialog',
@@ -36,17 +38,20 @@ _treeList = [
     ('Controls', ['wxButton', 'wxCheckBox', 'wxCheckListBox', 'wxChoice',
                   'wxComboBox', 'wxGauge', 'wxListBox', 'wxListCtrl', 'wxTextCtrl',
                   'wxTreeCtrl', 'wxSpinButton', 'wxStaticText', 'wxStaticBitmap',
-                  'wxRadioBox', 'wxSlider']),
+                  'wxRadioBox', 'wxSlider', 'wxToolBar', #'wxToggleButton'
+                  ]),
 
     ('Window Layout', ['wxLayoutConstraints', 'Sizers', 'OldSizers']),
 
     ('Miscellaneous', [ 'DragAndDrop', 'CustomDragAndDrop', 'FontEnumerator',
                         'wxTimer', 'wxValidator', 'wxGLCanvas', 'DialogUnits',
-                        'wxImage', 'PrintFramework', 'wxOGL', 'PythonEvents']),
+                        'wxImage', 'wxMask', 'PrintFramework', 'wxOGL',
+                        'PythonEvents', 'Threads']),
 
-    ('wxPython Library', ['OldSizers', 'Layoutf', 'wxScrolledMessageDialog',
+    ('wxPython Library', ['Layoutf', 'wxScrolledMessageDialog',
                           'wxMultipleChoiceDialog', 'wxPlotCanvas', 'wxFloatBar',
-                          'PyShell']),
+                          'PyShell', 'wxCalendar', 'wxMVCTree', 'wxVTKRenderWindow',
+                          'FileBrowseButton', 'GenericButtons', 'wxEditor']),
 
     ('Cool Contribs', ['pyTree', 'hangman', 'SlashDot', 'XMLtreeview']),
 
@@ -58,6 +63,8 @@ class wxPythonDemo(wxFrame):
     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)
@@ -128,14 +135,18 @@ class wxPythonDemo(wxFrame):
             tID = wxNewId()
             self.treeMap = {}
             self.tree = wxTreeCtrl(splitter, tID)
+            #self.tree.SetBackgroundColour(wxNamedColour("Pink"))
             root = self.tree.AddRoot("Overview")
+            firstChild = None
             for item in _treeList:
                 child = self.tree.AppendItem(root, item[0])
+                if not firstChild: firstChild = child
                 for childItem in item[1]:
                     theDemo = self.tree.AppendItem(child, childItem)
                     self.treeMap[childItem] = theDemo
 
             self.tree.Expand(root)
+            self.tree.Expand(firstChild)
             EVT_TREE_ITEM_EXPANDED   (self.tree, tID, self.OnItemExpanded)
             EVT_TREE_ITEM_COLLAPSED  (self.tree, tID, self.OnItemCollapsed)
             EVT_TREE_SEL_CHANGED     (self.tree, tID, self.OnSelChanged)
@@ -161,6 +172,7 @@ class wxPythonDemo(wxFrame):
         (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:
@@ -234,6 +246,7 @@ class wxPythonDemo(wxFrame):
 
     #---------------------------------------------
     def RunDemo(self, itemText):
+        os.chdir(self.cwd)
         if self.nb.GetPageCount() == 3:
             if self.nb.GetSelection() == 2:
                 self.nb.SetSelection(0)
@@ -260,11 +273,8 @@ class wxPythonDemo(wxFrame):
                 self.window = module.runTest(self, self.nb, self)
                 if self.window:
                     self.nb.AddPage(self.window, 'Demo')
-                    #self.nb.ResizeChildren()
+                    wxYield()
                     self.nb.SetSelection(2)
-                    #self.nb.ResizeChildren()
-                    #if self.window.GetAutoLayout():
-                    #    self.window.Layout()
 
             else:
                 self.ovr.Clear()
@@ -351,7 +361,16 @@ class MyApp(wxApp):
         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
@@ -359,6 +378,11 @@ class MyApp(wxApp):
 #---------------------------------------------------------------------------
 
 def main():
+    try:
+        demoPath = os.path.split(__file__)[0]
+        os.chdir(demoPath)
+    except:
+        pass
     app = MyApp(0)
     app.MainLoop()