diff options
Diffstat (limited to 'qutebrowser/browser/inspector.py')
-rw-r--r-- | qutebrowser/browser/inspector.py | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/qutebrowser/browser/inspector.py b/qutebrowser/browser/inspector.py index a2ce67750..e60e4a2b8 100644 --- a/qutebrowser/browser/inspector.py +++ b/qutebrowser/browser/inspector.py @@ -1,19 +1,6 @@ -# Copyright 2015-2021 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# SPDX-FileCopyrightText: Florian Bruhin (The Compiler) <mail@qutebrowser.org> # -# This file is part of qutebrowser. -# -# qutebrowser is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# qutebrowser is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with qutebrowser. If not, see <https://www.gnu.org/licenses/>. +# SPDX-License-Identifier: GPL-3.0-or-later """Base class for a QtWebKit/QtWebEngine web inspector.""" @@ -28,7 +15,7 @@ from qutebrowser.qt.gui import QCloseEvent from qutebrowser.browser import eventfilter from qutebrowser.config import configfiles, config -from qutebrowser.utils import log, usertypes +from qutebrowser.utils import log, usertypes, qtutils from qutebrowser.keyinput import modeman from qutebrowser.misc import miscwidgets @@ -70,8 +57,9 @@ class _EventFilter(QObject): clicked = pyqtSignal() - def eventFilter(self, _obj: QObject, event: QEvent) -> bool: + def eventFilter(self, _obj: Optional[QObject], event: Optional[QEvent]) -> bool: """Translate mouse presses to a clicked signal.""" + assert event is not None if event.type() == QEvent.Type.MouseButtonPress: self.clicked.emit() return False @@ -162,7 +150,7 @@ class AbstractWebInspector(QWidget): self.shutdown() return elif position == Position.window: - self.setParent(None) # type: ignore[call-overload] + self.setParent(qtutils.QT_NONE) self._load_state_geometry() else: self._splitter.set_inspector(self, position) @@ -195,7 +183,7 @@ class AbstractWebInspector(QWidget): if not ok: log.init.warning("Error while loading geometry.") - def closeEvent(self, _e: QCloseEvent) -> None: + def closeEvent(self, _e: Optional[QCloseEvent]) -> None: """Save the geometry when closed.""" data = self._widget.saveGeometry().data() geom = base64.b64encode(data).decode('ASCII') |