Move _on_aborted to slot
This commit is contained in:
parent
6adb610f97
commit
32a2647942
|
|
@ -22,6 +22,7 @@
|
|||
import os.path
|
||||
import html
|
||||
import collections
|
||||
import functools
|
||||
|
||||
import attr
|
||||
from PyQt5.QtCore import (pyqtSlot, pyqtSignal, Qt, QTimer, QDir, QModelIndex,
|
||||
|
|
@ -329,16 +330,10 @@ class PromptContainer(QWidget):
|
|||
log.prompt.debug("Displaying prompt {}".format(prompt))
|
||||
self._prompt = prompt
|
||||
|
||||
# If this question was interrupted, we already connected the signal
|
||||
if not question.interrupted:
|
||||
# If this question was interrupted, we already connected the signal
|
||||
def on_aborted():
|
||||
try:
|
||||
modeman.leave(self._win_id, prompt.KEY_MODE,
|
||||
'aborted', maybe=True)
|
||||
except objreg.RegistryUnavailableError:
|
||||
# window was deleted: ignore
|
||||
pass
|
||||
question.aborted.connect(on_aborted)
|
||||
question.aborted.connect(
|
||||
functools.partial(self._on_aborted, prompt.KEY_MODE))
|
||||
modeman.enter(self._win_id, prompt.KEY_MODE, 'question asked')
|
||||
|
||||
self.setSizePolicy(prompt.sizePolicy())
|
||||
|
|
@ -348,6 +343,15 @@ class PromptContainer(QWidget):
|
|||
prompt.setFocus()
|
||||
self.update_geometry.emit()
|
||||
|
||||
@pyqtSlot()
|
||||
def _on_aborted(self, key_mode):
|
||||
"""Leave KEY_MODE whenever a prompt is aborted."""
|
||||
try:
|
||||
modeman.leave(self._win_id, key_mode, 'aborted', maybe=True)
|
||||
except objreg.RegistryUnavailableError:
|
||||
# window was deleted: ignore
|
||||
pass
|
||||
|
||||
@pyqtSlot(usertypes.KeyMode)
|
||||
def _on_prompt_done(self, key_mode):
|
||||
"""Leave the prompt mode in this window if a question was answered."""
|
||||
|
|
|
|||
|
|
@ -92,6 +92,15 @@ Feature: Downloading things from a website.
|
|||
And I run :leave-mode
|
||||
Then no crash should happen
|
||||
|
||||
Scenario: Aborting a download in a different window (issue 3378)
|
||||
When I set downloads.location.suggestion to filename
|
||||
And I set downloads.location.prompt to true
|
||||
And I open data/downloads/download.bin in a new window without waiting
|
||||
And I wait for "Asking question <qutebrowser.utils.usertypes.Question default='*' mode=<PromptMode.download: 5> *" in the log
|
||||
And I run :window-only
|
||||
And I run :leave-mode
|
||||
Then no crash should happen
|
||||
|
||||
# https://github.com/qutebrowser/qutebrowser/issues/4240
|
||||
@qt<5.11.2
|
||||
Scenario: Downloading with SSL errors (issue 1413)
|
||||
|
|
|
|||
Loading…
Reference in New Issue