[PyQt] QWebHistory load/save

Phil Thompson phil at riverbankcomputing.com
Mon Mar 15 08:45:09 GMT 2010


On Sun, 14 Mar 2010 22:29:29 -0500, David Bronke <whitelynx at gmail.com>
wrote:
> In the QWebHistory documentation (both on the main Qt site and at
>
http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qwebhistory.html)
> the method for loading and saving history for a QWebPage is described as:
> 
> QWebHistory's state can be saved to a QDataStream <qdatastream.html>
using
>> the >> operator and loaded by using the << operator.
> 
> 
> However, in Python, this doesn't work; these operators don't even seem to
> be
> defined, according to the PyQt4 docs. I've tried the following variations
> on
> the suggested method:
> 
> 
> # Try a QDataStream
> out = QtCore.QDataStream(file)
> out << view.page().history()
> 
> # Try a file-like object
> sys.stdout << view.page().history()
> 
> # Try a file-like object with .write()
> sys.stdout.write(view.page().history())
> 
> 
> 
> Each of these failed with a TypeError. I've attached a sample program
which
> demonstrates the various methods above.
> 
> 
> The reason I'm trying to access this functionality is because I'm writing
a
> PyQt4-based web browser, and I need to be able to save and load history
for
> each tab, to implement session saving. Is there any other way to achieve
> this, or would it be able to add this functionality to the next PyQt
> release?

Works fine for me.

Phil


More information about the PyQt mailing list