From 4b5e528d0556ca0c86d7ff7f70158aacf2404463 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 9 May 2017 17:56:07 +0200 Subject: [PATCH] Add AbstractTab.key_press --- qutebrowser/browser/browsertab.py | 6 +++++- qutebrowser/browser/webengine/webenginetab.py | 1 - qutebrowser/browser/webkit/webkittab.py | 1 - 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/qutebrowser/browser/browsertab.py b/qutebrowser/browser/browsertab.py index 21c0a080e..aa7025edf 100644 --- a/qutebrowser/browser/browsertab.py +++ b/qutebrowser/browser/browsertab.py @@ -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. diff --git a/qutebrowser/browser/webengine/webenginetab.py b/qutebrowser/browser/webengine/webenginetab.py index bc7a5bf35..c97035c0b 100644 --- a/qutebrowser/browser/webengine/webenginetab.py +++ b/qutebrowser/browser/webengine/webenginetab.py @@ -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) diff --git a/qutebrowser/browser/webkit/webkittab.py b/qutebrowser/browser/webkit/webkittab.py index 0cf83e2a7..cf33098e0 100644 --- a/qutebrowser/browser/webkit/webkittab.py +++ b/qutebrowser/browser/webkit/webkittab.py @@ -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)