[PyQt] QWebHistory load/save

Phil Thompson phil at riverbankcomputing.com
Mon Mar 15 18:09:13 GMT 2010


On Mon, 15 Mar 2010 12:57:27 -0500, David Bronke <whitelynx at gmail.com>
wrote:
> Well, according to the Qt docs, the << and >> operators for QWebHistory
> were
> added in Qt 4.6, which would explain why it's just giving you
> NotImplemented
> under Qt 4.5.3... I'm not seeing that output here, though, and I'm still
> getting a zero-length file. (with your test script as well)


Which is what you would expect - you don't have an event loop running.

Phil

> On Mon, Mar 15, 2010 at 12:39, Russell Valentine
> <russ at coldstonelabs.org>wrote:
> 
>> Looks like your on to something unless I did something wrong as well. I
>> wrote a little simple case.  Using .__lshift__ instead of "<<" just made
>> it
>> not have an exception but it shows as "NotImplemented" in the console.
>>
>> Qt: 4.5.3
>> PyQt4: 4.7
>> Python: 2.6.4
>> =================
>>
>> from PyQt4 import QtCore, QtGui, QtWebKit
>> import sys
>>
>> app = QtGui.QApplication(sys.argv)
>>
>> f=QtCore.QFile("history.file")
>> d=QtCore.QDataStream(f)
>> page=QtWebKit.QWebPage()
>> page.mainFrame().load(QtCore.QUrl("http://python.org"))
>>
>> d.__lshift__(page.history())
>>
>>
>>
>>
>> David Bronke wrote:
>>
>>> 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?
>>>
>>
>>


More information about the PyQt mailing list