diff --git a/qutebrowser/app.py b/qutebrowser/app.py index 1064c758f..64717b43e 100644 --- a/qutebrowser/app.py +++ b/qutebrowser/app.py @@ -375,7 +375,7 @@ class Application(QApplication): completion = self.mainwindow.completion tabs = self.mainwindow.tabs cmd = self.mainwindow.status.cmd - completer = self.mainwindow.completion.completer + completer = self.registry['completer'] searchrunner = self.registry['searchrunner'] messagebridge = self.registry['messagebridge'] modeman = self.registry['modeman'] diff --git a/qutebrowser/widgets/completion.py b/qutebrowser/widgets/completion.py index 9594d800c..12e2dc6b5 100644 --- a/qutebrowser/widgets/completion.py +++ b/qutebrowser/widgets/completion.py @@ -29,7 +29,7 @@ from PyQt5.QtCore import pyqtSlot, pyqtSignal, Qt, QItemSelectionModel from qutebrowser.commands import cmdutils from qutebrowser.config import config, style from qutebrowser.widgets import completiondelegate -from qutebrowser.utils import completer, usertypes, qtutils +from qutebrowser.utils import completer, usertypes, qtutils, utils class CompletionView(QTreeView): @@ -45,7 +45,6 @@ class CompletionView(QTreeView): COLUMN_WIDTHS: A list of column widths, in percent. Attributes: - completer: The Completer instance to use. enabled: Whether showing the CompletionView is enabled. _height: The height to use for the CompletionView. _height_perc: Either None or a percentage if height should be relative. @@ -92,7 +91,8 @@ class CompletionView(QTreeView): def __init__(self, parent=None): super().__init__(parent) - self.completer = completer.Completer(self) + completer_obj = completer.Completer(self) + utils.register_object('completer', completer_obj) self.enabled = config.get('completion', 'show') self._delegate = completiondelegate.CompletionItemDelegate(self) @@ -225,7 +225,7 @@ class CompletionView(QTreeView): def selectionChanged(self, selected, deselected): """Extend selectionChanged to call completers selection_changed.""" super().selectionChanged(selected, deselected) - self.completer.selection_changed(selected, deselected) + utils.get_object('completer').selection_changed(selected, deselected) def resizeEvent(self, e): """Extend resizeEvent to adjust column size."""