From 5d5f3c7f87b9c101eebe916789260bec5dd0c6a1 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Sat, 2 Aug 2014 17:58:33 +0200 Subject: [PATCH] widgets.statusbar.prompter: Use None for self.question instead of _busy. --- qutebrowser/widgets/statusbar/prompter.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/qutebrowser/widgets/statusbar/prompter.py b/qutebrowser/widgets/statusbar/prompter.py index 7ebf88b3f..d593b957b 100644 --- a/qutebrowser/widgets/statusbar/prompter.py +++ b/qutebrowser/widgets/statusbar/prompter.py @@ -68,7 +68,6 @@ class Prompter: self.question = None self._loops = [] self._queue = deque() - self._busy = False self._prompt = prompt def __repr__(self): @@ -86,7 +85,7 @@ class Prompter: def _get_ctx(self): """Get a PromptContext based on the current state.""" - if not self._busy: + if self.question is None: return None ctx = PromptContext(question=self.question, text=self._prompt.txt.text(), @@ -106,7 +105,7 @@ class Prompter: logger.debug("Restoring context {}".format(ctx)) if ctx is None: self._prompt.hide_prompt.emit() - self._busy = False + self.question = None return False self.question = ctx.question self._prompt.txt.setText(ctx.text) @@ -154,7 +153,6 @@ class Prompter: raise ValueError("Invalid prompt mode!") self._prompt.lineedit.setFocus() self._prompt.show_prompt.emit() - self._busy = True return mode @pyqtSlot(KeyMode) @@ -165,9 +163,9 @@ class Prompter: self._prompt.lineedit.clear() self._prompt.lineedit.setEchoMode(QLineEdit.Normal) self._prompt.hide_prompt.emit() - self._busy = False if self.question.answer is None and not self.question.is_aborted: self.question.cancel() + self.question = None @cmdutils.register(instance='mainwindow.status.prompt.prompter', hide=True, modes=[KeyMode.prompt]) @@ -247,7 +245,7 @@ class Prompter: logger.debug("Asking question {}, blocking {}, loops {}, queue " "{}".format(question, blocking, self._loops, self._queue)) - if self._busy and not blocking: + if self.question is not None and not blocking: # We got an async question, but we're already busy with one, so we # just queue it up for later. logger.debug("Adding {} to queue.".format(question))