Mon, 28 Dec 2009 16:03:33 +0000
Started porting eric4 to Python3
# -*- coding: utf-8 -*- # Copyright (c) 2009 Detlev Offenbach <detlev@die-offenbachs.de> # """ Module implementing a scheme access handler for QtHelp. """ from SchemeAccessHandler import SchemeAccessHandler from NetworkReply import NetworkReply class QtHelpAccessHandler(SchemeAccessHandler): """ Class implementing a scheme access handler for QtHelp. """ def __init__(self, engine, parent = None): """ Constructor @param engine reference to the help engine (QHelpEngine) @param parent reference to the parent object (QObject) """ SchemeAccessHandler.__init__(self, parent) self.__engine = engine def createRequest(self, op, request, outgoingData = None): """ Protected method to create a request. @param op the operation to be performed (QNetworkAccessManager.Operation) @param request reference to the request object (QNetworkRequest) @param outgoingData reference to an IODevice containing data to be sent (QIODevice) @return reference to the created reply object (QNetworkReply) """ url = request.url() strUrl = url.toString() if strUrl.endswith(".svg") or strUrl.endswith(".svgz"): mimeType = "image/svg+xml" elif strUrl.endswith(".css"): mimeType = "text/css" elif strUrl.endswith(".js"): mimeType = "text/javascript" else: mimeType = "text/html" return NetworkReply(request, self.__engine.fileData(url), mimeType)