Helpviewer/AdBlock/AdBlockBlockedNetworkReply.py

changeset 3000
971d84f7a6d6
parent 2302
f29e9405c851
child 3035
36e9f388958b
child 3057
10516539f238
equal deleted inserted replaced
2999:28c75409a78f 3000:971d84f7a6d6
18 def __init__(self, request, subscription, rule, parent=None): 18 def __init__(self, request, subscription, rule, parent=None):
19 """ 19 """
20 Constructor 20 Constructor
21 21
22 @param request reference to the request object (QNetworkRequest) 22 @param request reference to the request object (QNetworkRequest)
23 @param subscription subscription containing the matched rule (AdBlockSubscription) 23 @param subscription subscription containing the matched rule
24 (AdBlockSubscription)
24 @param rule matching rule (AdBlockRule) 25 @param rule matching rule (AdBlockRule)
25 @param parent reference to the parent object (QObject) 26 @param parent reference to the parent object (QObject)
26 """ 27 """
27 super().__init__(parent) 28 super().__init__(parent)
28 self.setOperation(QNetworkAccessManager.GetOperation) 29 self.setOperation(QNetworkAccessManager.GetOperation)
29 self.setRequest(request) 30 self.setRequest(request)
30 self.setUrl(request.url()) 31 self.setUrl(request.url())
31 self.setError(QNetworkReply.ContentAccessDenied, 32 self.setError(
32 "AdBlockRule:{0} ({1})".format(subscription.title(), rule.filter())) 33 QNetworkReply.ContentAccessDenied,
34 "AdBlockRule:{0} ({1})"
35 .format(subscription.title(), rule.filter()))
33 QTimer.singleShot(0, self.__fireSignals) 36 QTimer.singleShot(0, self.__fireSignals)
34 37
35 def __fireSignals(self): 38 def __fireSignals(self):
36 """ 39 """
37 Private method to send some signals to end the connection. 40 Private method to send some signals to end the connection.
38 """ 41 """
39 self.error[QNetworkReply.NetworkError].emit(QNetworkReply.ContentAccessDenied) 42 self.error[QNetworkReply.NetworkError].emit(
43 QNetworkReply.ContentAccessDenied)
40 self.finished.emit() 44 self.finished.emit()
41 45
42 def readData(self, maxlen): 46 def readData(self, maxlen):
43 """ 47 """
44 Protected method to retrieve data from the reply object. 48 Protected method to retrieve data from the reply object.

eric ide

mercurial