Emit answered signal from statusbar prompt.
This is so we can leave the mode (and hide the command widget) before emitting the answered signal (and possibly ask something again).
This commit is contained in:
parent
f3fd247282
commit
89350cbff4
@ -279,15 +279,4 @@ class Question(QObject):
|
|||||||
self.default = None
|
self.default = None
|
||||||
self.text = None
|
self.text = None
|
||||||
self.user = None
|
self.user = None
|
||||||
self._answer = None
|
self.answer = None
|
||||||
|
|
||||||
@property
|
|
||||||
def answer(self):
|
|
||||||
"""Getter for answer so we can define a setter."""
|
|
||||||
return self._answer
|
|
||||||
|
|
||||||
@answer.setter
|
|
||||||
def answer(self, val):
|
|
||||||
"""Setter for answer to emit the answered signal after setting."""
|
|
||||||
self._answer = val
|
|
||||||
self.answered.emit()
|
|
||||||
|
@ -100,14 +100,17 @@ class Prompt(QWidget):
|
|||||||
self.question.answer = (self.question.user, password)
|
self.question.answer = (self.question.user, password)
|
||||||
modeman.leave('prompt', 'prompt accept')
|
modeman.leave('prompt', 'prompt accept')
|
||||||
self.hide_prompt.emit()
|
self.hide_prompt.emit()
|
||||||
|
self.question.answered.emit()
|
||||||
elif self.question.mode == PromptMode.text:
|
elif self.question.mode == PromptMode.text:
|
||||||
# User just entered text.
|
# User just entered text.
|
||||||
self.question.answer = self._input.text()
|
self.question.answer = self._input.text()
|
||||||
modeman.leave('prompt', 'prompt accept')
|
modeman.leave('prompt', 'prompt accept')
|
||||||
|
self.question.answered.emit()
|
||||||
elif self.question.mode == PromptMode.yesno:
|
elif self.question.mode == PromptMode.yesno:
|
||||||
# User wants to accept the default of a yes/no question.
|
# User wants to accept the default of a yes/no question.
|
||||||
self.question.answer = self.question.default
|
self.question.answer = self.question.default
|
||||||
modeman.leave('yesno', 'yesno accept')
|
modeman.leave('yesno', 'yesno accept')
|
||||||
|
self.question.answered.emit()
|
||||||
else:
|
else:
|
||||||
raise ValueError("Invalid question mode!")
|
raise ValueError("Invalid question mode!")
|
||||||
|
|
||||||
@ -120,6 +123,7 @@ class Prompt(QWidget):
|
|||||||
return
|
return
|
||||||
self.question.answer = True
|
self.question.answer = True
|
||||||
modeman.leave('yesno', 'yesno accept')
|
modeman.leave('yesno', 'yesno accept')
|
||||||
|
self.question.answered.emit()
|
||||||
|
|
||||||
@cmdutils.register(instance='mainwindow.status.prompt', hide=True,
|
@cmdutils.register(instance='mainwindow.status.prompt', hide=True,
|
||||||
modes=['yesno'])
|
modes=['yesno'])
|
||||||
@ -130,6 +134,7 @@ class Prompt(QWidget):
|
|||||||
return
|
return
|
||||||
self.question.answer = False
|
self.question.answer = False
|
||||||
modeman.leave('yesno', 'prompt accept')
|
modeman.leave('yesno', 'prompt accept')
|
||||||
|
self.question.answered.emit()
|
||||||
|
|
||||||
def display(self):
|
def display(self):
|
||||||
"""Display the question in self.question in the widget.
|
"""Display the question in self.question in the widget.
|
||||||
|
Loading…
Reference in New Issue
Block a user