PageRenderTime 1582ms CodeModel.GetById 30ms RepoModel.GetById 1ms app.codeStats 0ms

/eric4-4.4.19/eric/Helpviewer/Network/NetworkProtocolUnknownErrorReply.py

#
Python | 50 lines | 16 code | 7 blank | 27 comment | 0 complexity | 8f0e16fc2f89cdcdc6b4cfc38050a569 MD5 | raw file
Possible License(s): GPL-3.0, LGPL-2.1, BSD-2-Clause
  1. # -*- coding: utf-8 -*-
  2. # Copyright (c) 2009 - 2011 Detlev Offenbach <detlev@die-offenbachs.de>
  3. #
  4. """
  5. Module implementing a QNetworkReply subclass reporting an unknown protocol error.
  6. """
  7. from PyQt4.QtCore import *
  8. from PyQt4.QtNetwork import QNetworkReply, QNetworkRequest
  9. class NetworkProtocolUnknownErrorReply(QNetworkReply):
  10. """
  11. Class implementing a QNetworkReply subclass reporting an unknown protocol error.
  12. """
  13. def __init__(self, protocol, parent = None):
  14. """
  15. Constructor
  16. @param protocol protocol name (string or QString)
  17. @param parent reference to the parent object (QObject)
  18. """
  19. QNetworkReply.__init__(self, parent)
  20. self.setError(QNetworkReply.ProtocolUnknownError,
  21. self.trUtf8("Protocol '%1' not supported.").arg(protocol))
  22. QTimer.singleShot(0, self.__fireSignals)
  23. def __fireSignals(self):
  24. """
  25. Private method to send some signals to end the connection.
  26. """
  27. self.emit(SIGNAL("error(QNetworkReply::NetworkError)"),
  28. QNetworkReply.ProtocolUnknownError)
  29. self.emit(SIGNAL("finished()"))
  30. def abort(self):
  31. """
  32. Public slot to abort the operation.
  33. """
  34. # do nothing
  35. pass
  36. def bytesAvailable(self):
  37. """
  38. Public method to determined the bytes available for being read.
  39. @return bytes available (integer)
  40. """
  41. return 0