WebBrowser/WebBrowserPage.py

branch
QtWebEngine
changeset 4728
0367675d783d
parent 4726
c26e2a2dc0cb
child 4741
f9e1adc69076
equal deleted inserted replaced
4727:62b50a24fb59 4728:0367675d783d
31 31
32 import WebBrowser 32 import WebBrowser
33 import WebBrowser.WebBrowserWindow 33 import WebBrowser.WebBrowserWindow
34 34
35 from .JavaScript.ExternalJsObject import ExternalJsObject 35 from .JavaScript.ExternalJsObject import ExternalJsObject
36
37 from .Tools.WebHitTestResult import WebHitTestResult
36 38
37 import Preferences 39 import Preferences
38 import UI.PixmapCache 40 import UI.PixmapCache
39 import Globals 41 import Globals
40 42
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 """

eric ide

mercurial