Dialog not closing and "Delete stale lock file"

A dialog doesn't close when I click on "X" in the windows title bar and when I re-run it I get the "delete stale lock file" but only on Ubuntu.

On Win 7 it closes correctly and reopen doesn't give me the lock file error.

I am running it like this:
     import app_base
     app = app_base.BaseApp(redirect=False)
     app.CloseSplash()

     dlg = create(None)
     dlg.CenterOnParent()
     try:
         dlg.ShowModal()
     finally:
         dlg.Destroy()
     app.MainLoop()

My app_base.BaseApp.OnExit is del'ing the instance of wx.SingleInstanceChecker, but it seems that for some reason OnExit is never called

In the dialog I also tried having a self.Bind(wx.EVT_CLOSE, self.OnClose) and in the binder I just do evt.Skip(), note that my dialog doesn't have a wx.ID_OK button, but even if I change one button to use that and clicking that button obviously closed the dialog now, but the "X" on the title bar still doesn't do anything.

Any tips on what one needs to do differently?

Just tried with a very basic dialog and it closes, so it is obviously me doing something which prevents it from closing and calling OnExit.

Werner

OnExit is probably only called if I had a TopLevel Window but as this is just for testing this particular dialog there isn't one.

Manually calling OnExit resolves the "Delete stale lock file" issue, i.e. doing this:

     try:
         dlg.ShowModal()
     finally:
         dlg.Destroy()
         app.OnExit()

But still doesn't close on clicking the "X".

Werner

···

On 09/18/2011 04:30 PM, werner wrote:

A dialog doesn't close when I click on "X" in the windows title bar and when I re-run it I get the "delete stale lock file" but only on Ubuntu.

On Win 7 it closes correctly and reopen doesn't give me the lock file error.

I am running it like this:
    import app_base
    app = app_base.BaseApp(redirect=False)
    app.CloseSplash()

    dlg = create(None)
    dlg.CenterOnParent()
    try:
        dlg.ShowModal()
    finally:
        dlg.Destroy()
    app.MainLoop()

My app_base.BaseApp.OnExit is del'ing the instance of wx.SingleInstanceChecker, but it seems that for some reason OnExit is never called

In the dialog I also tried having a self.Bind(wx.EVT_CLOSE, self.OnClose) and in the binder I just do evt.Skip(), note that my dialog doesn't have a wx.ID_OK button, but even if I change one button to use that and clicking that button obviously closed the dialog now, but the "X" on the title bar still doesn't do anything.

Any tips on what one needs to do differently?

Just tried with a very basic dialog and it closes, so it is obviously me doing something which prevents it from closing and calling OnExit.

Please create a small sample app that shows the problem.

···

On 9/18/11 11:01 AM, werner wrote:

On 09/18/2011 04:30 PM, werner wrote:

A dialog doesn't close when I click on "X" in the windows title bar
and when I re-run it I get the "delete stale lock file" but only on
Ubuntu.

On Win 7 it closes correctly and reopen doesn't give me the lock file
error.

I am running it like this:
import app_base
app = app_base.BaseApp(redirect=False)
app.CloseSplash()

dlg = create(None)
dlg.CenterOnParent()
try:
dlg.ShowModal()
finally:
dlg.Destroy()
app.MainLoop()

My app_base.BaseApp.OnExit is del'ing the instance of
wx.SingleInstanceChecker, but it seems that for some reason OnExit is
never called

In the dialog I also tried having a self.Bind(wx.EVT_CLOSE,
self.OnClose) and in the binder I just do evt.Skip(), note that my
dialog doesn't have a wx.ID_OK button, but even if I change one button
to use that and clicking that button obviously closed the dialog now,
but the "X" on the title bar still doesn't do anything.

Any tips on what one needs to do differently?

Just tried with a very basic dialog and it closes, so it is obviously
me doing something which prevents it from closing and calling OnExit.

OnExit is probably only called if I had a TopLevel Window but as this is
just for testing this particular dialog there isn't one.

Manually calling OnExit resolves the "Delete stale lock file" issue,
i.e. doing this:

try:
dlg.ShowModal()
finally:
dlg.Destroy()
app.OnExit()

But still doesn't close on clicking the "X".

--
Robin Dunn
Software Craftsman

Attached is the sample it show the "not closing" problem and the SetBackGroundColour one. I see that Vadim closed issue - <http://trac.wxwidgets.org/ticket/13487#comment:2&gt; as it works for him on wx, can I reopen it and change the component to wxPython?

Note the the issue of the dialog not closing has to do with the use of the sized_controls.SizedDialog if you change lines 13 and 14 to use wx.Dialog instead then it closes.

Will try later today and see if I can isolate it further.

Werner

diagclosetest.py (1.64 KB)

···

On 09/18/2011 10:05 PM, Robin Dunn wrote:

Please create a small sample app that shows the problem.

Ignore file attached to the previous post - had some errors with regards to the inheritance setup I like to have (at least I think so).

Doing further testing it seems that the culprit is:

self.SetExtraStyle(wx.WS_EX_VALIDATE_RECURSIVELY)

If I add this then even using wx.Dialog as a base I see the problem that "X" doesn't close anymore.

Werner

diagclosetest.py (1.82 KB)

···

On 09/19/2011 09:33 AM, werner wrote:

