eric6/Helpviewer/Network/EmptyNetworkReply.py

changeset 6942
2602857055c5
parent 6645
ad476851d7e0
equal deleted inserted replaced
6941:f99d60d6b59b 6942:2602857055c5
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2012 - 2019 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Module implementing a network reply class for an empty reply
8 (i.e. request was handle other way).
9 """
10
11 from __future__ import unicode_literals
12
13 from PyQt5.QtCore import QTimer
14 from PyQt5.QtNetwork import QNetworkReply, QNetworkAccessManager
15
16
17 class EmptyNetworkReply(QNetworkReply):
18 """
19 Class implementing an empty network reply.
20 """
21 def __init__(self, parent=None):
22 """
23 Constructor
24
25 @param parent reference to the parent object (QObject)
26 """
27 super(EmptyNetworkReply, self).__init__(parent)
28
29 self.setOperation(QNetworkAccessManager.GetOperation)
30 self.setError(QNetworkReply.OperationCanceledError, "eric6:No Error")
31
32 QTimer.singleShot(0, lambda: self.finished.emit())
33
34 def abort(self):
35 """
36 Public slot to abort the operation.
37 """
38 # do nothing
39 pass
40
41 def readData(self, maxlen):
42 """
43 Public method to retrieve data from the reply object.
44
45 @param maxlen maximum number of bytes to read (integer)
46 @return string containing the data (bytes)
47 """
48 return bytes()

eric ide

mercurial