Add docstrings to key_press methods

This commit is contained in:
Jay Kamat 2017-05-08 23:43:21 -07:00
parent 5bdd291d28
commit d1aac9e9e9
No known key found for this signature in database
GPG Key ID: 5D2E399600F4F7B5
2 changed files with 3 additions and 0 deletions

View File

@ -312,6 +312,7 @@ class WebEngineScroller(browsertab.AbstractScroller):
page.scrollPositionChanged.connect(self._update_pos)
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, 5000)):
self._tab.key_press(key, modifier)
@ -652,6 +653,7 @@ class WebEngineTab(browsertab.AbstractTab):
raise browsertab.UnsupportedOperationError
def key_press(self, key, modifier=Qt.NoModifier):
"""Send a fake key event to this WebKitTab."""
press_evt = QKeyEvent(QEvent.KeyPress, key, modifier, 0, 0, 0)
release_evt = QKeyEvent(QEvent.KeyRelease, key, modifier,
0, 0, 0)

View File

@ -699,6 +699,7 @@ class WebKitTab(browsertab.AbstractTab):
self.networkaccessmanager().clear_all_ssl_errors()
def key_press(self, key, modifier=Qt.NoModifier):
"""Send a fake key event to this WebKitTab."""
press_evt = QKeyEvent(QEvent.KeyPress, key, modifier, 0, 0, 0)
release_evt = QKeyEvent(QEvent.KeyRelease, key, modifier,
0, 0, 0)