eric6/Helpviewer/Network/NetworkProtocolUnknownErrorReply.py

changeset 6942
2602857055c5
parent 6645
ad476851d7e0
equal deleted inserted replaced
6941:f99d60d6b59b 6942:2602857055c5
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2009 - 2019 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Module implementing a QNetworkReply subclass reporting an unknown protocol
8 error.
9 """
10
11 from __future__ import unicode_literals
12
13 from PyQt5.QtCore import QTimer
14 from PyQt5.QtNetwork import QNetworkReply
15
16
17 class NetworkProtocolUnknownErrorReply(QNetworkReply):
18 """
19 Class implementing a QNetworkReply subclass reporting an unknown protocol
20 error.
21 """
22 def __init__(self, protocol, parent=None):
23 """
24 Constructor
25
26 @param protocol protocol name (string)
27 @param parent reference to the parent object (QObject)
28 """
29 super(NetworkProtocolUnknownErrorReply, self).__init__(parent)
30 self.setError(
31 QNetworkReply.ProtocolUnknownError,
32 self.tr("Protocol '{0}' not supported.").format(protocol))
33 QTimer.singleShot(0, self.__fireSignals)
34
35 def __fireSignals(self):
36 """
37 Private method to send some signals to end the connection.
38 """
39 self.error.emit(QNetworkReply.ProtocolUnknownError)
40 self.finished.emit()
41
42 def abort(self):
43 """
44 Public slot to abort the operation.
45 """
46 # do nothing
47 pass
48
49 def bytesAvailable(self):
50 """
51 Public method to determined the bytes available for being read.
52
53 @return bytes available (integer)
54 """
55 return 0

eric ide

mercurial