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.
Qt version: 4.6.1 PyQt4 version: 4.7.1-snapshot-20100120 (I couldn't get anything but the snapshot to install correctly) Python version: 2.6.4 OS: Arch Linux Should I update to the latest snapshot and see if that fixes anything? On Mon, Mar 15, 2010 at 10:42, David Bronke <[email protected]> wrote: > That works great, thanks! > > > On Mon, Mar 15, 2010 at 00:45, Russell Valentine > <[email protected]>wrote: > >> out.__lshift__(view.page().history()) >> >> David Bronke 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? >>> >>> >>> Thanks, >>> >>> David H. Bronke >>> Developer [kgb <http://kgb.com/>] >>> Vice President of Project Development [GNE Solutions< >>> http://gnesolutions.com/> >>> | Skewed Aspect <http://skewedaspect.com/>] >>> >>> http://people.g33xnexus.com/whitelynx/ >>> >>> >>> v4sw7+8Yhw5/7ln4/6pr7Ock3ma7u7/8Lw3/7Xm3/5l7GUi2e4/6t2/4MGBSb7HODune/en6g8+9OZARa25s7/8MIr2+7p-3.5/-4.21< >>> http://hackerkey.com> >>> >>> Support Web Standards! http://www.webstandards.org/ >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> PyQt mailing list [email protected] >>> http://www.riverbankcomputing.com/mailman/listinfo/pyqt >>> >> >> >
qwebhistory-problem-2.py
Description: Binary data
_______________________________________________ PyQt mailing list [email protected] http://www.riverbankcomputing.com/mailman/listinfo/pyqt
