diff --git a/qutebrowser/app.py b/qutebrowser/app.py index cdce0be6d..0f4b45b0e 100644 --- a/qutebrowser/app.py +++ b/qutebrowser/app.py @@ -372,9 +372,6 @@ def _init_modules(args, crash_handler): crash_handler: The CrashHandler instance. """ # pylint: disable=too-many-statements - log.init.debug("Initializing prompts...") - prompt.init() - log.init.debug("Initializing save manager...") save_manager = savemanager.SaveManager(qApp) objreg.register('save-manager', save_manager) @@ -391,6 +388,9 @@ def _init_modules(args, crash_handler): config.init(qApp) save_manager.init_autosave() + log.init.debug("Initializing prompts...") + prompt.init() + log.init.debug("Initializing web history...") history.init(qApp) diff --git a/qutebrowser/mainwindow/mainwindow.py b/qutebrowser/mainwindow/mainwindow.py index 490529180..f06c926b8 100644 --- a/qutebrowser/mainwindow/mainwindow.py +++ b/qutebrowser/mainwindow/mainwindow.py @@ -183,13 +183,9 @@ class MainWindow(QWidget): self._messageview = messageview.MessageView(parent=self) self._add_overlay(self._messageview, self._messageview.update_geometry) - self._prompt_container = prompt.PromptContainer(self.win_id, self) - self._add_overlay(self._prompt_container, - self._prompt_container.update_geometry, + self._add_overlay(prompt.prompt_container, + prompt.prompt_container.update_geometry, centered=True, padding=10) - objreg.register('prompt-container', self._prompt_container, - scope='window', window=self.win_id) - self._prompt_container.hide() log.init.debug("Initializing modes...") modeman.init(self.win_id, self) diff --git a/qutebrowser/mainwindow/prompt.py b/qutebrowser/mainwindow/prompt.py index 6c21bb69a..1b91bb0c6 100644 --- a/qutebrowser/mainwindow/prompt.py +++ b/qutebrowser/mainwindow/prompt.py @@ -292,7 +292,6 @@ class PromptContainer(QWidget): Attributes: _layout: The layout used to show prompts in. - _win_id: The window ID this object is associated with. Signals: update_geometry: Emitted when the geometry should be updated. @@ -318,11 +317,10 @@ class PromptContainer(QWidget): """ update_geometry = pyqtSignal() - def __init__(self, win_id, parent=None): + def __init__(self, parent=None): super().__init__(parent) self._layout = QVBoxLayout(self) self._layout.setContentsMargins(10, 10, 10, 10) - self._win_id = win_id self.setObjectName('PromptContainer') self.setAttribute(Qt.WA_StyledBackground, True) @@ -332,7 +330,7 @@ class PromptContainer(QWidget): prompt_queue.show_prompt.connect(self._on_show_prompt) def __repr__(self): - return utils.get_repr(self, win_id=self._win_id) + return utils.get_repr(self) @pyqtSlot(object) def _on_show_prompt(self, prompt): @@ -351,10 +349,11 @@ class PromptContainer(QWidget): self.hide() return - prompt.question.aborted.connect( - lambda: modeman.maybe_leave(self._win_id, prompt.KEY_MODE, - 'aborted')) - modeman.enter(self._win_id, prompt.KEY_MODE, 'question asked') + # FIXME no win-id + # prompt.question.aborted.connect( + # lambda: modeman.maybe_leave(self._win_id, prompt.KEY_MODE, + # 'aborted')) + # modeman.enter(self._win_id, prompt.KEY_MODE, 'question asked') self.setSizePolicy(prompt.sizePolicy()) self._layout.addWidget(prompt) @@ -366,7 +365,8 @@ class PromptContainer(QWidget): @pyqtSlot(usertypes.KeyMode) def _on_prompt_done(self, key_mode): """Leave the prompt mode in this window if a question was answered.""" - modeman.maybe_leave(self._win_id, key_mode, ':prompt-accept') + # FIXME no win-id + #modeman.maybe_leave(self._win_id, key_mode, ':prompt-accept') class LineEdit(QLineEdit): @@ -752,8 +752,9 @@ class AlertPrompt(_BasePrompt): def init(): - global prompt_queue + global prompt_queue, prompt_container prompt_queue = PromptQueue() + prompt_container = PromptContainer() objreg.register('prompt-queue', prompt_queue) # for commands message.global_bridge.ask_question.connect( prompt_queue.ask_question, Qt.DirectConnection)