]> git.saurik.com Git - wxWidgets.git/blobdiff - utils/wxPython/demo/Main.py
Fixes to avoid an endless event looping for wxGTK
[wxWidgets.git] / utils / wxPython / demo / Main.py
index f5292d51f0ed06f39a200a1574815ca26eddfe77..fea3339ceb8cffc59e0eab2b525628907f8d869c 100644 (file)
@@ -21,13 +21,15 @@ _useSplitter       = true
 _useNestedSplitter = true
 
 _treeList = [
-    ('New since last release', ['wxMVCTree', 'wxVTKRenderWindow']),
+    ('New since last release', ['wxMVCTree', 'wxVTKRenderWindow',
+                                'FileBrowseButton', 'GenericButtons',
+                                'wxMask', 'wxEditor']),
 
     ('Managed Windows', ['wxFrame', 'wxDialog', 'wxMiniFrame']),
 
     ('Non-Managed Windows', ['wxGrid', 'wxSashWindow',
                                'wxScrolledWindow', 'wxSplitterWindow',
-                               'wxStatusBar', 'wxToolBar', 'wxNotebook',
+                               'wxStatusBar', 'wxNotebook',
                                'wxHtmlWindow']),
 
     ('Common Dialogs', ['wxColourDialog', 'wxDirDialog', 'wxFileDialog',
@@ -38,18 +40,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',
-                        'Threads']),
+                        'wxImage', 'wxMask', 'PrintFramework', 'wxOGL',
+                        'PythonEvents', 'Threads']),
 
     ('wxPython Library', ['Layoutf', 'wxScrolledMessageDialog',
                           'wxMultipleChoiceDialog', 'wxPlotCanvas', 'wxFloatBar',
-                          'PyShell', 'wxCalendar', 'wxMVCTree', 'wxVTKRenderWindow']),
+                          'PyShell', 'wxCalendar', 'wxMVCTree', 'wxVTKRenderWindow',
+                          'FileBrowseButton', 'GenericButtons', 'wxEditor']),
 
     ('Cool Contribs', ['pyTree', 'hangman', 'SlashDot', 'XMLtreeview']),
 
@@ -61,6 +65,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)
@@ -132,13 +138,16 @@ class wxPythonDemo(wxFrame):
             self.treeMap = {}
             self.tree = wxTreeCtrl(splitter, tID)
             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)
@@ -238,6 +247,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)