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:
|
def _follow_enter(self, tab: bool) -> None:
|
||||||
"""Follow a link by faking an enter press."""
|
"""Follow a link by faking an enter press."""
|
||||||
if tab:
|
if tab:
|
||||||
self._tab.key_press(Qt.Key_Enter, modifier=Qt.ControlModifier)
|
self._tab.fake_key_press(Qt.Key_Enter, modifier=Qt.ControlModifier)
|
||||||
else:
|
else:
|
||||||
self._tab.key_press(Qt.Key_Enter)
|
self._tab.fake_key_press(Qt.Key_Enter)
|
||||||
|
|
||||||
def follow_selected(self, *, tab: bool = False) -> None:
|
def follow_selected(self, *, tab: bool = False) -> None:
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
@ -1045,7 +1045,7 @@ class AbstractTab(QWidget):
|
|||||||
def stop(self) -> None:
|
def stop(self) -> None:
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
def key_press(self,
|
def fake_key_press(self,
|
||||||
key: Qt.Key,
|
key: Qt.Key,
|
||||||
modifier: Qt.KeyboardModifier = Qt.NoModifier) -> None:
|
modifier: Qt.KeyboardModifier = Qt.NoModifier) -> None:
|
||||||
"""Send a fake key event to this tab."""
|
"""Send a fake key event to this tab."""
|
||||||
|
@ -423,7 +423,7 @@ class WebEngineScroller(browsertab.AbstractScroller):
|
|||||||
def _repeated_key_press(self, key, count=1, modifier=Qt.NoModifier):
|
def _repeated_key_press(self, key, count=1, modifier=Qt.NoModifier):
|
||||||
"""Send count fake key presses to this scroller's WebEngineTab."""
|
"""Send count fake key presses to this scroller's WebEngineTab."""
|
||||||
for _ in range(min(count, 1000)):
|
for _ in range(min(count, 1000)):
|
||||||
self._tab.key_press(key, modifier)
|
self._tab.fake_key_press(key, modifier)
|
||||||
|
|
||||||
@pyqtSlot(QPointF)
|
@pyqtSlot(QPointF)
|
||||||
def _update_pos(self, pos):
|
def _update_pos(self, pos):
|
||||||
@ -500,10 +500,10 @@ class WebEngineScroller(browsertab.AbstractScroller):
|
|||||||
self._repeated_key_press(Qt.Key_Right, count)
|
self._repeated_key_press(Qt.Key_Right, count)
|
||||||
|
|
||||||
def top(self):
|
def top(self):
|
||||||
self._tab.key_press(Qt.Key_Home)
|
self._tab.fake_key_press(Qt.Key_Home)
|
||||||
|
|
||||||
def bottom(self):
|
def bottom(self):
|
||||||
self._tab.key_press(Qt.Key_End)
|
self._tab.fake_key_press(Qt.Key_End)
|
||||||
|
|
||||||
def page_up(self, count=1):
|
def page_up(self, count=1):
|
||||||
self._repeated_key_press(Qt.Key_PageUp, count)
|
self._repeated_key_press(Qt.Key_PageUp, count)
|
||||||
|
@ -474,7 +474,7 @@ class WebKitScroller(browsertab.AbstractScroller):
|
|||||||
if (getter is not None and
|
if (getter is not None and
|
||||||
frame.scrollBarValue(direction) == getter(direction)):
|
frame.scrollBarValue(direction) == getter(direction)):
|
||||||
return
|
return
|
||||||
self._tab.key_press(key)
|
self._tab.fake_key_press(key)
|
||||||
|
|
||||||
def up(self, count=1):
|
def up(self, count=1):
|
||||||
self._key_press(Qt.Key_Up, count, 'scrollBarMinimum', Qt.Vertical)
|
self._key_press(Qt.Key_Up, count, 'scrollBarMinimum', Qt.Vertical)
|
||||||
|
Loading…
Reference in New Issue
Block a user