

Code: Alles auswählen
with open(self.location, 'wb') as fd:
for chunk in file.iter_content(chunk_size):
fd.write(chunk)
downloaded_bytes = fd.tell()
print (float(downloaded_bytes)/file_size*100)
self.notify_progress.emit(float(downloaded_bytes)/file_size*100)
if self._run_semaphore.available() == 0:
self._run_semaphore.release(1)
break
try:
file = requests.get(self.url)
except requests.exceptions.ConnectionError as ConnErr:
self.stop()
self.error_http.emit()
Um zu erkennen, was das Ding tut, muss man nun wahrlich kein C++ können! Die Strukturen sind doch gerade im Qt-GUI Bereich ziemlich identisch... ob das die eingebaute Qt-Funktionalität da evtl. etwas besser kapselt, kann ich nicht beurteilen.Sophus hat geschrieben:Und das Beispiel, welches du mir da präsentierst ist in C++ geschrieben. Damit kann ich nun nichts anfangen.
Code: Alles auswählen
if not file.reason == "OK":
break
Code: Alles auswählen
def run(self):
print "LOCATION", self.location_file #<-- wird ausgegeben
print "URL", self.url_download #<-- wird ausgegeben
try:
print "Connect to the url-link" #<-- wird ausgegeben
getfile = requests.get(self.url_download, stream=True)
web_status = getfile.status_code
print "Status: ", web_status #<-- wird nicht ausgegeben
[...]
Code: Alles auswählen
if __name__ == "__main__":
app = QApplication(sys.argv)
window = MyCustomDialog()
window.resize(600, 400)
window.show()
sys.exit(app.exec_())