[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] Troubles with QWebView
From:       Phil Thompson <phil () riverbankcomputing ! com>
Date:       2009-11-28 10:38:09
Message-ID: a4ac7e5ee44402795ed2edd08735d0bb () localhost
[Download RAW message or body]

On Sat, 28 Nov 2009 00:24:18 +0100, Kastner Mario <kastnermario@gmail.com>
wrote:
> I L.O.V.E PyQt4 ... really! But at this time i am realy at the end of my
> knowledge.
> 
> I have following code:
> 
> SNIPPET START--------------------------------------------
> 
> from PyQt4.QtCore import *
> from PyQt4.QtGui import *
> from PyQt4.QtWebKit import *
> 
> 
> class PythonJS(QObject):
>     
>     @pyqtSignature("QString")
>     def alert(self, msg):
>         QMessageBox.information(None, "This is Python, and its great to
> know!", msg)
> 
>     @pyqtSignature("", result="int")
>     def fortune(self):
>         return 23
>         
> if __name__ == "__main__":
>     import sys
> 
>     app = QApplication(sys.argv)
> 
>     browser = QWebView()
>     browser.show()
> 
> 
>     frame = browser.page().mainFrame()
> 
>
frame.setUrl(QUrl('http://localhost/clients/myconferences/username:testuser/password:testpass/'))
>     frame.addToJavaScriptWindowObject("python", PythonJS())
>     
>     settings = QWebSettings.globalSettings()
>     settings.setAttribute(QWebSettings.JavascriptEnabled, True)
>     settings.setAttribute(QWebSettings.DeveloperExtrasEnabled, True)
>     
>     app.exec_()
> 
> SNIPPET END-----------------------------------------------
> 
> But i am not able to connect my PythonJS to my webpage! .... i turned
> DeveloperExtras On to see what the js debugger says ... "
> ReferenceError Can't find variable: python" ... when i do not call the
> url with frame.setUrl() and put the html code static in with
> browser.setHtml(...) everything works fine ... 
> 
> 
> And i have another ticket *g* webkit ist quiet cool, css works find, but
> not the -webkit-border-radius !? the corners are very very ugly
> drawn ... i searched for a solutions but the only thing i found was that
> i must set a border ... but i have so! ... background-color and border
> are set ...

The first thing to try is to keep a reference to your PythonJS object - I'm
guessing it is getting garbage collected.

Phil
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic