Add AbstractTab.key_press

This commit is contained in:
Florian Bruhin 2017-05-09 17:56:07 +02:00
parent 76fa126133
commit 4b5e528d05
3 changed files with 5 additions and 3 deletions

View File

@ -21,7 +21,7 @@
import itertools
from PyQt5.QtCore import pyqtSignal, pyqtSlot, QUrl, QObject, QSizeF
from PyQt5.QtCore import pyqtSignal, pyqtSlot, QUrl, QObject, QSizeF, Qt
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QWidget, QApplication
@ -743,6 +743,10 @@ class AbstractTab(QWidget):
def clear_ssl_errors(self):
raise NotImplementedError
def key_press(self, key, modifier=Qt.NoModifier):
"""Send a fake key event to this tab."""
raise NotImplementedError
def dump_async(self, callback, *, plain=False):
"""Dump the current page to a file ascync.

View File

@ -647,7 +647,6 @@ 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

@ -696,7 +696,6 @@ 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)