2 |
2 |
3 # Copyright (c) 2009 - 2013 Detlev Offenbach <detlev@die-offenbachs.de> |
3 # Copyright (c) 2009 - 2013 Detlev Offenbach <detlev@die-offenbachs.de> |
4 # |
4 # |
5 |
5 |
6 """ |
6 """ |
7 Module implementing a QNetworkReply subclass reporting an unknown protocol error. |
7 Module implementing a QNetworkReply subclass reporting an unknown protocol |
|
8 error. |
8 """ |
9 """ |
9 |
10 |
10 from PyQt4.QtCore import QTimer |
11 from PyQt4.QtCore import QTimer |
11 from PyQt4.QtNetwork import QNetworkReply |
12 from PyQt4.QtNetwork import QNetworkReply |
12 |
13 |
13 |
14 |
14 class NetworkProtocolUnknownErrorReply(QNetworkReply): |
15 class NetworkProtocolUnknownErrorReply(QNetworkReply): |
15 """ |
16 """ |
16 Class implementing a QNetworkReply subclass reporting an unknown protocol error. |
17 Class implementing a QNetworkReply subclass reporting an unknown protocol |
|
18 error. |
17 """ |
19 """ |
18 def __init__(self, protocol, parent=None): |
20 def __init__(self, protocol, parent=None): |
19 """ |
21 """ |
20 Constructor |
22 Constructor |
21 |
23 |
22 @param protocol protocol name (string) |
24 @param protocol protocol name (string) |
23 @param parent reference to the parent object (QObject) |
25 @param parent reference to the parent object (QObject) |
24 """ |
26 """ |
25 super().__init__(parent) |
27 super().__init__(parent) |
26 self.setError(QNetworkReply.ProtocolUnknownError, |
28 self.setError( |
27 self.trUtf8("Protocol '{0}' not supported.").format(protocol)) |
29 QNetworkReply.ProtocolUnknownError, |
|
30 self.trUtf8("Protocol '{0}' not supported.").format(protocol)) |
28 QTimer.singleShot(0, self.__fireSignals) |
31 QTimer.singleShot(0, self.__fireSignals) |
29 |
32 |
30 def __fireSignals(self): |
33 def __fireSignals(self): |
31 """ |
34 """ |
32 Private method to send some signals to end the connection. |
35 Private method to send some signals to end the connection. |