From 76eab7617b61bda58c4a80d7cbd4662f5ec7e784 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Sat, 23 Jul 2016 11:39:29 +0200 Subject: [PATCH] Remove @pyqtSlot for functions and non-QObjects Fixes #1669 --- CHANGELOG.asciidoc | 1 + qutebrowser/app.py | 2 -- qutebrowser/browser/browsertab.py | 2 -- qutebrowser/browser/hints.py | 1 - qutebrowser/browser/webengine/webenginetab.py | 2 -- qutebrowser/browser/webkit/webkittab.py | 1 - qutebrowser/completion/models/instances.py | 5 ----- qutebrowser/mainwindow/tabbedbrowser.py | 1 - qutebrowser/utils/message.py | 3 +-- tests/unit/misc/test_msgbox.py | 3 +-- tests/unit/utils/test_error.py | 3 +-- 11 files changed, 4 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 8fbe27539..16884d96d 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -47,6 +47,7 @@ Changed Fixed ----- +- Copmpatibility with PyQt 5.7 - Fixed some configuration values being lost when a config option gets removed from qutebrowser's code. diff --git a/qutebrowser/app.py b/qutebrowser/app.py index ebc2bc096..f691595d4 100644 --- a/qutebrowser/app.py +++ b/qutebrowser/app.py @@ -337,7 +337,6 @@ def _save_version(): state_config['general']['version'] = qutebrowser.__version__ -@pyqtSlot('QWidget*', 'QWidget*') def on_focus_changed(_old, new): """Register currently focused main window in the object registry.""" if not isinstance(new, QWidget): @@ -355,7 +354,6 @@ def on_focus_changed(_old, new): _maybe_hide_mouse_cursor() -@pyqtSlot(QUrl) def open_desktopservices_url(url): """Handler to open a URL via QDesktopServices.""" win_id = mainwindow.get_window(via_ipc=True, force_window=False) diff --git a/qutebrowser/browser/browsertab.py b/qutebrowser/browser/browsertab.py index fa91bc37f..b6d64cc67 100644 --- a/qutebrowser/browser/browsertab.py +++ b/qutebrowser/browser/browsertab.py @@ -24,7 +24,6 @@ import itertools from PyQt5.QtCore import pyqtSignal, pyqtSlot, QUrl, QObject, QPoint from PyQt5.QtGui import QIcon from PyQt5.QtWidgets import QWidget, QLayout -from PyQt5.QtPrintSupport import QPrinter from qutebrowser.keyinput import modeman from qutebrowser.config import config @@ -122,7 +121,6 @@ class AbstractPrinting: def to_pdf(self, filename): raise NotImplementedError - @pyqtSlot(QPrinter) def to_printer(self, printer): raise NotImplementedError diff --git a/qutebrowser/browser/hints.py b/qutebrowser/browser/hints.py index 7e30b8118..be2b1bcef 100644 --- a/qutebrowser/browser/hints.py +++ b/qutebrowser/browser/hints.py @@ -52,7 +52,6 @@ class WordHintingError(Exception): """Exception raised on errors during word hinting.""" -@pyqtSlot(usertypes.KeyMode) def on_mode_entered(mode, win_id): """Stop hinting when insert mode was entered.""" if mode == usertypes.KeyMode.insert: diff --git a/qutebrowser/browser/webengine/webenginetab.py b/qutebrowser/browser/webengine/webenginetab.py index 9dc9207c1..af874634f 100644 --- a/qutebrowser/browser/webengine/webenginetab.py +++ b/qutebrowser/browser/webengine/webenginetab.py @@ -25,7 +25,6 @@ from PyQt5.QtCore import pyqtSlot, Qt, QEvent, QPoint from PyQt5.QtGui import QKeyEvent, QIcon from PyQt5.QtWidgets import QApplication -from PyQt5.QtPrintSupport import QPrinter # pylint: disable=no-name-in-module,import-error,useless-suppression from PyQt5.QtWebEngineWidgets import QWebEnginePage # pylint: enable=no-name-in-module,import-error,useless-suppression @@ -51,7 +50,6 @@ class WebEnginePrinting(browsertab.AbstractPrinting): def to_pdf(self, filename): self._widget.page().printToPdf(filename) - @pyqtSlot(QPrinter) def to_printer(self, printer): # Should never be called assert False diff --git a/qutebrowser/browser/webkit/webkittab.py b/qutebrowser/browser/webkit/webkittab.py index f5ab2d7b9..ef3dbdce4 100644 --- a/qutebrowser/browser/webkit/webkittab.py +++ b/qutebrowser/browser/webkit/webkittab.py @@ -55,7 +55,6 @@ class WebKitPrinting(browsertab.AbstractPrinting): printer.setOutputFileName(filename) self.to_printer(printer) - @pyqtSlot(QPrinter) def to_printer(self, printer): self._widget.print(printer) diff --git a/qutebrowser/completion/models/instances.py b/qutebrowser/completion/models/instances.py index 127275f01..c92225539 100644 --- a/qutebrowser/completion/models/instances.py +++ b/qutebrowser/completion/models/instances.py @@ -27,8 +27,6 @@ Module attributes: import functools -from PyQt5.QtCore import pyqtSlot - from qutebrowser.completion.models import (miscmodels, urlmodel, configmodel, base) from qutebrowser.utils import objreg, usertypes, log, debug @@ -84,7 +82,6 @@ def _init_setting_completions(): _instances[usertypes.Completion.value][sectname][opt] = val_model -@pyqtSlot() def init_quickmark_completions(): """Initialize quickmark completion models.""" log.completion.debug("Initializing quickmark completion.") @@ -96,7 +93,6 @@ def init_quickmark_completions(): _instances[usertypes.Completion.quickmark_by_name] = model -@pyqtSlot() def init_bookmark_completions(): """Initialize bookmark completion models.""" log.completion.debug("Initializing bookmark completion.") @@ -108,7 +104,6 @@ def init_bookmark_completions(): _instances[usertypes.Completion.bookmark_by_url] = model -@pyqtSlot() def init_session_completion(): """Initialize session completion model.""" log.completion.debug("Initializing session completion.") diff --git a/qutebrowser/mainwindow/tabbedbrowser.py b/qutebrowser/mainwindow/tabbedbrowser.py index 0c1bde5f2..29c5114cc 100644 --- a/qutebrowser/mainwindow/tabbedbrowser.py +++ b/qutebrowser/mainwindow/tabbedbrowser.py @@ -673,7 +673,6 @@ class TabbedBrowser(tabwidget.TabWidget): if key in self._global_marks: point, url = self._global_marks[key] - @pyqtSlot(bool) def callback(ok): if ok: self.cur_load_finished.disconnect(callback) diff --git a/qutebrowser/utils/message.py b/qutebrowser/utils/message.py index 2a17b9cc6..5cafbb024 100644 --- a/qutebrowser/utils/message.py +++ b/qutebrowser/utils/message.py @@ -26,7 +26,7 @@ import datetime import collections import traceback -from PyQt5.QtCore import pyqtSignal, pyqtSlot, QObject +from PyQt5.QtCore import pyqtSignal, QObject from PyQt5.QtWidgets import QApplication from qutebrowser.utils import usertypes, log, objreg, utils @@ -108,7 +108,6 @@ def _get_bridge(win_id): return objreg.get('message-bridge', scope='window', window=win_id) -@pyqtSlot() def on_focus_changed(): """Show queued messages when a new window has been focused. diff --git a/tests/unit/misc/test_msgbox.py b/tests/unit/misc/test_msgbox.py index b84956d75..311680266 100644 --- a/tests/unit/misc/test_msgbox.py +++ b/tests/unit/misc/test_msgbox.py @@ -24,7 +24,7 @@ import pytest from qutebrowser.misc import msgbox -from PyQt5.QtCore import pyqtSlot, Qt +from PyQt5.QtCore import Qt from PyQt5.QtWidgets import QMessageBox, QWidget @@ -64,7 +64,6 @@ def test_finished_signal(qtbot): """Make sure we can pass a slot to be called when the dialog finished.""" signal_triggered = False - @pyqtSlot() def on_finished(): nonlocal signal_triggered signal_triggered = True diff --git a/tests/unit/utils/test_error.py b/tests/unit/utils/test_error.py index d3f437b10..b29416173 100644 --- a/tests/unit/utils/test_error.py +++ b/tests/unit/utils/test_error.py @@ -26,7 +26,7 @@ import pytest from qutebrowser.utils import error from qutebrowser.misc import ipc -from PyQt5.QtCore import pyqtSlot, QTimer +from PyQt5.QtCore import QTimer from PyQt5.QtWidgets import QMessageBox @@ -81,7 +81,6 @@ def test_no_err_windows(caplog, exc, name, exc_text, fake_args): ], ids=repr) def test_err_windows(qtbot, qapp, fake_args, pre_text, post_text, expected): - @pyqtSlot() def err_window_check(): w = qapp.activeModalWidget() try: