<html><body><div style="color:#000; background-color:#fff; font-family:arial, helvetica, sans-serif;font-size:10pt"><div><br></div><div>Greetings All,</div><div><br></div><div>We've uncovered what appears to be a very unfortunate bug in QWebKit...</div><div>If it is indeed a bug, we can't tell _where_ the bug is originating from..</div><div>..is it a Qt-bug? PyQt? We're on Qt 4.7,..could it be fixed in 4.8? (Env info below)<br></div><div><br></div><div>Essentially what's happening,..is that there is a difference between the data</div><div>that is returned via JavaScript method vs. DOM method. We're trying to decide</div><div>which one to use, this issue isn't helping, lol...</div><div><br></div><div>When you run the program,...a textField and two buttons are displayed.</div><div><span class="tab"> 1. </span>In the textField is "John".</div><div><span class="tab"> 2. </span>Hitting Button1 calls a decorator
pyqtslot/function that changes the textField to "Mary".</div><div><span class="tab"> 3. </span>Hitting Button2 calls a different decorator pyqtslot/function that queries the textField in two ways,</div><div><span class="tab"> </span><span class="tab"> </span>one JavaScript, one via DOM.</div><div><br></div><div><span class="tab"> 4. </span>JavaScript returns "Mary"</div><div><span class="tab"> </span>DOM returns "John"</div><div><br></div><div>which one's correct?....</div><div><br></div><div>(1011)% p test-form.py<br>Defaults button:<br> Submit button:<br> Value of Name: field according to javascript: Mary<br> Value of Name: field according to DOM: John</div><div><br></div><div>Here are the decorator slot/functions in
question:</div><div><br></div><div><br> @QtCore.pyqtSlot()<br> def SetDefault(self):<br> print "Defaults button:"<br><br> self.ui.webView.page().mainFrame().evaluateJavaScript("""document.thisForm.name.value = "Mary";""")<br><br></div><div><br> @QtCore.pyqtSlot(str)<br> def SubmitButton(self,name_via_javascript):<br> print " Submit button:"<br><br> frame = self.ui.webView.page().mainFrame()<br> name_via_dom = frame.findFirstElement("#nameId").attribute("value")<br> print " Value of Name: field according to javascript: " + name_via_javascript<br> print "
Value of Name: field according to Python/DOM: " + name_via_dom<br></div><div><br></div><div><br></div><div>If anybody can shed any light on this...and/or has any thoughts or suggestions, we're all ears ;-)</div><div><br></div><div>(Btw,..our test-form.py is a heavily edited version of the distribution example file "formextractor")<br></div><div><br></div><div>I whittled down the phenomena to two pretty small test files to illustrate the problem..<br></div><div>Attached as a zipfile....one file is .py and the other one is .html<br></div><div><br></div><div>Environment,..</div><div><br></div><div>OSX Lion 10.7.2<br></div><div> Python 2.7.2</div><div> Qt 4.7.4</div><div> Sip 4.13</div><div> PyQt 4.8.6</div><div><br></div><div><br></div><div>Thank you very much,</div><div>Jim</div><div><br></div></div></body></html>