I have something strange happening on OSX (10.5 & 10.6), when I quit the OS, it sends an wx.EVT_MENU with the wx.ID_EXIT. This is annoying since my exit menu function asks for a confirmation from the user. Nothing else calls my exit function and if I comment the binding it doesn't get called when quitting the OS (but I think (haven't tested it much) that the python app doesn't let the OS quit anymore after commenting the binding, but that's probably another problem). Is anyone else seeing this and does anyone have a workaround? I using wxPython 2.8.8.1.
You might try handling the EVT_ACTIVATE_APP event. It may be sent before the system sends the quit event, so you can either exit when you get the activate event, or you can set a flag that will cause your menu event to not query the user.
···
On 2/22/10 2:55 AM, Gabriel Rossetti wrote:
Hello everyone,
I have something strange happening on OSX (10.5 & 10.6), when I quit the
OS, it sends an wx.EVT_MENU with the wx.ID_EXIT. This is annoying since
my exit menu function asks for a confirmation from the user. Nothing
else calls my exit function and if I comment the binding it doesn't get
called when quitting the OS (but I think (haven't tested it much) that
the python app doesn't let the OS quit anymore after commenting the
binding, but that's probably another problem). Is anyone else seeing
this and does anyone have a workaround? I using wxPython 2.8.8.1.
You might try handling the EVT_ACTIVATE_APP event. It may be sent before the system sends the quit event, so you can either exit when you get the activate event,
I don't think you want to do that -- I think you'll get that event when someone clicks on the apps icon on the dock, for instance.
or you can set a flag that will cause your menu event to not query the user.
That would work.
Note that what you're seeing is not uncommon -- often when I shut down, various apps pop up their "do you really want to quit" dialogs...
-Chris
···
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
You might try handling the EVT_ACTIVATE_APP event. It may be sent before the system sends the quit event, so you can either exit when you get the activate event,
I don't think you want to do that -- I think you'll get that event when someone clicks on the apps icon on the dock, for instance.
or you can set a flag that will cause your menu event to not query the user.
That would work.
The thing is that I get EVT_ACTIVATE_APP only if the app has focus, if it doesn't I don't get it, until the EVT_MENU is fired, which makes the app receive EVT_ACTIVATE_APP since the dialog grabs the focus.
Note that what you're seeing is not uncommon -- often when I shut down, various apps pop up their "do you really want to quit" dialogs...
I have had several people tell me that it's really annoying, wich makes me think that it is uncommon in the Mac community.
You might try handling the EVT_ACTIVATE_APP event. It may be sent
before the system sends the quit event, so you can either exit when
you get the activate event,
I don't think you want to do that -- I think you'll get that event
when someone clicks on the apps icon on the dock, for instance.
or you can set a flag that will cause your menu event to not query
the user.
That would work.
The thing is that I get EVT_ACTIVATE_APP only if the app has focus, if
it doesn't I don't get it, until the EVT_MENU is fired, which makes the
app receive EVT_ACTIVATE_APP since the dialog grabs the focus.
Sorry, I was thinking of the wrong event type. Try binding a handler for EVT_QUERY_END_SESSION and/or EVT_END_SESSION to the app object. I'm not sure if they are implemented for the Mac or if the menu quit event is how it is supposed to be done.
Note that what you're seeing is not uncommon -- often when I shut
down, various apps pop up their "do you really want to quit" dialogs...
I have had several people tell me that it's really annoying, wich makes
me think that it is uncommon in the Mac community.
Any application that has documents that need to be saved will ask you if you want to save them before quitting the app, and they should do it regardless of if it is a system shutdown or just quitting that one app. If they didn't do that then their developers would get lynched as soon as some user didn't save a document they had spent hours working on. What is annoying is applications that ask "Are you sure you want to quit?" even if there are no documents that need saving.
You might try handling the EVT_ACTIVATE_APP event. It may be sent
before the system sends the quit event, so you can either exit when
you get the activate event,
I don't think you want to do that -- I think you'll get that event
when someone clicks on the apps icon on the dock, for instance.
or you can set a flag that will cause your menu event to not query
the user.
That would work.
The thing is that I get EVT_ACTIVATE_APP only if the app has focus, if
it doesn't I don't get it, until the EVT_MENU is fired, which makes the
app receive EVT_ACTIVATE_APP since the dialog grabs the focus.
Sorry, I was thinking of the wrong event type. Try binding a handler for EVT_QUERY_END_SESSION and/or EVT_END_SESSION to the app object. I'm not sure if they are implemented for the Mac or if the menu quit event is how it is supposed to be done.
I'd tried those in the app object, but they didn't seem to work.
Note that what you're seeing is not uncommon -- often when I shut
down, various apps pop up their "do you really want to quit" dialogs...
I have had several people tell me that it's really annoying, wich makes
me think that it is uncommon in the Mac community.
Any application that has documents that need to be saved will ask you if you want to save them before quitting the app, and they should do it regardless of if it is a system shutdown or just quitting that one app. If they didn't do that then their developers would get lynched as soon as some user didn't save a document they had spent hours working on. What is annoying is applications that ask "Are you sure you want to quit?" even if there are no documents that need saving.
Ok, it doesn't need to save any documents, it's a background app with an taskbar/Dock icon, the reason I ask for confirmation is so that users don select it by mistake and quit the app w/out realizing it (it's happened before). Maybe on Mac I should remove the dialog? Or do you think that it shouldn't exist at all? On windows this does not seem to pose any problems, the event is not fired on shutdown. This may be how it's done on Mac, so maybe there is no need to confirm.
Ok, it doesn't need to save any documents, it's a background app with an
taskbar/Dock icon, the reason I ask for confirmation is so that users
don select it by mistake and quit the app w/out realizing it (it's
happened before).
How would they do that without explicitly selecting Quit from a menu or typing Cmd-Q?
Maybe on Mac I should remove the dialog?
I would.
Or do you
think that it shouldn't exist at all?
I find dialogs that exist solely for confirming a simple and explicit command that I just selected to be very annoying on any platform, but that may just be me.
Ok, it doesn't need to save any documents, it's a background app with an
taskbar/Dock icon, the reason I ask for confirmation is so that users
don select it by mistake and quit the app w/out realizing it (it's
happened before).
How would they do that without explicitly selecting Quit from a menu or typing Cmd-Q?
They did....
Maybe on Mac I should remove the dialog?
I would.
ok, thanks, I did
Or do you
think that it shouldn't exist at all?
I find dialogs that exist solely for confirming a simple and explicit command that I just selected to be very annoying on any platform, but that may just be me.
Ok, I had a GUI course once in my studies and they insisted on having quit confirmation dialogs even when it seemed unnecessary (Like you said, when quitting and no data loss is possible)