]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/src/_app_ex.py
Patches from KevinO that work around issues where the widget isn't
[wxWidgets.git] / wxPython / src / _app_ex.py
index b843af61916f1b664ade5be61df6d13b7d096ba5..15778e811a5947378b76ea2090e577acea0fcb8f 100644 (file)
@@ -23,11 +23,19 @@ class PyOnDemandOutputWindow:
                               style=wx.DEFAULT_FRAME_STYLE | wx.NO_FULL_REPAINT_ON_RESIZE)
         self.text  = wx.TextCtrl(self.frame, -1, "",
                                  style = wx.TE_MULTILINE | wx.TE_READONLY)
                               style=wx.DEFAULT_FRAME_STYLE | wx.NO_FULL_REPAINT_ON_RESIZE)
         self.text  = wx.TextCtrl(self.frame, -1, "",
                                  style = wx.TE_MULTILINE | wx.TE_READONLY)
+        self.text.AppendText(st)
         self.frame.SetSize((450, 300))
         self.frame.Show(True)
         EVT_CLOSE(self.frame, self.OnCloseWindow)
         
 
         self.frame.SetSize((450, 300))
         self.frame.Show(True)
         EVT_CLOSE(self.frame, self.OnCloseWindow)
         
 
+    def OnCloseWindow(self, event):
+        if self.frame is not None:
+            self.frame.Destroy()
+        self.frame = None
+        self.text  = None
+
+
     # These methods provide the file-like output behaviour.
     def write(self, text):
         """
     # These methods provide the file-like output behaviour.
     def write(self, text):
         """
@@ -52,11 +60,6 @@ class PyOnDemandOutputWindow:
             wx.CallAfter(self.frame.Close)
 
 
             wx.CallAfter(self.frame.Close)
 
 
-    def OnCloseWindow(self, event):
-        if self.frame is not None:
-            self.frame.Destroy()
-        self.frame = None
-        self.text  = None
 
 #----------------------------------------------------------------------
 
 
 #----------------------------------------------------------------------
 
@@ -130,7 +133,7 @@ your Mac."""
         self.RestoreStdio()
 
 
         self.RestoreStdio()
 
 
-    def RedirectStdio(self, filename):
+    def RedirectStdio(self, filename=None):
         """Redirect sys.stdout and sys.stderr to a file or a popup window."""
         if filename:
             _sys.stdout = _sys.stderr = open(filename, 'a')
         """Redirect sys.stdout and sys.stderr to a file or a popup window."""
         if filename:
             _sys.stdout = _sys.stderr = open(filename, 'a')
@@ -145,17 +148,17 @@ your Mac."""
 
 
 # change from wxPyApp_ to wxApp_
 
 
 # change from wxPyApp_ to wxApp_
-App_GetMacSupportPCMenuShortcuts = _core.PyApp_GetMacSupportPCMenuShortcuts
-App_GetMacAboutMenuItemId        = _core.PyApp_GetMacAboutMenuItemId
-App_GetMacPreferencesMenuItemId  = _core.PyApp_GetMacPreferencesMenuItemId
-App_GetMacExitMenuItemId         = _core.PyApp_GetMacExitMenuItemId
-App_GetMacHelpMenuTitleName      = _core.PyApp_GetMacHelpMenuTitleName
-App_SetMacSupportPCMenuShortcuts = _core.PyApp_SetMacSupportPCMenuShortcuts
-App_SetMacAboutMenuItemId        = _core.PyApp_SetMacAboutMenuItemId
-App_SetMacPreferencesMenuItemId  = _core.PyApp_SetMacPreferencesMenuItemId
-App_SetMacExitMenuItemId         = _core.PyApp_SetMacExitMenuItemId
-App_SetMacHelpMenuTitleName      = _core.PyApp_SetMacHelpMenuTitleName
-App_GetComCtl32Version           = _core.PyApp_GetComCtl32Version
+App_GetMacSupportPCMenuShortcuts = _core_.PyApp_GetMacSupportPCMenuShortcuts
+App_GetMacAboutMenuItemId        = _core_.PyApp_GetMacAboutMenuItemId
+App_GetMacPreferencesMenuItemId  = _core_.PyApp_GetMacPreferencesMenuItemId
+App_GetMacExitMenuItemId         = _core_.PyApp_GetMacExitMenuItemId
+App_GetMacHelpMenuTitleName      = _core_.PyApp_GetMacHelpMenuTitleName
+App_SetMacSupportPCMenuShortcuts = _core_.PyApp_SetMacSupportPCMenuShortcuts
+App_SetMacAboutMenuItemId        = _core_.PyApp_SetMacAboutMenuItemId
+App_SetMacPreferencesMenuItemId  = _core_.PyApp_SetMacPreferencesMenuItemId
+App_SetMacExitMenuItemId         = _core_.PyApp_SetMacExitMenuItemId
+App_SetMacHelpMenuTitleName      = _core_.PyApp_SetMacHelpMenuTitleName
+App_GetComCtl32Version           = _core_.PyApp_GetComCtl32Version
 
 #----------------------------------------------------------------------------
 
 
 #----------------------------------------------------------------------------
 
@@ -196,7 +199,7 @@ class PyWidgetTester(wx.App):
 
 class __wxPyCleanup:
     def __init__(self):
 
 class __wxPyCleanup:
     def __init__(self):
-        self.cleanup = _core.App_CleanUp
+        self.cleanup = _core_.App_CleanUp
     def __del__(self):
         self.cleanup()
 
     def __del__(self):
         self.cleanup()
 
@@ -205,9 +208,9 @@ _sys.__wxPythonCleanup = __wxPyCleanup()
 ## # another possible solution, but it gets called too early...
 ## if sys.version[0] == '2':
 ##     import atexit
 ## # another possible solution, but it gets called too early...
 ## if sys.version[0] == '2':
 ##     import atexit
-##     atexit.register(_core.wxApp_CleanUp)
+##     atexit.register(_core_.wxApp_CleanUp)
 ## else:
 ## else:
-##     sys.exitfunc = _core.wxApp_CleanUp
+##     sys.exitfunc = _core_.wxApp_CleanUp
 
 
 #----------------------------------------------------------------------------
 
 
 #----------------------------------------------------------------------------