719 @return result of the script |
721 @return result of the script |
720 @rtype depending upon script result |
722 @rtype depending upon script result |
721 """ |
723 """ |
722 loop = QEventLoop() |
724 loop = QEventLoop() |
723 resultDict = {"res": None} |
725 resultDict = {"res": None} |
|
726 QTimer.singleShot(500, loop.quit); |
724 |
727 |
725 def resultCallback(res, resDict=resultDict): |
728 def resultCallback(res, resDict=resultDict): |
726 if loop and loop.isRunning(): |
729 if loop and loop.isRunning(): |
727 resDict["res"] = res |
730 resDict["res"] = res |
728 loop.quit() |
731 loop.quit() |
729 |
732 |
730 self.previewView.page().runJavaScript( |
733 self.runJavaScript(script, resultCallback) |
731 script, resultCallback) |
|
732 |
734 |
733 loop.exec_() |
735 loop.exec_() |
734 return resultDict["res"] |
736 return resultDict["res"] |
735 |
737 |
736 def scroll(self, x, y): |
738 def scroll(self, x, y): |
747 .format(x, y) |
749 .format(x, y) |
748 ) |
750 ) |
749 |
751 |
750 def hitTestContent(self, pos): |
752 def hitTestContent(self, pos): |
751 """ |
753 """ |
752 Public method to test the contents at a given position. |
754 Public method to test the content at a specified position. |
753 |
755 |
754 @param pos position to be tested |
756 @param pos position to execute the test at |
755 @type QPoint |
757 @type QPoint |
756 @return object containing the test results |
758 @return test result object |
757 @rtype WebBrowserHitTestResult |
759 @rtype WebHitTestResult |
758 """ |
760 """ |
759 # TODO: WebBrowserHitTestResult |
761 return WebHitTestResult(self, pos) |
760 ## return WebBrowserHitTestResult(self, pos) |
|
761 |
762 |
762 def setupWebChannel(self): |
763 def setupWebChannel(self): |
763 """ |
764 """ |
764 Public method to setup a web channel to our external object. |
765 Public method to setup a web channel to our external object. |
765 """ |
766 """ |