Add class docstrings for webkittab/webenginetab

This commit is contained in:
Florian Bruhin 2016-07-07 11:28:57 +02:00
parent de60ad04dc
commit df2c50aa60
2 changed files with 24 additions and 0 deletions

View File

@ -35,6 +35,8 @@ from qutebrowser.utils import usertypes, qtutils
class WebEngineSearch(tab.AbstractSearch):
"""QtWebEngine implementations related to searching on the page."""
## TODO
pass
@ -42,6 +44,8 @@ class WebEngineSearch(tab.AbstractSearch):
class WebEngineCaret(tab.AbstractCaret):
"""QtWebEngine implementations related to moving the cursor/selection."""
## TODO
@pyqtSlot(usertypes.KeyMode)
@ -65,6 +69,8 @@ class WebEngineCaret(tab.AbstractCaret):
class WebEngineScroller(tab.AbstractScroller):
"""QtWebEngine implementations related to scrolling."""
def _key_press(self, key, count=1):
# FIXME Abort scrolling if the minimum/maximum was reached.
press_evt = QKeyEvent(QEvent.KeyPress, key, Qt.NoModifier, 0, 0, 0)
@ -117,6 +123,8 @@ class WebEngineScroller(tab.AbstractScroller):
class WebEngineHistory(tab.AbstractHistory):
"""QtWebEngine implementations related to page history."""
def current_idx(self):
return self._history.currentItemIndex()
@ -145,6 +153,8 @@ class WebEngineHistory(tab.AbstractHistory):
class WebEngineZoom(tab.AbstractZoom):
"""QtWebEngine implementations related to zooming."""
def _set_factor_internal(self, factor):
self._widget.setZoomFactor(factor)
@ -154,6 +164,8 @@ class WebEngineZoom(tab.AbstractZoom):
class WebEngineViewTab(tab.AbstractTab):
"""A QtWebEngine tab in the browser."""
def __init__(self, win_id, modeman, parent=None):
super().__init__(win_id)
widget = webview.WebEngineView()

View File

@ -36,6 +36,8 @@ from qutebrowser.utils import qtutils, objreg, usertypes, utils
class WebViewSearch(tabmod.AbstractSearch):
"""QtWebKit implementations related to searching on the page."""
def clear(self):
# We first clear the marked text, then the highlights
self._widget.search('', 0)
@ -76,6 +78,8 @@ class WebViewSearch(tabmod.AbstractSearch):
class WebViewCaret(tabmod.AbstractCaret):
"""QtWebKit implementations related to moving the cursor/selection."""
@pyqtSlot(usertypes.KeyMode)
def on_mode_entered(self, mode):
if mode != usertypes.KeyMode.caret:
@ -294,6 +298,8 @@ class WebViewCaret(tabmod.AbstractCaret):
class WebViewZoom(tabmod.AbstractZoom):
"""QtWebKit implementations related to zooming."""
def _set_factor_internal(self, factor):
self._widget.setZoomFactor(factor)
@ -303,6 +309,8 @@ class WebViewZoom(tabmod.AbstractZoom):
class WebViewScroller(tabmod.AbstractScroller):
"""QtWebKit implementations related to scrolling."""
def pos_px(self):
return self._widget.page().mainFrame().scrollPosition()
@ -396,6 +404,8 @@ class WebViewScroller(tabmod.AbstractScroller):
class WebViewHistory(tabmod.AbstractHistory):
"""QtWebKit implementations related to page history."""
def current_idx(self):
return self._history.currentItemIndex()
@ -434,6 +444,8 @@ class WebViewHistory(tabmod.AbstractHistory):
class WebViewTab(tabmod.AbstractTab):
"""A QtWebKit tab in the browser."""
def __init__(self, win_id, modeman, parent=None):
super().__init__(win_id)
widget = webview.WebView(win_id, self.tab_id, tab=self)