diff --git a/qutebrowser/browser/adblock.py b/qutebrowser/browser/adblock.py index e7131640f..0069fe7e3 100644 --- a/qutebrowser/browser/adblock.py +++ b/qutebrowser/browser/adblock.py @@ -259,8 +259,8 @@ class HostBlocker: self._blocked_hosts.add(host) log.misc.debug("{}: read {} lines".format(byte_io.name, line_count)) if error_count > 0: - message.error("adblock: {} read errors for {}".format(error_count, - byte_io.name)) + message.error("adblock: {} read errors for {}".format( + error_count, byte_io.name)) def on_lists_downloaded(self): """Install block lists after files have been downloaded.""" diff --git a/qutebrowser/mainwindow/messageview.py b/qutebrowser/mainwindow/messageview.py index 43ad1a132..fe96af822 100644 --- a/qutebrowser/mainwindow/messageview.py +++ b/qutebrowser/mainwindow/messageview.py @@ -69,6 +69,8 @@ class Message(QLabel): class MessageView(QWidget): + """Widget which stacks error/warning/info messages.""" + reposition = pyqtSignal() def __init__(self, parent=None): @@ -87,13 +89,16 @@ class MessageView(QWidget): @config.change_filter('ui', 'message-timeout') def _set_clear_timer_interval(self): + """Configure self._clear_timer according to the config.""" self._clear_timer.setInterval(config.get('ui', 'message-timeout')) def message_height(self): + """Get the total height of all messages.""" return sum(label.sizeHint().height() for label in self._messages) @pyqtSlot() def _clear_messages(self): + """Hide and delete all messages.""" for widget in self._messages: self._vbox.removeWidget(widget) widget.hide() @@ -105,6 +110,7 @@ class MessageView(QWidget): @pyqtSlot(usertypes.MessageLevel, str) def show_message(self, level, text): + """Show the given message with the given MessageLevel.""" if text == self._last_text: return diff --git a/qutebrowser/mainwindow/statusbar/bar.py b/qutebrowser/mainwindow/statusbar/bar.py index 5e67e7d4e..1645ce583 100644 --- a/qutebrowser/mainwindow/statusbar/bar.py +++ b/qutebrowser/mainwindow/statusbar/bar.py @@ -19,10 +19,7 @@ """The main statusbar widget.""" -import collections - -from PyQt5.QtCore import (pyqtSignal, pyqtSlot, pyqtProperty, Qt, QTime, QSize, - QTimer) +from PyQt5.QtCore import pyqtSignal, pyqtSlot, pyqtProperty, Qt, QSize, QTimer from PyQt5.QtWidgets import QWidget, QHBoxLayout, QStackedLayout, QSizePolicy from qutebrowser.config import config, style diff --git a/qutebrowser/misc/guiprocess.py b/qutebrowser/misc/guiprocess.py index e8e0d579e..eb0a036e5 100644 --- a/qutebrowser/misc/guiprocess.py +++ b/qutebrowser/misc/guiprocess.py @@ -153,8 +153,8 @@ class GUIProcess(QObject): log.procs.debug("Process started.") self._started = True else: - message.error("Error while spawning {}: {}.".format(self._what, - self._proc.error())) + message.error("Error while spawning {}: {}.".format( + self._what, self._proc.error())) def exit_status(self): return self._proc.exitStatus() diff --git a/qutebrowser/utils/message.py b/qutebrowser/utils/message.py index ffa619a4a..43c820ad1 100644 --- a/qutebrowser/utils/message.py +++ b/qutebrowser/utils/message.py @@ -25,7 +25,6 @@ import traceback from PyQt5.QtCore import pyqtSignal, QObject -from PyQt5.QtWidgets import QApplication from qutebrowser.utils import usertypes, log, objreg, utils diff --git a/scripts/dev/run_vulture.py b/scripts/dev/run_vulture.py index f406aea97..3d8fa7e17 100755 --- a/scripts/dev/run_vulture.py +++ b/scripts/dev/run_vulture.py @@ -86,6 +86,7 @@ def whitelist_generator(): yield 'qutebrowser.utils.log.QtWarningFilter.filter' yield 'qutebrowser.browser.pdfjs.is_available' yield 'QEvent.posted' + yield 'log_stack' # from message.py # vulture doesn't notice the hasattr() and thus thinks netrc_used is unused # in NetworkManager.on_authentication_required yield 'PyQt5.QtNetwork.QNetworkReply.netrc_used' diff --git a/tests/unit/misc/test_guiprocess.py b/tests/unit/misc/test_guiprocess.py index 01239b198..4341284df 100644 --- a/tests/unit/misc/test_guiprocess.py +++ b/tests/unit/misc/test_guiprocess.py @@ -189,7 +189,7 @@ def test_error(qtbot, proc, caplog, message_mock): def test_exit_unsuccessful(qtbot, proc, message_mock, py_proc, caplog): with caplog.at_level(logging.ERROR): with qtbot.waitSignal(proc.finished, timeout=10000): - proc.start(*py_proc('import sys; sys.exit(1)')) + proc.start(*py_proc('import sys; sys.exit(1)')) msg = message_mock.getmsg(usertypes.MessageLevel.error) assert msg.text == "Testprocess exited with status 1." diff --git a/tests/unit/utils/test_utils.py b/tests/unit/utils/test_utils.py index 99439a583..73252ddc4 100644 --- a/tests/unit/utils/test_utils.py +++ b/tests/unit/utils/test_utils.py @@ -21,7 +21,6 @@ import sys import enum -import datetime import os.path import io import logging