Coverage for qutebrowser/utils/usertypes.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/>.
Module attributes: _UNSET: Used as default argument in the constructor so default can be None. """
"""A list of items which saves its current position.
Class attributes: Modes: Different modes, see constructor documentation.
Attributes: fuzzyval: The value which is currently set but not in the list. _idx: The current position in the list. _items: A list of all items, accessed through item property. _mode: The current mode. """
"""Constructor.
Args: items: The list of items to iterate in. _default: The initially selected value. _mode: Behavior when the first/last item is reached. Modes.edge: Go to the first/last item Modes.exception: Raise an IndexError. """ else: else:
def __repr__(self): return utils.get_repr(self, items=self._items, mode=self._mode, idx=self._idx, fuzzyval=self.fuzzyval)
"""Set the current item to the closest item to self.fuzzyval.
Args: offset: negative to get the next smaller item, positive for the next bigger one.
Return: True if the value snapped in (changed), False when the value already was in the list. """ if op(e, self.fuzzyval)] else: enumerate(self.items)), key=lambda e: e[1])
"""Logic for getitem to get the item at offset.
Args: offset: The offset of the current item, relative to the last one.
Return: The new item. """ else: else: else:
def items(self): """Getter for items, which should not be set."""
"""Get the item with a relative position.
Args: offset: The offset of the current item, relative to the last one.
Return: The new item. """ len(self._items), self._idx, offset)) # Value has been set to something not in the list, so we snap in to # the closest value in the right direction and count this as one # step towards offset.
"""Get the current item in the list.""" else:
"""Get the next item in the list."""
"""Get the previous item in the list."""
"""Get the first item in the list."""
"""Get the last item in the list."""
"""Reset the position to the default.""" else:
# The mode of a Question. 'download'])
# Where to open a clicked link. 'hover'])
# Key input modes 'insert', 'passthrough', 'caret', 'set_mark', 'jump_mark', 'record_macro', 'run_macro'])
# Exit statuses for errors. Needs to be an int for sys.exit. 'err_init', 'err_config', 'err_key_config'], start=0)
# Load status of a tab 'error', 'warn', 'loading'])
# Backend of a tab
# JS world for QtWebEngine
# Log level of a JS message. This needs to match up with the keys allowed for # the content.javascript.log setting.
"""A question asked to the user, e.g. via the status bar.
Note the creator is responsible for cleaning up the question after it doesn't need it anymore, e.g. via connecting Question.completed to Question.deleteLater.
Attributes: mode: A PromptMode enum member. yesno: A question which can be answered with yes/no. text: A question which requires a free text answer. user_pwd: A question for a username and password. default: The default value. For yesno, None (no default), True or False. For text, a default text as string. For user_pwd, a default username as string. title: The question title to show. text: The prompt text to display to the user. url: Any URL referenced in prompts. answer: The value the user entered (as password for user_pwd). is_aborted: Whether the question was aborted. interrupted: Whether the question was interrupted by another one.
Signals: answered: Emitted when the question has been answered by the user. arg: The answer to the question. cancelled: Emitted when the question has been cancelled by the user. aborted: Emitted when the question was aborted programmatically. In this case, cancelled is not emitted. answered_yes: Convenience signal emitted when a yesno question was answered with yes. answered_no: Convenience signal emitted when a yesno question was answered with no. completed: Emitted when the question was completed in any way. """
def __repr__(self): return utils.get_repr(self, title=self.title, text=self.text, mode=self._mode, default=self.default)
def mode(self): """Getter for mode so we can define a setter."""
def mode(self, val): """Setter for mode to do basic type checking."""
def done(self): """Must be called when the question was answered completely.""" else:
def cancel(self): """Cancel the question (resulting from user-input)."""
def abort(self): """Abort the question."""
"""A timer which has a name to show in __repr__ and checks for overflows.
Attributes: _name: The name of the timer. """
else:
def __repr__(self): return utils.get_repr(self, name=self._name)
"""Extend setInterval to check for overflows."""
"""Extend start to check for overflows.""" else:
"""A wrapper over an SSL/certificate error."""
raise NotImplementedError
def __repr__(self): raise NotImplementedError
raise NotImplementedError |