[PyKDE] session handling
Hans-Peter Jansen
hpj at urpla.net
Wed Feb 14 20:30:57 GMT 2007
Am Montag, 12. Februar 2007 schrieb Marcos Dione:
> I'm trying to add session saving support to my app to no avail. all
> I've got to, was to simulate it at window close.
Please elaborate.
Typically, I'm reimplementing close on a QMainWindow derived class for this
purpose with success:
def close(self, alsoDelete = 1):
# save state here
return QMainWindow.close(self, alsoDelete)
I haven't done this with KMainWindows, though.
> the code I have is this:
>
> def saveState (self, *more):
> print 'saveState()'
> super (Kress, self).saveState (more)
>
> def restore (self, n, show, config):
> super (Kress, self).restore (n, show)
> config.setGroup ('%d' % n)
> # this doesn't work anymore, so we just [f]make it.
> self.restoreProperties (config)
>
> def saveProperties (self, config):
> print 'saving properties'
> urls= []
> for i in range (1, self.tabMaster.count ()):
> tab= self.tabMaster.page (i)
> part= self.partForTab[tab]
> urls.append (str (part.url ().url ()))
> config.writeEntry ('urls', urls)
> config.sync ()
>
> the kde documentation about it[1] is very limited and only to
> restoring, not about saving. qt's doc[2] suggest to use xsm to debug it,
> so I did. if I try to shut it down, I get a SIGSEGV whith this backtrace:
>
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread -1209940288 (LWP 589)]
> 0xb700d104 in QVariant::QVariant () from /usr/lib/libqt-mt.so.3
> (gdb) bt
> #0 0xb700d104 in QVariant::QVariant () from /usr/lib/libqt-mt.so.3
> #1 0xb68a68c4 in sipVH_kdecore_21 ()
> from /usr/lib/python2.5/site-packages/kdecore.so
> #2 0xb5e267a8 in sipKMainWindow::saveProperties ()
> from /usr/lib/python2.5/site-packages/kdeui.so
> #3 0xb56edf0c in KMainWindow::savePropertiesInternal ()
> from /usr/lib/libkdeui.so.4
> #4 0xb5762c61 in KMWSessionManaged::saveState () from
> /usr/lib/libkdeui.so.4 #5 0xb65d249d in KApplication::saveState () from
> /usr/lib/libkdecore.so.4 #6 0xb67c67f2 in sipKApplication::saveState ()
> from /usr/lib/python2.5/site-packages/kdecore.so
> #7 0xb6ee1f58 in ?? () from /usr/lib/libqt-mt.so.3
> #8 0x08754400 in ?? ()
> #9 0x0878f920 in ?? ()
> #10 0x0878a010 in ?? ()
> #11 0x00000000 in ?? ()
>
> any hints?
Hmm, this traceback smells fishy, you may want to provide a minimal self
containing example to let others explore this issue..
Pete
More information about the PyQt
mailing list