Rename key_press to fake_key_press
This commit is contained in:
parent
7a3d1b0212
commit
2cd2c60a8b
@ -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,9 +1045,9 @@ class AbstractTab(QWidget):
|
||||
def stop(self) -> None:
|
||||
raise NotImplementedError
|
||||
|
||||
def key_press(self,
|
||||
key: Qt.Key,
|
||||
modifier: Qt.KeyboardModifier = Qt.NoModifier) -> None:
|
||||
def fake_key_press(self,
|
||||
key: Qt.Key,
|
||||
modifier: Qt.KeyboardModifier = Qt.NoModifier) -> None:
|
||||
"""Send a fake key event to this tab."""
|
||||
press_evt = QKeyEvent(QEvent.KeyPress, key, modifier, 0, 0, 0)
|
||||
release_evt = QKeyEvent(QEvent.KeyRelease, key, modifier,
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user