Coverage for qutebrowser/completion/models/completionmodel.py : 97%

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 2017-2018 Ryan Roden-Corrent (rcorre) <ryan@rcorre.net> # # 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/>.
"""A model that proxies access to one or more completion categories.
Top level indices represent categories. Child indices represent rows of those tables.
Attributes: column_widths: The width percentages of the columns used in the completion view. _categories: The sub-categories. """
"""Return the category pointed to by the given index.
Args: idx: A QModelIndex Returns: A category if the index points at one, else None """ # items hold an index to the parent category in their internalPointer # categories have an empty internalPointer
"""Add a completion category to the model."""
"""Return the item data for index.
Override QAbstractItemModel::data.
Args: index: The QModelIndex to get item flags for.
Return: The item data, or None on an invalid index. """ # category header # item
"""Return the item flags for index.
Override QAbstractItemModel::flags.
Return: The item flags, or Qt.NoItemFlags on error. """ # item Qt.ItemNeverHasChildren) else: # category
"""Get an index into the model.
Override QAbstractItemModel::index.
Return: A QModelIndex. """ col < 0 or col >= self.columnCount(parent)): return QModelIndex() # store a pointer to the parent category in internalPointer
"""Get an index to the parent of the given index.
Override QAbstractItemModel::parent.
Args: index: The QModelIndex to get the parent index for. """ # categories have no parent
"""Override QAbstractItemModel::rowCount.""" # top-level # item or nonzero category column (only first col has children) else: # category
"""Override QAbstractItemModel::columnCount.""" # pylint: disable=unused-argument
"""Override to forward the call to the categories."""
"""Override to forward the call to the categories."""
"""Return the count of non-category items."""
"""Set the filter pattern for all categories.
Args: pattern: The filter pattern to set. """ # WORKAROUND: # layoutChanged is broken in PyQt 5.7.1, so we must use metaObject # https://www.riverbankcomputing.com/pipermail/pyqt/2017-January/038483.html
"""Return the index of the first child (non-category) in the model."""
"""Return the index of the last child (non-category) in the model."""
"""Return the column indices the filter pattern applies to.
Args: index: index of the item to check.
Return: A list of integers. """ cat = self._cat_from_idx(index.parent()) return cat.columns_to_filter if cat else []
"""Delete the row at the given index."""
for i in range(cat.columnCount())]
|