391 Public method to reset the zoom factor. |
391 Public method to reset the zoom factor. |
392 """ |
392 """ |
393 index = self.__levelForZoom(WebBrowserView.ZoomLevelDefault) |
393 index = self.__levelForZoom(WebBrowserView.ZoomLevelDefault) |
394 self.setZoomValue(self.__zoomLevels[index]) |
394 self.setZoomValue(self.__zoomLevels[index]) |
395 |
395 |
|
396 def mapToViewport(self, pos): |
|
397 """ |
|
398 Public method to map a position to the viewport. |
|
399 |
|
400 @param pos position to be mapped |
|
401 @type QPoint |
|
402 @return viewport position |
|
403 @rtype QPoint |
|
404 """ |
|
405 return self.page().mapToViewport(pos) |
|
406 |
396 def hasSelection(self): |
407 def hasSelection(self): |
397 """ |
408 """ |
398 Public method to determine, if there is some text selected. |
409 Public method to determine, if there is some text selected. |
399 |
410 |
400 @return flag indicating text has been selected (boolean) |
411 @return flag indicating text has been selected (boolean) |
607 @param menu reference to the menu to be populated |
618 @param menu reference to the menu to be populated |
608 @type QMenu |
619 @type QMenu |
609 @param hitTest reference to the hit test object |
620 @param hitTest reference to the hit test object |
610 @type WebHitTestResult |
621 @type WebHitTestResult |
611 """ |
622 """ |
612 self.__clickedPos = hitTest.pos() |
|
613 |
|
614 if not menu.isEmpty(): |
623 if not menu.isEmpty(): |
615 menu.addSeparator() |
624 menu.addSeparator() |
616 |
625 |
617 if hitTest.mediaPaused(): |
626 if hitTest.mediaPaused(): |
618 menu.addAction( |
627 menu.addAction( |
812 @param act reference to the action to be populated upon success |
821 @param act reference to the action to be populated upon success |
813 @type QAction |
822 @type QAction |
814 @param pos position to be tested |
823 @param pos position to be tested |
815 @type QPoint |
824 @type QPoint |
816 """ |
825 """ |
817 self.__clickedPos = pos |
826 self.__clickedPos = self.mapToViewport(pos) |
818 |
827 |
819 from .Tools import Scripts |
828 from .Tools import Scripts |
820 script = Scripts.getFormData(pos) |
829 script = Scripts.getFormData(self.__clickedPos) |
821 self.page().runJavaScript( |
830 self.page().runJavaScript( |
822 script, lambda res: self.__checkForFormCallback(res, act)) |
831 script, lambda res: self.__checkForFormCallback(res, act)) |
823 |
832 |
824 def __checkForFormCallback(self, res, act): |
833 def __checkForFormCallback(self, res, act): |
825 """ |
834 """ |