View Single Post
Old 06-20-2011, 09:41 AM   #24
burbleburble began at the beginning.
Posts: 52
Karma: 38
Join Date: Jun 2011
Device: Kindle 3
@Kovid: Thanks for the references. They helped alot.

Some questions:
1) I'm still having trouble creating the bridge. In the following example code the bridge only works if the pyqtSignature is set to QVariant, or someother setup. It never works when set to QWebElement (and if I don't set anything, it apparently can't pass values)! But I very much need this functionality, and it shoud work as per the instructions on (under the section entitled 'QWebElement').

Here is an example of the code I am trying to use (it runs as a module, and the javascript should respond 'onclick'):

import sys
from PyQt4 import QtCore, QtGui, QtWebKit, Qt

class JSObject(QtCore.QObject):
    def test(self, webelement):
        print('Comunication with jsobject worked!')
        #print(webelement.tagName()) #test if actually returned a webelement

def loadJSObject():"py_bridge", JSObject())'document.onclick = function test(event){window.py_bridge.test(}')

if __name__ == '__main__':
    app = QtGui.QApplication(sys.argv)
    webview = QtWebKit.QWebView(), QtCore.SIGNAL('loadFinished(bool)'), loadJSObject)
    webview.setHtml('<html><body><p>This is a test html!</body></html>')

2)Its very confusing for me to figure out how exactly to interface with the multiple files/classes dealing with epub/oeb. Is there a simple interface for the following two actions (a class and method to call, or something):
a)retrieve the html's from the epub. (a getHtml() type interface)
b)rewrite the epub, providing the html/toc/stylesheet information (a writeEpub(html, toc) type interface)

Thank you for your help!

Last edited by burbleburble; 06-20-2011 at 10:47 AM.
burbleburble is offline   Reply With Quote