--- a/Helpviewer/OpenSearch/OpenSearchEngine.py Tue Oct 15 22:03:54 2013 +0200 +++ b/Helpviewer/OpenSearch/OpenSearchEngine.py Fri Oct 18 23:00:41 2013 +0200 @@ -12,8 +12,8 @@ import re import json -from PyQt4.QtCore import pyqtSignal, pyqtSlot, QLocale, QUrl, QByteArray, QBuffer, \ - QIODevice, QObject +from PyQt4.QtCore import pyqtSignal, pyqtSlot, QLocale, QUrl, QByteArray, \ + QBuffer, QIODevice, QObject from PyQt4.QtGui import QImage from PyQt4.QtNetwork import QNetworkRequest, QNetworkAccessManager @@ -83,8 +83,9 @@ result = result.replace("{country}", country) result = result.replace("{inputEncoding}", "UTF-8") result = result.replace("{outputEncoding}", "UTF-8") - result = result.replace("{searchTerms}", - bytes(QUrl.toPercentEncoding(searchTerm)).decode()) + result = result.replace( + "{searchTerms}", + bytes(QUrl.toPercentEncoding(searchTerm)).decode()) result = re.sub(r"""\{([^\}]*:|)source\??\}""", Program, result) return result @@ -148,7 +149,8 @@ if not self._searchUrlTemplate: return QUrl() - ret = QUrl.fromEncoded(self.parseTemplate(searchTerm, self._searchUrlTemplate)) + ret = QUrl.fromEncoded( + self.parseTemplate(searchTerm, self._searchUrlTemplate)) if self.__searchMethod != "post": for parameter in self._searchParameters: @@ -214,7 +216,8 @@ """ Public method to set the engine search parameters. - @param searchParameters search parameters of the engine (list of two tuples) + @param searchParameters search parameters of the engine + (list of two tuples) """ self._searchParameters = searchParameters[:] @@ -237,7 +240,8 @@ def searchMethod(self): """ - Public method to get the HTTP request method used to perform search requests. + Public method to get the HTTP request method used to perform search + requests. @return HTTP request method (string) """ @@ -245,7 +249,8 @@ def setSearchMethod(self, method): """ - Public method to set the HTTP request method used to perform search requests. + Public method to set the HTTP request method used to perform search + requests. @param method HTTP request method (string) """ @@ -257,7 +262,8 @@ def suggestionsMethod(self): """ - Public method to get the HTTP request method used to perform suggestions requests. + Public method to get the HTTP request method used to perform + suggestions requests. @return HTTP request method (string) """ @@ -265,7 +271,8 @@ def setSuggestionsMethod(self, method): """ - Public method to set the HTTP request method used to perform suggestions requests. + Public method to set the HTTP request method used to perform + suggestions requests. @param method HTTP request method (string) """ @@ -287,7 +294,7 @@ """ Public method to set the engine image URL. - @param description image URL of the engine (string) + @param imageUrl image URL of the engine (string) """ self._imageUrl = imageUrl @@ -295,7 +302,7 @@ """ Public method to set the engine image URL. - @param description image URL of the engine (string) + @param imageUrl image URL of the engine (string) """ self.setImageUrl(imageUrl) self.__iconMoved = False @@ -359,8 +366,8 @@ imageBuffer = QBuffer() imageBuffer.open(QIODevice.ReadWrite) if image.save(imageBuffer, "PNG"): - self._imageUrl = "data:image/png;base64,{0}"\ - .format(bytes(imageBuffer.buffer().toBase64()).decode()) + self._imageUrl = "data:image/png;base64,{0}".format( + bytes(imageBuffer.buffer().toBase64()).decode()) self.__image = QImage(image) self.imageChanged.emit() @@ -416,7 +423,6 @@ return if self.__suggestionsReply is not None: -## self.__suggestionsReply.finished[()].disconnect(self.__suggestionsObtained) self.__suggestionsReply.abort() self.__suggestionsReply.deleteLater() self.__suggestionsReply = None @@ -435,7 +441,8 @@ data = "&".join(parameters) self.__suggestionsReply = self.networkAccessManager().post( QNetworkRequest(self.suggestionsUrl(searchTerm)), data) - self.__suggestionsReply.finished[()].connect(self.__suggestionsObtained) + self.__suggestionsReply.finished[()].connect( + self.__suggestionsObtained) def __suggestionsObtained(self): """ @@ -467,7 +474,8 @@ """ Public method to get a reference to the network access manager object. - @return reference to the network access manager object (QNetworkAccessManager) + @return reference to the network access manager object + (QNetworkAccessManager) """ return self.__networkAccessManager