From 435f1f45e01642934aa1803d71427d5674ae577b Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 21 Feb 2014 07:37:47 +0100 Subject: [PATCH] Emit finished at the right places. --- qutebrowser/network/schemehandler.py | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/qutebrowser/network/schemehandler.py b/qutebrowser/network/schemehandler.py index 1949da39b..37216e34a 100644 --- a/qutebrowser/network/schemehandler.py +++ b/qutebrowser/network/schemehandler.py @@ -62,7 +62,7 @@ class SpecialNetworkReply(QNetworkReply): parent: reference to the parent object (QObject) Emit: - metaDataChanged and readyRead after initializing. + metaDataChanged and readyRead and finished after initializing. """ super().__init__(parent) @@ -79,6 +79,7 @@ class SpecialNetworkReply(QNetworkReply): self.setAttribute(QNetworkRequest.HttpReasonPhraseAttribute, "OK") self.metaDataChanged.emit() self.readyRead.emit() + self.finished.emit() @pyqtSlot() def abort(self): @@ -91,12 +92,7 @@ class SpecialNetworkReply(QNetworkReply): Return: bytes available (int) - Emit: - finished: if the data length is 0 - """ - if self._data.length() == 0: - self.finished.emit() return self._data.length() + super().bytesAvailable() logging.debug("bytes available: {}".format(len(self._data))) @@ -109,14 +105,9 @@ class SpecialNetworkReply(QNetworkReply): Return: bytestring containing the data - Emit: - finished: if all data was read - """ len_ = min(maxlen, self._data.length()) buf = bytes(self._data[:len_]) self._data.remove(0, len_) - if self._data.length() == 0: - self.finished.emit() logging.debug("readdata, len {}, maxlen {}, buf {}".format(len(self._data), maxlen, buf)) return buf