call event close handler, when shutdown windows and linux

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

call event close handler, when shutdown windows and linux

franz steinhaeusler
Hello group, 

how can i achieve that the event close amd the corresponding event handler in the Frame is called (or what other signals can be used), to exit my application in normal way, when my pc is to shutdowm or restarting the os.

Now that is not the case:
First, settings are only stored, when my app will be closed and second, I have an single instance checker, an when next reboot, the delete stale or so messagebox appears.

I need it for both, MS Windows and Ubuntu Linux.

Thank you in advance!

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: call event close handler, when shutdown windows and linux

Tim Roberts
franz steinhaeusler wrote:

>
> how can i achieve that the event close amd the corresponding event
> handler in the Frame is called (or what other signals can be used), to
> exit my application in normal way, when my pc is to shutdowm or
> restarting the os.
>
> Now that is not the case:
> First, settings are only stored, when my app will be closed and
> second, I have an single instance checker, an when next reboot, the
> delete stale or so messagebox appears.

I'm going to answer the question you asked, but I'm also going to make
an editorial comment.

Your current strategy is not the correct one. There are ALWAYS going to
be system termination events that you can't catch (power failure, or
forced app termination, for example).  If you have settings that need to
be saved, then the RIGHT answer is to have an idle timer, and write out
any changed settings when the user has been idle for a few seconds.
That way, you know that your persisted settings are always correct, no
matter what happens.

The answer to your question is wx.EVT_END_SESSION, but your app would be
much more reliable if you changed the design so you didn't require that.

--
Tim Roberts, [hidden email]
Providenza & Boekelheide, Inc.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: call event close handler, when shutdown windows and linux

franz steinhaeusler
In reply to this post by franz steinhaeusler
Hallo Tim, thanks for your response,

I agree, it is no good design to save the changed data only at the end of the program.
I have anyway a timer for watching the clipboard data and this I use for save the data, if they have changed.

But nevertheless: I have my program in background, and when the pc shuts down, the program will be quit.
An interruption of the power supply is so seldom (and my data are not so important), so that is no problem.

Anyway, the events EVT_QUERY_END_SESSION and also no EVT_END_SESSION are fired, at least in ubuntu.

There comes the messagebox then:

Python Information

Deleted stale lock file '/home/franz/SingleApp-wxPythonMultiClipboardFrame'.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Loading...