Sorry, I spoke to soon. Using out.__lshift__(view.page().history()) yeilds a zero-length file. Attached is another somewhat minimal test case; it loads google, wikipedia, and CNN one after the other, and when CNN is loaded, it saves the web view's history to a file and checks the file's length. On my machine, this invariably comes out to 0 bytes.<div>
<br></div><div>Qt version: 4.6.1</div>
<div>PyQt4 version: 4.7.1-snapshot-20100120 (I couldn't get anything but the snapshot to install correctly)</div><div>Python version: 2.6.4</div><div>OS: Arch Linux</div><div><br></div><div>Should I update to the latest snapshot and see if that fixes anything?</div>
<div><br></div><div><br></div><div><br><div class="gmail_quote">On Mon, Mar 15, 2010 at 10:42, David Bronke <span dir="ltr"><<a href="mailto:whitelynx@gmail.com">whitelynx@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
That works great, thanks!<div><div></div><div class="h5"><br><br><div class="gmail_quote">On Mon, Mar 15, 2010 at 00:45, Russell Valentine <span dir="ltr"><<a href="mailto:russ@coldstonelabs.org" target="_blank">russ@coldstonelabs.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
out.__lshift__(view.page().history())<br>
<br>
David Bronke wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>
In the QWebHistory documentation (both on the main Qt site and at<br>
<a href="http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qwebhistory.html" target="_blank">http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qwebhistory.html</a>)<br>
the method for loading and saving history for a QWebPage is described as:<br>
<br></div>
QWebHistory's state can be saved to a QDataStream <qdatastream.html> using<div><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
the >> operator and loaded by using the << operator.<br>
</blockquote>
<br>
<br>
However, in Python, this doesn't work; these operators don't even seem to be<br>
defined, according to the PyQt4 docs. I've tried the following variations on<br>
the suggested method:<br>
<br>
<br>
# Try a QDataStream<br>
out = QtCore.QDataStream(file)<br>
out << view.page().history()<br>
<br>
# Try a file-like object<br>
sys.stdout << view.page().history()<br>
<br>
# Try a file-like object with .write()<br>
sys.stdout.write(view.page().history())<br>
<br>
<br>
<br>
Each of these failed with a TypeError. I've attached a sample program which<br>
demonstrates the various methods above.<br>
<br>
<br>
The reason I'm trying to access this functionality is because I'm writing a<br>
PyQt4-based web browser, and I need to be able to save and load history for<br>
each tab, to implement session saving. Is there any other way to achieve<br>
this, or would it be able to add this functionality to the next PyQt<br>
release?<br>
<br>
<br>
Thanks,<br>
<br>
David H. Bronke<br></div>
Developer [kgb <<a href="http://kgb.com/" target="_blank">http://kgb.com/</a>>]<br>
Vice President of Project Development [GNE Solutions<<a href="http://gnesolutions.com/" target="_blank">http://gnesolutions.com/</a>><br>
| Skewed Aspect <<a href="http://skewedaspect.com/" target="_blank">http://skewedaspect.com/</a>>]<div><br>
<a href="http://people.g33xnexus.com/whitelynx/" target="_blank">http://people.g33xnexus.com/whitelynx/</a><br>
<br></div>
v4sw7+8Yhw5/7ln4/6pr7Ock3ma7u7/8Lw3/7Xm3/5l7GUi2e4/6t2/4MGBSb7HODune/en6g8+9OZARa25s7/8MIr2+7p-3.5/-4.21<<a href="http://hackerkey.com" target="_blank">http://hackerkey.com</a>><div><br>
Support Web Standards! <a href="http://www.webstandards.org/" target="_blank">http://www.webstandards.org/</a><br>
<br>
<br>
<br></div>
------------------------------------------------------------------------<br>
<br>
_______________________________________________<br>
PyQt mailing list <a href="mailto:PyQt@riverbankcomputing.com" target="_blank">PyQt@riverbankcomputing.com</a><br>
<a href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt" target="_blank">http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a><br>
</blockquote>
<br>
</blockquote></div><br>
</div></div></blockquote></div><br></div>