PluginManager/PluginRepositoryDialog.py

changeset 6088
b7fdd0db835e
parent 6064
32a8b51c89da
child 6156
ac12549e521a
equal deleted inserted replaced
6087:23da86c1ba4d 6088:b7fdd0db835e
467 467
468 request = QNetworkRequest(QUrl(url)) 468 request = QNetworkRequest(QUrl(url))
469 request.setAttribute(QNetworkRequest.CacheLoadControlAttribute, 469 request.setAttribute(QNetworkRequest.CacheLoadControlAttribute,
470 QNetworkRequest.AlwaysNetwork) 470 QNetworkRequest.AlwaysNetwork)
471 reply = self.__networkManager.get(request) 471 reply = self.__networkManager.get(request)
472 reply.finished.connect(self.__downloadFileDone) 472 reply.finished.connect(lambda: self.__downloadFileDone(reply))
473 reply.downloadProgress.connect(self.__downloadProgress) 473 reply.downloadProgress.connect(self.__downloadProgress)
474 self.__replies.append(reply) 474 self.__replies.append(reply)
475 else: 475 else:
476 E5MessageBox.warning( 476 E5MessageBox.warning(
477 self, 477 self,
479 self.tr( 479 self.tr(
480 """<p>Could not download the requested file""" 480 """<p>Could not download the requested file"""
481 """ from {0}.</p><p>Error: {1}</p>""" 481 """ from {0}.</p><p>Error: {1}</p>"""
482 ).format(url, self.tr("Computer is offline."))) 482 ).format(url, self.tr("Computer is offline.")))
483 483
484 def __downloadFileDone(self): 484 def __downloadFileDone(self, reply):
485 """ 485 """
486 Private method called, after the file has been downloaded 486 Private method called, after the file has been downloaded
487 from the Internet. 487 from the Internet.
488
489 @param reply reference to the reply object of the download
490 @type QNetworkReply
488 """ 491 """
489 self.__updateButton.setEnabled(True) 492 self.__updateButton.setEnabled(True)
490 self.__downloadCancelButton.setEnabled(False) 493 self.__downloadCancelButton.setEnabled(False)
491 self.__onlineStateChanged(self.__isOnline()) 494 self.__onlineStateChanged(self.__isOnline())
492 495
493 ok = True 496 ok = True
494 reply = self.sender()
495 if reply in self.__replies: 497 if reply in self.__replies:
496 self.__replies.remove(reply) 498 self.__replies.remove(reply)
497 if reply.error() != QNetworkReply.NoError: 499 if reply.error() != QNetworkReply.NoError:
498 ok = False 500 ok = False
499 if not self.__downloadCancelled: 501 if not self.__downloadCancelled:

eric ide

mercurial