self.web.page().mainFrame().addToJavaScriptWindowObject("obj",self.obj)
Given the generic object defined as follow:
class Obj(QtCore.QObject):
def __init__(self):
super(Obj,self).__init__()
self.data = {'foo' : 123, 'bar' : [1,2,3]}
@QtCore.pyqtSlot(result=QtCore.QVariant)
def GetData(self):
return QtCore.QVariant(self.data)
Then, when the page has been loaded, I can get the data of interest just calling
obj.GetData()
And what I get is a pure js object (It does not work if the dictionary contains a tuple..).
This approach worked perfectly, but since I need the well known performance of V8 plus some css specs not implemented yet in QWebView, I'm trying to migrate to CEF.
I changed the Object exposition as follow:
self.jsBindings.SetObject("obj", self.obj)
But when the GetData method is called by javascript, I got a warning stating that returning values is not supported.
The question is the following: Should I definitely change my approach, (in this case suggestion will be appreciated) or there is other method to return a dictionary from python to Js?
Thanks in advance.
--
You received this message because you are subscribed to the Google Groups "CEF Python" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cefpython+...@googlegroups.com.
Visit this group at http://groups.google.com/group/cefpython.
To view this discussion on the web visit https://groups.google.com/d/msgid/cefpython/9e8991f1-f2a0-4e2d-847a-64ddb3a7227c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.