Don't log scrolling
This commit is contained in:
parent
46d621629f
commit
e95ef9ab4a
@ -23,7 +23,7 @@ from functools import partial
|
|||||||
|
|
||||||
from PyQt5.QtCore import QObject
|
from PyQt5.QtCore import QObject
|
||||||
|
|
||||||
from qutebrowser.utils.debug import dbg_signal
|
from qutebrowser.utils.debug import dbg_signal, signal_name
|
||||||
from qutebrowser.widgets.webview import WebView
|
from qutebrowser.widgets.webview import WebView
|
||||||
from qutebrowser.utils.log import signals as logger
|
from qutebrowser.utils.log import signals as logger
|
||||||
|
|
||||||
@ -37,8 +37,13 @@ class SignalFilter(QObject):
|
|||||||
|
|
||||||
Attributes:
|
Attributes:
|
||||||
_tabs: The QTabWidget associated with this SignalFilter.
|
_tabs: The QTabWidget associated with this SignalFilter.
|
||||||
|
|
||||||
|
Class attributes:
|
||||||
|
BLACKLIST: List of signal names which should not be logged.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
BLACKLIST = ['cur_scroll_perc_changed', 'cur_progress']
|
||||||
|
|
||||||
def __init__(self, tabs):
|
def __init__(self, tabs):
|
||||||
super().__init__(tabs)
|
super().__init__(tabs)
|
||||||
self._tabs = tabs
|
self._tabs = tabs
|
||||||
@ -71,7 +76,7 @@ class SignalFilter(QObject):
|
|||||||
The target signal if the sender was the current widget.
|
The target signal if the sender was the current widget.
|
||||||
"""
|
"""
|
||||||
sender = self.sender()
|
sender = self.sender()
|
||||||
log_signal = not signal.signal.startswith('2cur_progress')
|
log_signal = signal_name(signal) not in self.BLACKLIST
|
||||||
if not isinstance(sender, WebView):
|
if not isinstance(sender, WebView):
|
||||||
# BUG? This should never happen, but it does regularely...
|
# BUG? This should never happen, but it does regularely...
|
||||||
logger.warning("Got signal {} by {} which is no tab!".format(
|
logger.warning("Got signal {} by {} which is no tab!".format(
|
||||||
|
@ -479,7 +479,6 @@ class WebView(QWebView):
|
|||||||
frame.scrollBarValue(Qt.Vertical))
|
frame.scrollBarValue(Qt.Vertical))
|
||||||
if self._old_scroll_pos != new_pos:
|
if self._old_scroll_pos != new_pos:
|
||||||
self._old_scroll_pos = new_pos
|
self._old_scroll_pos = new_pos
|
||||||
log.webview.debug("Updating scroll position")
|
|
||||||
m = (frame.scrollBarMaximum(Qt.Horizontal),
|
m = (frame.scrollBarMaximum(Qt.Horizontal),
|
||||||
frame.scrollBarMaximum(Qt.Vertical))
|
frame.scrollBarMaximum(Qt.Vertical))
|
||||||
perc = (round(100 * new_pos[0] / m[0]) if m[0] != 0 else 0,
|
perc = (round(100 * new_pos[0] / m[0]) if m[0] != 0 else 0,
|
||||||
|
Loading…
Reference in New Issue
Block a user