Fix lint
This commit is contained in:
parent
e32bbfa8f7
commit
7e30792bfe
@ -259,8 +259,8 @@ class HostBlocker:
|
|||||||
self._blocked_hosts.add(host)
|
self._blocked_hosts.add(host)
|
||||||
log.misc.debug("{}: read {} lines".format(byte_io.name, line_count))
|
log.misc.debug("{}: read {} lines".format(byte_io.name, line_count))
|
||||||
if error_count > 0:
|
if error_count > 0:
|
||||||
message.error("adblock: {} read errors for {}".format(error_count,
|
message.error("adblock: {} read errors for {}".format(
|
||||||
byte_io.name))
|
error_count, byte_io.name))
|
||||||
|
|
||||||
def on_lists_downloaded(self):
|
def on_lists_downloaded(self):
|
||||||
"""Install block lists after files have been downloaded."""
|
"""Install block lists after files have been downloaded."""
|
||||||
|
@ -69,6 +69,8 @@ class Message(QLabel):
|
|||||||
|
|
||||||
class MessageView(QWidget):
|
class MessageView(QWidget):
|
||||||
|
|
||||||
|
"""Widget which stacks error/warning/info messages."""
|
||||||
|
|
||||||
reposition = pyqtSignal()
|
reposition = pyqtSignal()
|
||||||
|
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
@ -87,13 +89,16 @@ class MessageView(QWidget):
|
|||||||
|
|
||||||
@config.change_filter('ui', 'message-timeout')
|
@config.change_filter('ui', 'message-timeout')
|
||||||
def _set_clear_timer_interval(self):
|
def _set_clear_timer_interval(self):
|
||||||
|
"""Configure self._clear_timer according to the config."""
|
||||||
self._clear_timer.setInterval(config.get('ui', 'message-timeout'))
|
self._clear_timer.setInterval(config.get('ui', 'message-timeout'))
|
||||||
|
|
||||||
def message_height(self):
|
def message_height(self):
|
||||||
|
"""Get the total height of all messages."""
|
||||||
return sum(label.sizeHint().height() for label in self._messages)
|
return sum(label.sizeHint().height() for label in self._messages)
|
||||||
|
|
||||||
@pyqtSlot()
|
@pyqtSlot()
|
||||||
def _clear_messages(self):
|
def _clear_messages(self):
|
||||||
|
"""Hide and delete all messages."""
|
||||||
for widget in self._messages:
|
for widget in self._messages:
|
||||||
self._vbox.removeWidget(widget)
|
self._vbox.removeWidget(widget)
|
||||||
widget.hide()
|
widget.hide()
|
||||||
@ -105,6 +110,7 @@ class MessageView(QWidget):
|
|||||||
|
|
||||||
@pyqtSlot(usertypes.MessageLevel, str)
|
@pyqtSlot(usertypes.MessageLevel, str)
|
||||||
def show_message(self, level, text):
|
def show_message(self, level, text):
|
||||||
|
"""Show the given message with the given MessageLevel."""
|
||||||
if text == self._last_text:
|
if text == self._last_text:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -19,10 +19,7 @@
|
|||||||
|
|
||||||
"""The main statusbar widget."""
|
"""The main statusbar widget."""
|
||||||
|
|
||||||
import collections
|
from PyQt5.QtCore import pyqtSignal, pyqtSlot, pyqtProperty, Qt, QSize, QTimer
|
||||||
|
|
||||||
from PyQt5.QtCore import (pyqtSignal, pyqtSlot, pyqtProperty, Qt, QTime, QSize,
|
|
||||||
QTimer)
|
|
||||||
from PyQt5.QtWidgets import QWidget, QHBoxLayout, QStackedLayout, QSizePolicy
|
from PyQt5.QtWidgets import QWidget, QHBoxLayout, QStackedLayout, QSizePolicy
|
||||||
|
|
||||||
from qutebrowser.config import config, style
|
from qutebrowser.config import config, style
|
||||||
|
@ -153,8 +153,8 @@ class GUIProcess(QObject):
|
|||||||
log.procs.debug("Process started.")
|
log.procs.debug("Process started.")
|
||||||
self._started = True
|
self._started = True
|
||||||
else:
|
else:
|
||||||
message.error("Error while spawning {}: {}.".format(self._what,
|
message.error("Error while spawning {}: {}.".format(
|
||||||
self._proc.error()))
|
self._what, self._proc.error()))
|
||||||
|
|
||||||
def exit_status(self):
|
def exit_status(self):
|
||||||
return self._proc.exitStatus()
|
return self._proc.exitStatus()
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
from PyQt5.QtCore import pyqtSignal, QObject
|
from PyQt5.QtCore import pyqtSignal, QObject
|
||||||
from PyQt5.QtWidgets import QApplication
|
|
||||||
|
|
||||||
from qutebrowser.utils import usertypes, log, objreg, utils
|
from qutebrowser.utils import usertypes, log, objreg, utils
|
||||||
|
|
||||||
|
@ -86,6 +86,7 @@ def whitelist_generator():
|
|||||||
yield 'qutebrowser.utils.log.QtWarningFilter.filter'
|
yield 'qutebrowser.utils.log.QtWarningFilter.filter'
|
||||||
yield 'qutebrowser.browser.pdfjs.is_available'
|
yield 'qutebrowser.browser.pdfjs.is_available'
|
||||||
yield 'QEvent.posted'
|
yield 'QEvent.posted'
|
||||||
|
yield 'log_stack' # from message.py
|
||||||
# vulture doesn't notice the hasattr() and thus thinks netrc_used is unused
|
# vulture doesn't notice the hasattr() and thus thinks netrc_used is unused
|
||||||
# in NetworkManager.on_authentication_required
|
# in NetworkManager.on_authentication_required
|
||||||
yield 'PyQt5.QtNetwork.QNetworkReply.netrc_used'
|
yield 'PyQt5.QtNetwork.QNetworkReply.netrc_used'
|
||||||
|
@ -189,7 +189,7 @@ def test_error(qtbot, proc, caplog, message_mock):
|
|||||||
def test_exit_unsuccessful(qtbot, proc, message_mock, py_proc, caplog):
|
def test_exit_unsuccessful(qtbot, proc, message_mock, py_proc, caplog):
|
||||||
with caplog.at_level(logging.ERROR):
|
with caplog.at_level(logging.ERROR):
|
||||||
with qtbot.waitSignal(proc.finished, timeout=10000):
|
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)
|
msg = message_mock.getmsg(usertypes.MessageLevel.error)
|
||||||
assert msg.text == "Testprocess exited with status 1."
|
assert msg.text == "Testprocess exited with status 1."
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
import enum
|
import enum
|
||||||
import datetime
|
|
||||||
import os.path
|
import os.path
|
||||||
import io
|
import io
|
||||||
import logging
|
import logging
|
||||||
|
Loading…
Reference in New Issue
Block a user