Only connect interrupted signal for questions once
This commit is contained in:
parent
a87e46101c
commit
4552e06797
@ -170,6 +170,8 @@ class PromptQueue(QObject):
|
|||||||
log.prompt.debug("New question is blocking, saving {}".format(
|
log.prompt.debug("New question is blocking, saving {}".format(
|
||||||
self._question))
|
self._question))
|
||||||
old_question = self._question
|
old_question = self._question
|
||||||
|
if old_question is not None:
|
||||||
|
old_question.interrupted = True
|
||||||
|
|
||||||
self._question = question
|
self._question = question
|
||||||
self.show_prompts.emit(question)
|
self.show_prompts.emit(question)
|
||||||
@ -184,7 +186,6 @@ class PromptQueue(QObject):
|
|||||||
loop.exec_()
|
loop.exec_()
|
||||||
log.prompt.debug("Ending loop.exec_() for {}".format(question))
|
log.prompt.debug("Ending loop.exec_() for {}".format(question))
|
||||||
|
|
||||||
# FIXME don't we end up connecting modeman signals twice here now?
|
|
||||||
log.prompt.debug("Restoring old question {}".format(old_question))
|
log.prompt.debug("Restoring old question {}".format(old_question))
|
||||||
self._question = old_question
|
self._question = old_question
|
||||||
self.show_prompts.emit(old_question)
|
self.show_prompts.emit(old_question)
|
||||||
@ -294,9 +295,11 @@ class PromptContainer(QWidget):
|
|||||||
log.prompt.debug("Displaying prompt {}".format(prompt))
|
log.prompt.debug("Displaying prompt {}".format(prompt))
|
||||||
self._prompt = prompt
|
self._prompt = prompt
|
||||||
|
|
||||||
question.aborted.connect(
|
if not question.interrupted:
|
||||||
lambda: modeman.maybe_leave(self._win_id, prompt.KEY_MODE,
|
# If this question was interrupted, we already connected the signal
|
||||||
'aborted'))
|
question.aborted.connect(
|
||||||
|
lambda: modeman.maybe_leave(self._win_id, prompt.KEY_MODE,
|
||||||
|
'aborted'))
|
||||||
modeman.enter(self._win_id, prompt.KEY_MODE, 'question asked')
|
modeman.enter(self._win_id, prompt.KEY_MODE, 'question asked')
|
||||||
|
|
||||||
self.setSizePolicy(prompt.sizePolicy())
|
self.setSizePolicy(prompt.sizePolicy())
|
||||||
|
@ -339,6 +339,7 @@ class Question(QObject):
|
|||||||
text: The prompt text to display to the user.
|
text: The prompt text to display to the user.
|
||||||
answer: The value the user entered (as password for user_pwd).
|
answer: The value the user entered (as password for user_pwd).
|
||||||
is_aborted: Whether the question was aborted.
|
is_aborted: Whether the question was aborted.
|
||||||
|
interrupted: Whether the question was interrupted by another one.
|
||||||
|
|
||||||
Signals:
|
Signals:
|
||||||
answered: Emitted when the question has been answered by the user.
|
answered: Emitted when the question has been answered by the user.
|
||||||
@ -368,6 +369,7 @@ class Question(QObject):
|
|||||||
self.text = None
|
self.text = None
|
||||||
self.answer = None
|
self.answer = None
|
||||||
self.is_aborted = False
|
self.is_aborted = False
|
||||||
|
self.interrupted = False
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return utils.get_repr(self, title=self.title, text=self.text,
|
return utils.get_repr(self, title=self.title, text=self.text,
|
||||||
|
Loading…
Reference in New Issue
Block a user