X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/980f458f7f034a21501d4bde7bc6f49d29a1a941..8179a16812e66ff0ac32bb09803e95756350c76c:/wxPython/demo/Main.py diff --git a/wxPython/demo/Main.py b/wxPython/demo/Main.py index b500a003a4..d57aebbb36 100644 --- a/wxPython/demo/Main.py +++ b/wxPython/demo/Main.py @@ -20,7 +20,8 @@ import images # For debugging ##wx.Trap(); -##print os.getpid(); raw_input("Press a key...") +##print os.getpid(); +##raw_input("Press a key...") #--------------------------------------------------------------------------- @@ -37,6 +38,10 @@ _treeList = [ 'GridBagSizer', 'Cursor', 'PyPlot', + 'ImageAlpha', + 'ActiveX_FlashWindow', + 'ActiveX_IEHtmlWindow', + 'ActiveX_PDFWindow', ]), # managed windows == things with a (optional) caption you can close @@ -66,7 +71,7 @@ _treeList = [ # dialogs from libraries ('More Dialogs', [ - 'ErrorDialogs', + ##'ErrorDialogs', 'ImageBrowser', 'MultipleChoiceDialog', 'ScrolledMessageDialog', @@ -74,6 +79,7 @@ _treeList = [ # core controls ('Core Windows/Controls', [ + 'BitmapButton', 'Button', 'CheckBox', 'CheckListBox', @@ -123,6 +129,9 @@ _treeList = [ # controls coming from other libraries ('More Windows/Controls', [ + 'ActiveX_FlashWindow', + 'ActiveX_IEHtmlWindow', + 'ActiveX_PDFWindow', #'RightTextCtrl', deprecated as we have wxTE_RIGHT now. 'Calendar', 'CalendarCtrl', @@ -134,7 +143,7 @@ _treeList = [ 'FloatBar', 'FloatCanvas', 'HtmlWindow', - 'IEHtmlWin', + ##'IEHtmlWin', 'IntCtrl', 'MVCTree', 'MaskedEditControls', @@ -171,7 +180,7 @@ _treeList = [ ('Process and Events', [ 'EventManager', 'KeyEvents', - 'OOR', + ##'OOR', 'Process', 'PythonEvents', 'Threads', @@ -192,6 +201,7 @@ _treeList = [ 'Cursor', 'DragImage', 'Image', + 'ImageAlpha', 'ImageFromStream', 'Mask', 'Throbber', @@ -215,8 +225,8 @@ _treeList = [ # need libs not coming with the demo ('Objects using an external library', [ - 'ActiveXWrapper_Acrobat', - 'ActiveXWrapper_IE', + ##'ActiveXWrapper_Acrobat', + ##'ActiveXWrapper_IE', # currently has tstate problems... 'GLCanvas', #'PlotCanvas', # deprecated, use PyPlot ]), @@ -262,7 +272,7 @@ try: from StyledTextCtrl_2 import PythonSTC class DemoCodeViewer(PythonSTC): def __init__(self, parent, ID): - PythonSTC.__init__(self, parent, ID) + PythonSTC.__init__(self, parent, ID, wx.BORDER_NONE) self.SetUpEditor() # Some methods to make it compatible with how the wxTextCtrl is used @@ -430,6 +440,7 @@ class wxPythonDemo(wx.Frame): def __init__(self, parent, id, title): wx.Frame.__init__(self, parent, -1, title, size = (800, 600), style=wx.DEFAULT_FRAME_STYLE|wx.NO_FULL_REPAINT_ON_RESIZE) + self.cwd = os.getcwd() self.curOverview = "" @@ -489,9 +500,15 @@ class wxPythonDemo(wx.Frame): # Make a File menu self.mainmenu = wx.MenuBar() menu = wx.Menu() + item = menu.Append(-1, '&Redirect Output', + 'Redirect print statements to a window', + wx.ITEM_CHECK) + self.Bind(wx.EVT_MENU, self.OnToggleRedirect, item) + item = menu.Append(-1, 'E&xit\tAlt-X', 'Get the heck outta here!') self.Bind(wx.EVT_MENU, self.OnFileExit, item) wx.App_SetMacExitMenuItemId(item.GetId()) + self.mainmenu.Append(menu, '&File') # Make a Demo menu @@ -683,7 +700,6 @@ class wxPythonDemo(wx.Frame): if itemText == self.overviewText: self.LoadDemoSource('Main.py') self.SetOverview(self.overviewText, overview) -## self.nb.Refresh(); self.window = None else: @@ -702,21 +718,17 @@ class wxPythonDemo(wx.Frame): wx.EndBusyCursor() self.tree.Refresh() - # in case runTest is modal, make sure things look right... -## self.nb.Refresh(); -## wx.SafeYield() - self.window = module.runTest(self, self.nb, self) ### if self.window is not None: self.nb.AddPage(self.window, 'Demo') self.nb.SetSelection(2) -## self.nb.Refresh() # without this wxMac has troubles showing the just added page else: self.ovr.SetPage("") self.txt.Clear() self.window = None + self.tree.SetFocus() #--------------------------------------------- @@ -745,6 +757,15 @@ class wxPythonDemo(wx.Frame): def OnFileExit(self, *event): self.Close() + def OnToggleRedirect(self, event): + app = wx.GetApp() + if event.Checked(): + app.RedirectStdio() + print "Print statements and other standard output will now be directed to this window." + else: + app.RestoreStdio() + print "Print statements and other standard output will now be sent to the usual location." + def OnHelpAbout(self, event): from About import MyAboutBox about = MyAboutBox(self)