windwiny avatar windwiny committed 3c35cfc

on mainframe close, reset sys.stdout

Comments (0)

Files changed (1)

               pos=wx.Point(580, 0), size=wx.Size(341, 148),
               style=wx.DEFAULT_FRAME_STYLE, title=u'mygrsync')
         self.SetClientSize(wx.Size(325, 110))
+        self.Bind(wx.EVT_CLOSE, self.OnMygrsyncClose)
 
         self.panel1 = wx.Panel(id=wxID_MYGRSYNCPANEL1, name='panel1',
               parent=self, pos=wx.Point(0, 0), size=wx.Size(325, 110),
         self._stdout, self._stderr = sys.stdout, sys.stderr
         sys.stdout, sys.stderr = self, self
 
+    def OnMygrsyncClose(self, event):
+        event.Skip()
+        sys.stdout, sys.stderr = self._stdout, self._stderr
+        print 'reset sys.stdout, mainframe close'
+
     def write(self, txt):
         if type(txt) == type(u''):
             pass
 
     def OnBtnExitButton(self, event):
         event.Skip()
-        self.Destroy()
+        self.Close()
 
     def OnTxt_x(self, event):
         event.Skip()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.