Phoenix - doc and unittest for WIT

Hi,

Find attached a first patch for the above.

While testing the WIT a bit I sometimes see the following exception.

To reproduce use the attached mixWitApp.py, open the WIT with ctrl-alt-i, close the WIT window and then close the test frame. It seems as if the C++ object is going away during the running of the method SaveSettings, adding an "if self:" to the beginning of SaveSettings only moves the error to another method, so not sure what the correct fix for this is.

Werner

RuntimeError: wrapped C/C++ object of type Shell has been deleted
File "h:\devProjectsT\aaTestsPhoenix\mixWitApp.py", line 22, in <module>
   app.MainLoop()
File "c:\Python27\Lib\site-packages\wx-2.9.6-msw-phoenix\wx\core.py", line 1839, in MainLoop
   rv = wx.PyApp.MainLoop(self)
File "c:\Python27\Lib\site-packages\wx-2.9.6-msw-phoenix\wx\lib\inspection.py", line 268, in OnClose
   self.SaveSettings(self.config)
File "c:\Python27\Lib\site-packages\wx-2.9.6-msw-phoenix\wx\lib\inspection.py", line 410, in SaveSettings
   self.crust.SaveSettings(config)
File "c:\Python27\Lib\site-packages\wx-2.9.6-msw-phoenix\wx\py\crust.py", line 150, in SaveSettings
   self.shell.SaveSettings(config)
File "c:\Python27\Lib\site-packages\wx-2.9.6-msw-phoenix\wx\py\shell.py", line 1467, in SaveSettings
   config.WriteBool('View/WrapMode', self.GetWrapMode())

mixWitApp.py (396 Bytes)

wit.patch (11 KB)

Werner wrote:

Hi,

Find attached a first patch for the above.

Thanks.

While testing the WIT a bit I sometimes see the following exception.

To reproduce use the attached mixWitApp.py, open the WIT with
ctrl-alt-i, close the WIT window and then close the test frame. It seems
as if the C++ object is going away during the running of the method
SaveSettings, adding an "if self:" to the beginning of SaveSettings only
moves the error to another method, so not sure what the correct fix for
this is.

Yeah, I've seen this a few times too. I'm not yet sure what is really going on here, although it probably has something to do with the OnClose being bound to both the WIT frame and the parent if there is one. However there is an Unbind that should take care of the case when the WIT is closed first so the parent doesn't try to run the event handler again, so I'm guessing that the Unbind is not working. Since that will take some time to fix I'll make a change in OnClose that should help avoid the problem in the WIT for now.

···

--
Robin Dunn
Software Craftsman