def setupTabs(self): """configure generic settings of the firmware/downloads tabs""" # setup Main window self.statusBar().hide() self.progressLabel.setText("") self.progressBar.reset() self.descriptionText.setOpenExternalLinks(True) # cache for images/http descriptions self.cache_loc = tempfile.mkdtemp() self.cache = urlcache.build_opener(self.cache_loc) self.descriptionText.setResourceCache(self.cache) # cache for firmware downloads self.firmcache = FirmCache(self.set_progress, self.reset_progress) # DEBUG: tmp self.firmcache.clear()
ret = QVariant( QByteArray( file.read() ) ) except Exception, inst: print "loadResource: exception:", inst return ret else: print "loadResource: loading DEFAULT RESOURCE:", url ret = QTextBrowser.loadResource(self, type, name) return ret if __name__=="__main__": from sys import argv app=QApplication(argv) cacheloc = "../../cache/" cache = urlcache.build_opener(cacheloc) w = PTextBrowser(cache) w.show() html = "http://192.168.1.101/~jaremy/bopunk/firms/cool/firm1.html/index.html" # html = "file:///Users/jaremy/Sites/index.html" url = QUrl(html) print "url", url w.setSource(url) app.connect(app, SIGNAL("lastWindowClosed()") , app, SLOT("quit()")) app.exec_()