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 __future__ import unicode_literals # __IGNORE_WARNING__ |
11 from __future__ import unicode_literals # __IGNORE_WARNING__ |
11 |
12 |
12 from PyQt4.QtCore import QTimer |
13 from PyQt4.QtCore import QTimer |
13 from PyQt4.QtNetwork import QNetworkReply |
14 from PyQt4.QtNetwork import QNetworkReply |
14 |
15 |
15 |
16 |
16 class NetworkProtocolUnknownErrorReply(QNetworkReply): |
17 class NetworkProtocolUnknownErrorReply(QNetworkReply): |
17 """ |
18 """ |
18 Class implementing a QNetworkReply subclass reporting an unknown protocol error. |
19 Class implementing a QNetworkReply subclass reporting an unknown protocol |
|
20 error. |
19 """ |
21 """ |
20 def __init__(self, protocol, parent=None): |
22 def __init__(self, protocol, parent=None): |
21 """ |
23 """ |
22 Constructor |
24 Constructor |
23 |
25 |
24 @param protocol protocol name (string) |
26 @param protocol protocol name (string) |
25 @param parent reference to the parent object (QObject) |
27 @param parent reference to the parent object (QObject) |
26 """ |
28 """ |
27 super(NetworkProtocolUnknownErrorReply, self).__init__(parent) |
29 super(NetworkProtocolUnknownErrorReply, self).__init__(parent) |
28 self.setError(QNetworkReply.ProtocolUnknownError, |
30 self.setError( |
29 self.trUtf8("Protocol '{0}' not supported.").format(protocol)) |
31 QNetworkReply.ProtocolUnknownError, |
|
32 self.trUtf8("Protocol '{0}' not supported.").format(protocol)) |
30 QTimer.singleShot(0, self.__fireSignals) |
33 QTimer.singleShot(0, self.__fireSignals) |
31 |
34 |
32 def __fireSignals(self): |
35 def __fireSignals(self): |
33 """ |
36 """ |
34 Private method to send some signals to end the connection. |
37 Private method to send some signals to end the connection. |