On 09/18/2011 10:05 PM, Robin Dunn wrote:

Please create a small sample app that shows the problem.

Attached is the sample it show the "not closing" problem and the SetBackGroundColour one. I see that Vadim closed issue - <http://trac.wxwidgets.org/ticket/13487#comment:2&gt; as it works for him on wx, can I reopen it and change the component to wxPython?

Note the the issue of the dialog not closing has to do with the use of the sized_controls.SizedDialog if you change lines 13 and 14 to use wx.Dialog instead then it closes.

Will try later today and see if I can isolate it further.

No, but I'll explain that his test is testing the wrong thing. He should try setting the color of the dialog and then create the panel...

···

On 9/19/11 12:33 AM, werner wrote:

On 09/18/2011 10:05 PM, Robin Dunn wrote:

Please create a small sample app that shows the problem.

Attached is the sample it show the "not closing" problem and the
SetBackGroundColour one. I see that Vadim closed issue -
<http://trac.wxwidgets.org/ticket/13487#comment:2&gt; as it works for him
on wx, can I reopen it and change the component to wxPython?

--
Robin Dunn
Software Craftsman

It does for me with this example. Windows7, wxPy 2.9.2.4.

···

On 9/19/11 3:20 AM, werner wrote:

On 09/19/2011 09:33 AM, werner wrote:

On 09/18/2011 10:05 PM, Robin Dunn wrote:

Please create a small sample app that shows the problem.

Attached is the sample it show the "not closing" problem and the
SetBackGroundColour one. I see that Vadim closed issue -
<http://trac.wxwidgets.org/ticket/13487#comment:2&gt; as it works for him
on wx, can I reopen it and change the component to wxPython?

Note the the issue of the dialog not closing has to do with the use of
the sized_controls.SizedDialog if you change lines 13 and 14 to use
wx.Dialog instead then it closes.

Will try later today and see if I can isolate it further.

Ignore file attached to the previous post - had some errors with regards
to the inheritance setup I like to have (at least I think so).

Doing further testing it seems that the culprit is:

self.SetExtraStyle(wx.WS_EX_VALIDATE_RECURSIVELY)

If I add this then even using wx.Dialog as a base I see the problem that
"X" doesn't close anymore.

--
Robin Dunn
Software Craftsman

...

Doing further testing it seems that the culprit is:

self.SetExtraStyle(wx.WS_EX_VALIDATE_RECURSIVELY)

If I add this then even using wx.Dialog as a base I see the problem that
"X" doesn't close anymore.

It does for me with this example. Windows7, wxPy 2.9.2.4

On Windows it works, I only have the close problem under Ubuntu (still wxPy 2.8.12 - didn't get around to build 2.9 yet).

Werner

···

On 09/19/2011 07:01 PM, Robin Dunn wrote:

Ok, that sounds like a wxGTK bug then, and it also happens in 2.9. Go ahead and make a trac ticket for it, but you may want to simplify your example as it's sorta confusing as-is. Try it without using Boa.

···

On 9/19/11 10:05 AM, werner wrote:

On 09/19/2011 07:01 PM, Robin Dunn wrote:
...

Doing further testing it seems that the culprit is:

self.SetExtraStyle(wx.WS_EX_VALIDATE_RECURSIVELY)

If I add this then even using wx.Dialog as a base I see the problem that
"X" doesn't close anymore.

It does for me with this example. Windows7, wxPy 2.9.2.4

On Windows it works, I only have the close problem under Ubuntu (still
wxPy 2.8.12 - didn't get around to build 2.9 yet).

--
Robin Dunn
Software Craftsman

Hi Robin,

···

On 09/19/2011 07:49 PM, Robin Dunn wrote:

On 9/19/11 10:05 AM, werner wrote:

On 09/19/2011 07:01 PM, Robin Dunn wrote:
...

Doing further testing it seems that the culprit is:

self.SetExtraStyle(wx.WS_EX_VALIDATE_RECURSIVELY)

If I add this then even using wx.Dialog as a base I see the problem that
"X" doesn't close anymore.

It does for me with this example. Windows7, wxPy 2.9.2.4

On Windows it works, I only have the close problem under Ubuntu (still
wxPy 2.8.12 - didn't get around to build 2.9 yet).

Ok, that sounds like a wxGTK bug then, and it also happens in 2.9. Go ahead and make a trac ticket for it, but you may want to simplify your example as it's sorta confusing as-is. Try it without using Boa.

Will do that asap.

Thanks
Werner

Done - Ticket #13490

Werner

···

On 09/19/2011 07:49 PM, Robin Dunn wrote:

On 9/19/11 10:05 AM, werner wrote:

On 09/19/2011 07:01 PM, Robin Dunn wrote:
...

Doing further testing it seems that the culprit is:

self.SetExtraStyle(wx.WS_EX_VALIDATE_RECURSIVELY)

If I add this then even using wx.Dialog as a base I see the problem that
"X" doesn't close anymore.

It does for me with this example. Windows7, wxPy 2.9.2.4

On Windows it works, I only have the close problem under Ubuntu (still
wxPy 2.8.12 - didn't get around to build 2.9 yet).

Ok, that sounds like a wxGTK bug then, and it also happens in 2.9. Go ahead and make a trac ticket for it, but you may want to simplify your example as it's sorta confusing as-is. Try it without using Boa.