[PyQt] QWebHistory load/save

David Bronke whitelynx at gmail.com
Mon Mar 15 19:49:20 GMT 2010


I updated PyQt from 4.7.1-snapshot-20100120 to snapshot-4.7.1-02f7e71246f9,
and that seemed to fix the issue. Now, I get what looks like a valid history
file. (254 bytes from my modified version of Russel's code)

On Mon, Mar 15, 2010 at 13:54, David Bronke <whitelynx at gmail.com> wrote:

> I had already done those 2 changes in my version of his script; I've
> attached my modified version. With this version, I still get a zero-length
> file.
>
>
>
> On Mon, Mar 15, 2010 at 13:48, Phil Thompson <phil at riverbankcomputing.com>wrote:
>
>> On Mon, 15 Mar 2010 13:24:21 -0500, Russell Valentine
>> <russ at coldstonelabs.org> wrote:
>> > Yes, my fault. How about this one:
>> > It will be a while before I can try it. In the process up upgrading to
>> > Qt4.6
>> > ===========
>> >
>> > from PyQt4 import QtCore, QtGui, QtWebKit
>> > import sys
>> >
>> >
>> > class MainWindow(QtGui.QMainWindow):
>> >      def __init__(self):
>> >          super(QtGui.QMainWindow, self).__init__()
>> >          self.webview=QtWebKit.QWebView()
>> >          self.setCentralWidget(self.webview)
>> >      def go(self):
>> >          self.webview.load(QtCore.QUrl("http://python.org"))
>> >          f=QtCore.QFile("history.file")
>>
>>            f.open(QtCore.QIODevice.WriteOnly)
>>
>> >          d=QtCore.QDataStream(f)
>> >          d << (self.webview.history())
>> >
>> >
>> >
>> > if __name__ == "__main__":
>> >      app = QtGui.QApplication(sys.argv)
>> >      window = MainWindow()
>> >      window.show()
>> >      QtCore.QTimer.singleShot(1000, window.go)
>> >      sys.exit(app.exec_())
>>
>> With this I get a 12 byte file - not an empty file.
>>
>> The history isn't updated until the load is finished. If you connect the
>> loadFinished() signal to a slot that writes the history I get a 254 byte
>> file.
>>
>> Phil
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20100315/854611c0/attachment.html>


More information about the PyQt mailing list