From b7dbf2971305236384adf4f6529bd5e5467f599e Mon Sep 17 00:00:00 2001 From: Jeena Date: Sat, 13 Sep 2014 12:33:37 +0200 Subject: [PATCH] first attempt for cache --- feedthemonkey | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/feedthemonkey b/feedthemonkey index f2c3be3..d660194 100755 --- a/feedthemonkey +++ b/feedthemonkey @@ -7,6 +7,7 @@ except: import sys, os, json, tempfile, urllib, json from PyQt4 import QtGui, QtCore, QtWebKit, QtNetwork +from PyQt4.QtNetwork import * from threading import Thread from sys import platform as _platform @@ -228,6 +229,11 @@ class Content(QtGui.QWidget): self.wb.page().setLinkDelegationPolicy(QtWebKit.QWebPage.DelegateAllLinks) self.wb.linkClicked.connect(lambda url: self.openLink(url)) + diskCache = QNetworkDiskCache() + diskCache.setCacheDirectory("/tmp/feedmonkey") + diskCache.setMaximumCacheSize(5*124*124) + self.wb.page().networkAccessManager().setCache(diskCache) + self.setLayout(QtGui.QVBoxLayout(spacing=0)) self.layout().setContentsMargins(0, 0, 0, 0) self.layout().addWidget(self.wb) @@ -561,4 +567,4 @@ if __name__ == "__main__": app = QtGui.QApplication(sys.argv) wb = MainWindow() wb.show() - sys.exit(app.exec_()) \ No newline at end of file + sys.exit(app.exec_())