Coverage for qutebrowser/utils/debug.py : 100%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2014-2018 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 <http://www.gnu.org/licenses/>.
"""Class decorator to log Qt events."""
def new_event(self, e, *args, **kwargs): """Wrapper for event() which logs events.""" qenum_key(QEvent, e.type())))
"""Log all signals of an object or class.
Can be used as class decorator. """ """Slot connected to a signal to log it.""" except RuntimeError: # pragma: no cover r = '<deleted>'
"""Helper function to connect all signals to a logging slot.""" log_slot, obj, signal)) except TypeError: # pragma: no cover pass
def new_init(self, *args, **kwargs): """Wrapper for __init__() which logs signals."""
else:
"""Convert a Qt Enum value to its key as a string.
Args: base: The object the enum is in, e.g. QFrame. value: The value to get. add_base: Whether the base should be added to the printed name. klass: The enum class the value belongs to. If None, the class will be auto-guessed.
Return: The key associated with the value as a string if it could be found. The original value as a string if not. """
else:
else:
"""Convert a Qt QFlags value to its keys as string.
Note: Passing a combined value (such as Qt.AlignCenter) will get the names for the individual bits (e.g. Qt.AlignVCenter | Qt.AlignHCenter). FIXME
https://github.com/qutebrowser/qutebrowser/issues/42
Args: base: The object the flags are in, e.g. QtCore.Qt value: The value to get. add_base: Whether the base should be added to the printed names. klass: The flags class the value belongs to. If None, the class will be auto-guessed.
Return: The keys associated with the flags as a '|' separated string if they could be found. Hex values as a string if not. """ # We have to store klass here because it will be lost when iterating # over the bits.
# We have to re-convert to an enum type here or we'll sometimes get an # empty string back.
"""Get a cleaned up name of a signal.
Args: sig: The pyqtSignal
Return: The cleaned up signal name. """
"""Format a list of arguments/kwargs to a function-call like string.""" else:
"""Get a string representation of a signal for debugging.
Args: sig: A pyqtSignal. args: The arguments as list of strings.
Return: A human-readable string representation of signal/args. """
"""Get a string representation of a function calls with the given args.
Args: func: The callable to print. args: A list of positional arguments. kwargs: A dict of named arguments. full: Whether to print the full name
Return: A string with the function call. """ else:
"""Log the time an operation takes.
Usable as context manager or as decorator. """
"""Constructor.
Args: logger: The logging.Logger to use for logging, or a logger name. action: A description of what's being done. """ else:
self._action.capitalize(), delta))
def wrapped(*args, **kwargs): """Call the original function."""
"""Get a string list of all widgets."""
"""Recursive method for get_all_objects to get Qt objects."""
"""Get all children of an object recursively as a string.""" len(widget_lines)))
|