summaryrefslogtreecommitdiff
path: root/scripts/keytester.py
diff options
context:
space:
mode:
authorFlorian Bruhin <git@the-compiler.org>2015-05-12 09:02:17 +0200
committerFlorian Bruhin <git@the-compiler.org>2015-05-12 09:03:25 +0200
commitc88393ccfd0fba4b611e4b34063a72ae58ee9739 (patch)
tree5151a4185d9637ffe0fc0ac0eca9370445d649fa /scripts/keytester.py
parentd9655f5eb976f44fd5c919ef2173e6bf5ea47dd6 (diff)
downloadqutebrowser-c88393ccfd0fba4b611e4b34063a72ae58ee9739.tar.gz
qutebrowser-c88393ccfd0fba4b611e4b34063a72ae58ee9739.zip
Add minimal key tester script.
See #658.
Diffstat (limited to 'scripts/keytester.py')
-rw-r--r--scripts/keytester.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/scripts/keytester.py b/scripts/keytester.py
new file mode 100644
index 000000000..effcdd468
--- /dev/null
+++ b/scripts/keytester.py
@@ -0,0 +1,23 @@
+from PyQt5.QtWidgets import QApplication, QWidget, QLabel, QHBoxLayout
+
+from qutebrowser.utils import utils
+
+
+class KeyWidget(QWidget):
+
+ """Widget displaying key presses."""
+
+ def __init__(self, parent=None):
+ super().__init__(parent)
+ self._layout = QHBoxLayout(self)
+ self._label = QLabel(text="Waiting for keypress...")
+ self._layout.addWidget(self._label)
+
+ def keyPressEvent(self, e):
+ self._label.setText(utils.keyevent_to_string(e))
+
+
+app = QApplication([])
+w = KeyWidget()
+w.show()
+app.exec_()