diff options
Diffstat (limited to 'qutebrowser/utils/objreg.py')
-rw-r--r-- | qutebrowser/utils/objreg.py | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/qutebrowser/utils/objreg.py b/qutebrowser/utils/objreg.py index 0819a5d0a..9f794a5e8 100644 --- a/qutebrowser/utils/objreg.py +++ b/qutebrowser/utils/objreg.py @@ -24,12 +24,11 @@ import collections import functools from typing import (TYPE_CHECKING, Any, Callable, MutableMapping, MutableSequence, Optional, Sequence, Union) - -from PyQt5.QtCore import QObject, QTimer -from PyQt5.QtWidgets import QApplication -from PyQt5.QtWidgets import QWidget +from qutebrowser.qt import QtWidgets from qutebrowser.utils import log, usertypes, utils +from qutebrowser.qt import QtCore + if TYPE_CHECKING: from qutebrowser.mainwindow import mainwindow @@ -85,7 +84,7 @@ class ObjectRegistry(collections.UserDict): # type: ignore[type-arg] self._disconnect_destroyed(name) - if isinstance(obj, QObject): + if isinstance(obj, QtCore.QObject): func = functools.partial(self.on_destroyed, name) obj.destroyed.connect(func) self._partial_objs[name] = func @@ -124,7 +123,7 @@ class ObjectRegistry(collections.UserDict): # type: ignore[type-arg] registry. """ log.destroy.debug("schedule removal: {}".format(name)) - QTimer.singleShot(0, functools.partial(self._on_destroyed, name)) + QtCore.QTimer.singleShot(0, functools.partial(self._on_destroyed, name)) def _on_destroyed(self, name: str) -> None: """Remove a destroyed QObject.""" @@ -167,7 +166,7 @@ def _get_tab_registry(win_id: _WindowTab, if tab_id is None: raise ValueError("Got tab_id None (win_id {})".format(win_id)) if tab_id == 'current' and win_id is None: - window: Optional[QWidget] = QApplication.activeWindow() + window: Optional[QtWidgets.QWidget] = QtWidgets.QApplication.activeWindow() if window is None or not hasattr(window, 'win_id'): raise RegistryUnavailableError('tab') win_id = window.win_id @@ -193,7 +192,7 @@ def _get_window_registry(window: _WindowTab) -> ObjectRegistry: raise TypeError("window is None with scope window!") try: if window == 'current': - win: Optional[QWidget] = QApplication.activeWindow() + win: Optional[QtWidgets.QWidget] = QtWidgets.QApplication.activeWindow() elif window == 'last-focused': win = last_focused_window() else: |