From 9a3554a78469cbb5daf90dc9ca5cd6f8fd3c428b Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Thu, 22 May 2014 16:43:38 +0200 Subject: [PATCH] Add answered_(yes|no) signals to Question. --- qutebrowser/utils/usertypes.py | 8 ++++++++ qutebrowser/widgets/statusbar/_prompt.py | 2 ++ 2 files changed, 10 insertions(+) diff --git a/qutebrowser/utils/usertypes.py b/qutebrowser/utils/usertypes.py index 105304075..9983769f6 100644 --- a/qutebrowser/utils/usertypes.py +++ b/qutebrowser/utils/usertypes.py @@ -269,9 +269,17 @@ class Question(QObject): Signals: answered: Emitted when the question has been answered by the user. + This is emitted from qutebrowser.widgets.statusbar._prompt so + it can be emitted after the mode is left. + answered_yes: Convienience signal emitted when a yesno question was + answered with yes. + answered_no: Convienience signal emitted when a yesno question was + answered with no. """ answered = pyqtSignal() + answered_yes = pyqtSignal() + answered_no = pyqtSignal() def __init__(self, parent=None): super().__init__(parent) diff --git a/qutebrowser/widgets/statusbar/_prompt.py b/qutebrowser/widgets/statusbar/_prompt.py index 1bf46d814..8c6d30a13 100644 --- a/qutebrowser/widgets/statusbar/_prompt.py +++ b/qutebrowser/widgets/statusbar/_prompt.py @@ -124,6 +124,7 @@ class Prompt(QWidget): self.question.answer = True modeman.leave('yesno', 'yesno accept') self.question.answered.emit() + self.question.answered_yes.emit() @cmdutils.register(instance='mainwindow.status.prompt', hide=True, modes=['yesno']) @@ -135,6 +136,7 @@ class Prompt(QWidget): self.question.answer = False modeman.leave('yesno', 'prompt accept') self.question.answered.emit() + self.question.answered_no.emit() def display(self): """Display the question in self.question in the widget.