[PyKDE] Revisiting an old khtml crash

Brian Thomason brian.thomason at lindows.com
Wed Jul 14 02:44:00 BST 2004


In this old thread:

http://www.mail-archive.com/pykde@mats.imk.fraunhofer.de/msg01331.html

A user is experiencing the exact same problem I've been seeing with 
pykde 3.11 on both Linspire 4.5 and Debian SID. (at least to my feeble 
mind it appears that way)

When overriding any type of pyqt event, khtml bombs out.  (Even simply 
importing khtml is a no go)

Just as the user stated (as tested on mandrake), 3.7 does not display 
this behavior.  I have attached a small, hoping some big brain (Jim :-) 
) might have a solution to this problem.

Until next time,

-Brian
-------------- next part --------------
#!/usr/bin/env python

import sys
from kdecore import *
from kdeui import *
from khtml import *
from qt import *

class TestWidget(QWidget):
	def __init__(self,parent,name):
		QWidget.__init__(self,parent,name)
		self.setFixedSize(QSize(100,10))

	def paintEvent(self,e):
		QWidget.paintEvent(self,e)
		#p = QPainter()
		#p.begin(self)
		#r = self.rect()
		#fill = QBrush(QColor(255,0,0))
		#p.fillRect(r,fill)
		#p.end()

class MainWindow(KMainWindow):
	def __init__(self):
		KMainWindow.__init__(self)
		self.vBox = QVBox(self)
		self.test = TestWidget(self.vBox,"test")
		self.location = QLineEdit(self.vBox)
		self.location.setText("http://www.yahoo.com")
		self.browser = KHTMLPart(self.vBox)
		self.browser.openURL(KURL(self.location.text()))
		self.connect(self.location,SIGNAL("returnPressed()"),self.changeLocation)
		self.connect(self.browser.browserExtension(),SIGNAL("openURLRequest(const KURL &, const KParts::URLArgs &)"),self.openURLRequest)
		self.setCentralWidget(self.vBox)

	def changeLocation(self):
		self.browser.openURL(KURL(self.location.text()))

	def openURLRequest(self,kurl,args):
		self.location.setText(kurl.url())
		self.changeLocation()

app=KApplication(sys.argv,"Browser - Python")
window = MainWindow()
window.setGeometry(100,100,500,500)
app.setMainWidget(window)
window.show()
app.exec_loop()


More information about the PyQt mailing list