Rename key_press to fake_key_press

This commit is contained in:
Florian Bruhin 2018-11-29 19:30:28 +01:00
parent 7a3d1b0212
commit 2cd2c60a8b
3 changed files with 9 additions and 9 deletions

View File

@ -512,9 +512,9 @@ class AbstractCaret(QObject):
def _follow_enter(self, tab: bool) -> None:
"""Follow a link by faking an enter press."""
if tab:
self._tab.key_press(Qt.Key_Enter, modifier=Qt.ControlModifier)
self._tab.fake_key_press(Qt.Key_Enter, modifier=Qt.ControlModifier)
else:
self._tab.key_press(Qt.Key_Enter)
self._tab.fake_key_press(Qt.Key_Enter)
def follow_selected(self, *, tab: bool = False) -> None:
raise NotImplementedError
@ -1045,7 +1045,7 @@ class AbstractTab(QWidget):
def stop(self) -> None:
raise NotImplementedError
def key_press(self,
def fake_key_press(self,
key: Qt.Key,
modifier: Qt.KeyboardModifier = Qt.NoModifier) -> None:
"""Send a fake key event to this tab."""

View File

@ -423,7 +423,7 @@ class WebEngineScroller(browsertab.AbstractScroller):
def _repeated_key_press(self, key, count=1, modifier=Qt.NoModifier):
"""Send count fake key presses to this scroller's WebEngineTab."""
for _ in range(min(count, 1000)):
self._tab.key_press(key, modifier)
self._tab.fake_key_press(key, modifier)
@pyqtSlot(QPointF)
def _update_pos(self, pos):
@ -500,10 +500,10 @@ class WebEngineScroller(browsertab.AbstractScroller):
self._repeated_key_press(Qt.Key_Right, count)
def top(self):
self._tab.key_press(Qt.Key_Home)
self._tab.fake_key_press(Qt.Key_Home)
def bottom(self):
self._tab.key_press(Qt.Key_End)
self._tab.fake_key_press(Qt.Key_End)
def page_up(self, count=1):
self._repeated_key_press(Qt.Key_PageUp, count)

View File

@ -474,7 +474,7 @@ class WebKitScroller(browsertab.AbstractScroller):
if (getter is not None and
frame.scrollBarValue(direction) == getter(direction)):
return
self._tab.key_press(key)
self._tab.fake_key_press(key)
def up(self, count=1):
self._key_press(Qt.Key_Up, count, 'scrollBarMinimum', Qt.Vertical)