Add answered_(yes|no) signals to Question.

This commit is contained in:
Florian Bruhin 2014-05-22 16:43:38 +02:00
parent 89350cbff4
commit 9a3554a784
2 changed files with 10 additions and 0 deletions

View File

@ -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)

View File

@ -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.