Coverage for qutebrowser/browser/webkit/tabhistory.py : 52%

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 2015-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/>.
# {'currentItemIndex': 0, # 'history': [{'children': [], # 'documentSequenceNumber': 1485030525573123, # 'documentState': [], # 'formContentType': '', # 'itemSequenceNumber': 1485030525573122, # 'originalURLString': 'about:blank', # 'pageScaleFactor': 0.0, # 'referrer': '', # 'scrollPosition': {'x': 0, 'y': 0}, # 'target': '', # 'title': '', # 'urlString': 'about:blank'}]} data = {'currentItemIndex': current_idx, 'history': []} for item in items: data['history'].append(_serialize_item(item))
stream.writeInt(3) # history stream version stream.writeQVariantMap(data)
data = { 'originalURLString': item.original_url.toString(QUrl.FullyEncoded), 'scrollPosition': {'x': 0, 'y': 0}, 'title': item.title, 'urlString': item.url.toString(QUrl.FullyEncoded), } try: data['scrollPosition']['x'] = item.user_data['scroll-pos'].x() data['scrollPosition']['y'] = item.user_data['scroll-pos'].y() except (KeyError, TypeError): pass return data
"""Serialize a list of QWebHistoryItems to a data stream.
Args: items: An iterable of WebHistoryItems.
Return: A (stream, data, user_data) tuple. stream: The reset QDataStream. data: The QByteArray with the raw data. user_data: A list with each item's user data.
Warning: If 'data' goes out of scope, reading from 'stream' will result in a segfault! """
"found!".format(current_idx, i)) else:
else: current_idx = 0
_serialize_items(items, current_idx, stream)
user_data += [item.user_data for item in items]
stream.device().reset() qtutils.check_qdatastream(stream) return stream, data, user_data |