[PyQt] QtGui.QSessionManager: Syntax
Horst Herb
subscriptions at gnumed.net
Sat Dec 15 03:04:15 GMT 2007
On Saturday 15 December 2007, Chris Giles wrote:
> If anyone already has working example PyQt4 code that handles session
> management, please send it to me.
>
> Until that happens, it's looking a bit too painful. Instead, I've just
> instructed my application to stick a temporary link to itself in the
> "~/.kde/Autostart/" directory. This will be okay since I don't need to
> store any session-specific info.
Doesn't sound painful at all - the way I read it:
1.) override QApplication::commitData()
(simply write code that saves your application's state any way you want, eg a
plain text file in the user's home directory)
2.) when your app starts next time, check whether that text file exists, and
if so, act accordingly in your application
The framework needs only to notify you that
1.) a session should now be saved
2.) this application has been started as part of a session restore
I usually ignore the latter, and (ask user whether to) restore whenever
restore information is found on startup (because I generally save state in
time intervals, in case app crashes, so that user doesn't loose data -
restore after session restart or after crash is handled the same way)
Horst
--
Indeed, conceit, arrogance, and egotism are the essentials of patriotism. Let
me illustrate. Patriotism assumes that oour globe is divided into little
spots, each one surrounded by an iron gate. Those who have had the fortune of
being born on some particular spot, consider themselves better, nobler,
grander, more intelligent than the living beings inhabiting any other spot.
It is, therefore, the duty of everyone living on that chosen spot to fight,
kill, and die in the attempt to impose his superiority upon all the others.
The inhabitants of the other spots reason in like manner, of course ...
Emma Goldman
Patriotism: A Menace To Liberty
Anarchism and Other Essays
More information about the PyQt
mailing list