Helpviewer/Network/NetworkProtocolUnknownErrorReply.py

Wed, 30 Dec 2009 15:40:33 +0000

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 30 Dec 2009 15:40:33 +0000
changeset 7
c679fb30c8f3
parent 0
de9c2efb9d02
child 13
1af94a91f439
permissions
-rw-r--r--

Change code dealing with QVariant (and QSettings) to use the PyQt4 QVariant v2 API.

# -*- coding: utf-8 -*-

# Copyright (c) 2009 Detlev Offenbach <detlev@die-offenbachs.de>
#

"""
Module implementing a QNetworkReply subclass reporting an unknown protocol error.
"""

from PyQt4.QtCore import *
from PyQt4.QtNetwork import QNetworkReply, QNetworkRequest

class NetworkProtocolUnknownErrorReply(QNetworkReply):
    """
    Class implementing a QNetworkReply subclass reporting an unknown protocol error.
    """
    def __init__(self, protocol, parent = None):
        """
        Constructor
        
        @param protocol protocol name (string)
        @param parent reference to the parent object (QObject)
        """
        QNetworkReply.__init__(self)
        self.setError(QNetworkReply.ProtocolUnknownError, 
                      self.trUtf8("Protocol '{0}' not supported.").format(protocol))
        QTimer.singleShot(0, self.__fireSignals)
    
    def __fireSignals(self):
        """
        Private method to send some signals to end the connection.
        """
        self.emit(SIGNAL("error(QNetworkReply::NetworkError)"), 
                         QNetworkReply.ProtocolUnknownError)
        self.emit(SIGNAL("finished()"))
    
    def abort(self):
        """
        Public slot to abort the operation.
        """
        # do nothing
        pass
    
    def bytesAvailable(self):
        """
        Public method to determined the bytes available for being read.
        
        @return bytes available (integer)
        """
        return 0

eric ide

mercurial