]> git.saurik.com Git - wxWidgets.git/blobdiff - utils/wxPython/demo/Main.py
fixed (didn't work at all)
[wxWidgets.git] / utils / wxPython / demo / Main.py
index 949d74710533781f53a8491b4154e7c0f444bf0b..92630666ee7bf7f910104791171f0aa596516928 100644 (file)
@@ -38,12 +38,12 @@ _treeList = [
     ('Window Layout', ['wxLayoutConstraints', 'Sizers']),
 
     ('Miscellaneous', ['wxTimer', 'wxGLCanvas', 'DialogUnits', 'wxImage',
     ('Window Layout', ['wxLayoutConstraints', 'Sizers']),
 
     ('Miscellaneous', ['wxTimer', 'wxGLCanvas', 'DialogUnits', 'wxImage',
-                      'PrintFramework']),
+                      'PrintFramework', 'wxOGL']),
 
     ('wxPython Library', ['Sizers', 'Layoutf', 'wxScrolledMessageDialog',
                           'wxMultipleChoiceDialog', 'wxPlotCanvas']),
 
 
     ('wxPython Library', ['Sizers', 'Layoutf', 'wxScrolledMessageDialog',
                           'wxMultipleChoiceDialog', 'wxPlotCanvas']),
 
-    ('Cool Contribs', ['pyTree', 'hangman', 'SlashDot']),
+    ('Cool Contribs', ['pyTree', 'hangman', 'SlashDot', 'XMLtreeview']),
 
     ]
 
 
     ]
 
@@ -109,21 +109,20 @@ class wxPythonDemo(wxFrame):
         self.nb = wxNotebook(splitter2, -1)
 
         # Set up a TextCtrl on the Overview Notebook page
         self.nb = wxNotebook(splitter2, -1)
 
         # Set up a TextCtrl on the Overview Notebook page
-        self.ovr = wxTextCtrl(self.nb, -1, '', wxDefaultPosition, wxDefaultSize,
-                              wxTE_MULTILINE|wxTE_READONLY)
+        self.ovr = wxTextCtrl(self.nb, -1, style = wxTE_MULTILINE|wxTE_READONLY)
         self.nb.AddPage(self.ovr, "Overview")
 
 
         # Set up a TextCtrl on the Demo Code Notebook page
         self.nb.AddPage(self.ovr, "Overview")
 
 
         # Set up a TextCtrl on the Demo Code Notebook page
-        self.txt = wxTextCtrl(self.nb, -1, '', wxDefaultPosition, wxDefaultSize,
-                              wxTE_MULTILINE|wxTE_READONLY|wxHSCROLL)
+        self.txt = wxTextCtrl(self.nb, -1,
+                              style = wxTE_MULTILINE|wxTE_READONLY|wxHSCROLL)
         self.txt.SetFont(wxFont(9, wxMODERN, wxNORMAL, wxNORMAL, false))
         self.nb.AddPage(self.txt, "Demo Code")
 
 
         # Set up a log on the View Log Notebook page
         self.txt.SetFont(wxFont(9, wxMODERN, wxNORMAL, wxNORMAL, false))
         self.nb.AddPage(self.txt, "Demo Code")
 
 
         # Set up a log on the View Log Notebook page
-        self.log = wxTextCtrl(splitter2, -1, '', wxDefaultPosition, wxDefaultSize,
-                              wxTE_MULTILINE|wxTE_READONLY|wxHSCROLL)
+        self.log = wxTextCtrl(splitter2, -1,
+                              style = wxTE_MULTILINE|wxTE_READONLY|wxHSCROLL)
         (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')
 
@@ -153,7 +152,8 @@ class wxPythonDemo(wxFrame):
         w, h = self.log.GetClientSizeTuple()
         numLines = h/self.charHeight
         x, y = self.log.PositionToXY(self.log.GetLastPosition())
         w, h = self.log.GetClientSizeTuple()
         numLines = h/self.charHeight
         x, y = self.log.PositionToXY(self.log.GetLastPosition())
-        self.log.ShowPosition(self.log.XYToPosition(x, y-numLines+1))
+        self.log.ShowPosition(self.log.XYToPosition(x, y-numLines))
+        ##self.log.ShowPosition(self.log.GetLastPosition())
         self.log.SetInsertionPointEnd()
 
     def write(self, txt):
         self.log.SetInsertionPointEnd()
 
     def write(self, txt):
@@ -188,6 +188,7 @@ class wxPythonDemo(wxFrame):
             #self.nb.ResizeChildren();
             self.nb.Refresh();
             #wxYield()
             #self.nb.ResizeChildren();
             self.nb.Refresh();
             #wxYield()
+            self.window = None
 
         else:
             if os.path.exists(itemText + '.py'):
 
         else:
             if os.path.exists(itemText + '.py'):
@@ -199,15 +200,16 @@ class wxPythonDemo(wxFrame):
                 self.nb.Refresh();
                 wxYield()
 
                 self.nb.Refresh();
                 wxYield()
 
-                window = module.runTest(self, self.nb, self)
-                if window:
-                    self.nb.AddPage(window, 'Demo')
+                self.window = module.runTest(self, self.nb, self)
+                if self.window:
+                    self.nb.AddPage(self.window, 'Demo')
                     self.nb.SetSelection(2)
                     self.nb.ResizeChildren();
 
             else:
                 self.ovr.Clear()
                 self.txt.Clear()
                     self.nb.SetSelection(2)
                     self.nb.ResizeChildren();
 
             else:
                 self.ovr.Clear()
                 self.txt.Clear()
+                self.window = None
 
 
     #---------------------------------------------
 
 
     #---------------------------------------------
@@ -218,7 +220,7 @@ class wxPythonDemo(wxFrame):
         #    self.txt.WriteText("Cannot open %s file." % filename)
         try:
             self.txt.SetValue(open(filename).read())
         #    self.txt.WriteText("Cannot open %s file." % filename)
         try:
             self.txt.SetValue(open(filename).read())
-        except IOException:
+        except IOError:
             self.txt.WriteText("Cannot open %s file." % filename)
 
 
             self.txt.WriteText("Cannot open %s file." % filename)
 
 
@@ -254,12 +256,14 @@ class wxPythonDemo(wxFrame):
     #---------------------------------------------
     def OnCloseWindow(self, event):
         self.dying = true
     #---------------------------------------------
     def OnCloseWindow(self, event):
         self.dying = true
+        self.window = None
         self.Destroy()
 
     #---------------------------------------------
     def OnIdle(self, event):
         if self.otherWin:
             self.otherWin.Raise()
         self.Destroy()
 
     #---------------------------------------------
     def OnIdle(self, event):
         if self.otherWin:
             self.otherWin.Raise()
+            self.window = self.otherWin
             self.otherWin = None
 
 
             self.otherWin = None