From c2e3039702f2900632389dac20b8b8801b134e69 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 19 Feb 2014 14:57:31 +0100 Subject: [PATCH] Only hide temporary error message on non-modifiers --- qutebrowser/app.py | 2 +- qutebrowser/widgets/statusbar.py | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/qutebrowser/app.py b/qutebrowser/app.py index c5859200d..30fef2a77 100644 --- a/qutebrowser/app.py +++ b/qutebrowser/app.py @@ -107,7 +107,7 @@ class QuteBrowser(QApplication): self.setQuitOnLastWindowClosed(False) self.lastWindowClosed.connect(self.shutdown) self.mainwindow.tabs.keypress.connect( - self.mainwindow.status.clear_tmp_text) + self.mainwindow.status.keypress) self.mainwindow.tabs.keypress.connect(self.keyparser.handle) self.keyparser.set_cmd_text.connect( self.mainwindow.status.cmd.set_cmd_text) diff --git a/qutebrowser/widgets/statusbar.py b/qutebrowser/widgets/statusbar.py index ae8bdb6d7..3b22798ae 100644 --- a/qutebrowser/widgets/statusbar.py +++ b/qutebrowser/widgets/statusbar.py @@ -170,6 +170,19 @@ class StatusBar(QWidget): """Clear a temporary text.""" self.disp_tmp_text('') + @pyqtSlot('QKeyEvent') + def keypress(self, e): + """Hide temporary error message if a key was pressed. + + Args: + e: The original QKeyEvent. + + """ + if e.key() in [Qt.Key_Control, Qt.Key_Alt, Qt.Key_Shift, Qt.Key_Meta]: + # Only modifier pressed, don't hide yet. + return + self.clear_tmp_text() + def resizeEvent(self, e): """Extend resizeEvent of QWidget to emit a resized signal afterwards.