[PyQt] PyKDE application crashes on exit

2008-07-30 Thread Benno Dielmann
Hi, 

This PyKDE4 application always crashes on exit:
-
import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyKDE4.kdecore import ki18n, KAboutData, KCmdLineArgs
from PyKDE4.kdeui import KApplication

class Benup(QWidget):
def __init__(self, parent=None):
super(Benup, self).__init__(parent)
self.splash = QLabel('testing...')
layout = QVBoxLayout()
layout.addWidget(self.splash)
self.setLayout(layout)

if __name__ == '__main__':
appName = benup
catalog = 
programName = ki18n(Benup)
version = 0.1
aboutData   = KAboutData(appName, catalog, programName, version)
KCmdLineArgs.init(sys.argv, aboutData)
app = KApplication()
b = Benup()
b.show()
app.exec_()
-

Any ideas why? It doesn't crash if I make self.splash local, i.e. removing the 
self.. What am I doing wrong?

Thanks a lot in advance for any hints, 

Benno. 

___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] PyKDE application crashes on exit

2008-07-30 Thread Jim Bublitz
On Wednesday 30 July 2008 12:56, Benno Dielmann wrote:
 Hi,

 This PyKDE4 application always crashes on exit:
 -
 import sys
 from PyQt4.QtCore import *
 from PyQt4.QtGui import *
 from PyKDE4.kdecore import ki18n, KAboutData, KCmdLineArgs
 from PyKDE4.kdeui import KApplication

 class Benup(QWidget):
 def __init__(self, parent=None):
 super(Benup, self).__init__(parent)
 self.splash = QLabel('testing...')
 layout = QVBoxLayout()
 layout.addWidget(self.splash)
 self.setLayout(layout)

 if __name__ == '__main__':
 appName = benup
 catalog = 
 programName = ki18n(Benup)
 version = 0.1
 aboutData   = KAboutData(appName, catalog, programName, version)
 KCmdLineArgs.init(sys.argv, aboutData)
 app = KApplication()
 b = Benup()
 b.show()
 app.exec_()
 -

 Any ideas why? It doesn't crash if I make self.splash local, i.e. removing
 the self.. What am I doing wrong?

I'm not completely certain of this, but some of the shutdown/cleanup code for 
KDE apps has historically been in KMainWindow (or descendants like 
KXMLGuiWindow, KParts.MainWindow).  So I'd try making Benup a subclass of one 
of those.

Jim


___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] PyKDE application crashes on exit

2008-07-30 Thread Benno Dielmann
On Thursday 31 July 2008 00:05:25 Jim Bublitz wrote:
| On Wednesday 30 July 2008 12:56, Benno Dielmann wrote:
|  Hi,
| 
|  This PyKDE4 application always crashes on exit:
|  -
|  import sys
|  from PyQt4.QtCore import *
|  from PyQt4.QtGui import *
|  from PyKDE4.kdecore import ki18n, KAboutData, KCmdLineArgs
|  from PyKDE4.kdeui import KApplication
| 
|  class Benup(QWidget):
|  def __init__(self, parent=None):
|  super(Benup, self).__init__(parent)
|  self.splash = QLabel('testing...')
|  layout = QVBoxLayout()
|  layout.addWidget(self.splash)
|  self.setLayout(layout)
| 
|  if __name__ == '__main__':
|  appName = benup
|  catalog = 
|  programName = ki18n(Benup)
|  version = 0.1
|  aboutData   = KAboutData(appName, catalog, programName, version)
|  KCmdLineArgs.init(sys.argv, aboutData)
|  app = KApplication()
|  b = Benup()
|  b.show()
|  app.exec_()
|  -
| 
|  Any ideas why? It doesn't crash if I make self.splash local, i.e.
|  removing the self.. What am I doing wrong?
|
| I'm not completely certain of this, but some of the shutdown/cleanup code
| for KDE apps has historically been in KMainWindow (or descendants like
| KXMLGuiWindow, KParts.MainWindow).  So I'd try making Benup a subclass of
| one of those.

Yes, using KXmlGuiWindow solved the problem. This should be documented 
somewhere, e.g. in

http://www.riverbankcomputing.co.uk/static/Docs/PyKDE4/using.html

Thank you very much for your precious help, 

Benno. 
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt