]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/demo/Main.py
Fixed the code to actually work.
[wxWidgets.git] / wxPython / demo / Main.py
index 52412f1e90cc563f7c47a2137c7828bd00e4c942..ef214a2a53e77f885adeed3a520dfce673e86d11 100644 (file)
@@ -18,6 +18,17 @@ import wx.html
 
 import images
 
+# For debugging
+##wx.Trap();
+##print os.getpid(); raw_input("Press a key...")
+
+
+# Use Python's bool constants if available, make aliases if not
+try:
+    True
+except NameError:
+    __builtins__.True = 1==1
+    __builtins__.False = 1==0
 
 #---------------------------------------------------------------------------
 
@@ -26,6 +37,11 @@ _treeList = [
     # new stuff
     ('Recent Additions', [
         'wxVListBox',
+        'wxListbook',
+        'wxMaskedNumCtrl',
+        'FloatCanvas',
+        'wxXmlResourceSubclass',
+        'wxGridBagSizer',
         ]),
 
     # managed windows == things with a (optional) caption you can close
@@ -70,9 +86,9 @@ _treeList = [
         'wxChoice',
         'wxComboBox',
         'wxGauge',
-        'wxGenericDirCtrl',
         'wxGrid',
         'wxGrid_MegaExample',
+        'wxListbook',
         'wxListBox',
         'wxListCtrl',
         'wxListCtrl_virtual',
@@ -97,17 +113,28 @@ _treeList = [
         'wxValidator',
         ]),
 
-    # controls coming from other librairies
+    ('Custom Controls', [
+        'AnalogClockWindow',
+        'ColourSelect',
+        'GenericButtons',
+        'wxEditor',
+        'wxGenericDirCtrl',
+        'wxLEDNumberCtrl',
+        'wxMultiSash',
+        'wxPopupControl',
+        'wxPyColourChooser',
+        'wxTreeListCtrl',
+    ]),
+    
+    # controls coming from other libraries
     ('More Windows/Controls', [
         #'wxFloatBar',          deprecated
         #'wxMVCTree',           deprecated
         #'wxRightTextCtrl',     deprecated as we have wxTE_RIGHT now.
-        'AnalogClockWindow',
-        'ColourSelect',
         'ContextHelp',
         'FancyText',
+        'FloatCanvas',
         'FileBrowseButton',
-        'GenericButtons',
         'MaskedEditControls',
         'PyShell',
         'PyCrust',
@@ -116,21 +143,16 @@ _treeList = [
         'Throbber',
         'wxCalendar',
         'wxCalendarCtrl',
-        'wxPyColourChooser',
         'wxDynamicSashWindow',
         'wxEditableListBox',
-        'wxEditor',
         'wxHtmlWindow',
         'wxIEHtmlWin',
         'wxIntCtrl',
-        'wxLEDNumberCtrl',
         'wxMimeTypesManager',
-        'wxMultiSash',
-        'wxPopupControl',
+        'wxMaskedNumCtrl',
         'wxStyledTextCtrl_1',
         'wxStyledTextCtrl_2',
         'wxTimeCtrl',
-        'wxTreeListCtrl',
         'wxVListBox',
         ]),
 
@@ -140,10 +162,12 @@ _treeList = [
         'Layoutf',
         'RowColSizer',
         'Sizers',
+        'wxGridBagSizer',
         'wxLayoutConstraints',
         'wxScrolledPanel',
         'wxXmlResource',
         'wxXmlResourceHandler',
+        'wxXmlResourceSubclass',
         ]),
 
     # ditto
@@ -209,6 +233,7 @@ _treeList = [
 
 
 #---------------------------------------------------------------------------
+# Show how to derive a custom wxLog class
 
 class MyLog(wx.PyLog):
     def __init__(self, textCtrl, logTime=0):
@@ -232,6 +257,7 @@ class MyTP(wx.PyTipProvider):
 # A class to be used to display source code in the demo.  Try using the
 # wxSTC in the wxStyledTextCtrl_2 sample first, fall back to wxTextCtrl
 # if there is an error, such as the stc module not being present.
+#
 
 try:
     ##raise ImportError
@@ -324,12 +350,12 @@ class wxPythonDemo(wx.Frame):
         self.Centre(wx.BOTH)
         self.CreateStatusBar(1, wx.ST_SIZEGRIP)
 
-        splitter = wx.SplitterWindow(self, -1, style=wx.NO_3D|wx.SP_3D)
-        splitter2 = wx.SplitterWindow(splitter, -1, style=wx.NO_3D|wx.SP_3D)
+        splitter = wx.SplitterWindow(self, -1)
+        splitter2 = wx.SplitterWindow(splitter, -1)
 
         def EmptyHandler(evt): pass
-        wx.EVT_ERASE_BACKGROUND(splitter, EmptyHandler)
-        wx.EVT_ERASE_BACKGROUND(splitter2, EmptyHandler)
+        #wx.EVT_ERASE_BACKGROUND(splitter, EmptyHandler)
+        #wx.EVT_ERASE_BACKGROUND(splitter2, EmptyHandler)
 
         # Prevent TreeCtrl from displaying all items after destruction when True
         self.dying = False
@@ -460,13 +486,21 @@ class wxPythonDemo(wx.Frame):
 
 
         # add the windows to the splitter and split it.
-        splitter2.SplitHorizontally(self.nb, self.log, 450)
+        splitter2.SplitHorizontally(self.nb, self.log, -120)
         splitter.SplitVertically(self.tree, splitter2, 180)
 
         splitter.SetMinimumPaneSize(20)
         splitter2.SetMinimumPaneSize(20)
 
 
+        # Make the splitter on the right expand the top wind when resized
+        def SplitterOnSize(evt):
+            splitter = evt.GetEventObject()
+            sz = splitter.GetSize()
+            splitter.SetSashPosition(sz.height - 120, False)
+            evt.Skip()
+        wx.EVT_SIZE(splitter2, SplitterOnSize)
+
 
         # select initial items
         self.nb.SetSelection(0)
@@ -781,7 +815,7 @@ def main():
         os.chdir(demoPath)
     except:
         pass
-    app = MyApp(wx.Platform == "__WXMAC__")
+    app = MyApp(0) #wx.Platform == "__WXMAC__")
     app.MainLoop()
 
 
@@ -803,7 +837,7 @@ platform GUI library, which is written in C++.
 <p> Like Python and wxWindows, wxPython is <b>Open Source</b> which
 means that it is free for anyone to use and the source code is
 available for anyone to look at and modify.  Or anyone can contribute
-fixes or enhnacments to the project.
+fixes or enhancements to the project.
 
 <p> wxPython is a <b>cross-platform</b> toolkit.  This means that the
 same program will run on multiple platforms without modification.