--- a/eric6/PluginManager/PluginRepositoryDialog.py Sun Jan 03 15:33:39 2021 +0100 +++ b/eric6/PluginManager/PluginRepositoryDialog.py Sun Jan 03 17:49:38 2021 +0100 @@ -22,8 +22,7 @@ QVBoxLayout, QMenu ) from PyQt5.QtNetwork import ( - QNetworkAccessManager, QNetworkRequest, QNetworkReply, - QNetworkConfigurationManager + QNetworkAccessManager, QNetworkRequest, QNetworkReply ) from .Ui_PluginRepositoryDialog import Ui_PluginRepositoryDialog @@ -138,18 +137,6 @@ self.__networkManager.sslErrors.connect(self.__sslErrors) self.__replies = [] - if Preferences.getUI("DynamicOnlineCheck"): - self.__networkConfigurationManager = ( - QNetworkConfigurationManager(self) - ) - self.__onlineStateChanged( - self.__networkConfigurationManager.isOnline()) - self.__networkConfigurationManager.onlineStateChanged.connect( - self.__onlineStateChanged) - else: - self.__networkConfigurationManager = None - self.__onlineStateChanged(True) - self.__pluginsToDownload = [] self.__pluginsDownloaded = [] self.__isDownloadInstall = False @@ -159,34 +146,6 @@ self.__populateList() - @pyqtSlot(bool) - def __onlineStateChanged(self, online): - """ - Private slot handling online state changes. - - @param online flag indicating the online status - @type bool - """ - self.__updateButton.setEnabled(online) - self.on_repositoryList_itemSelectionChanged() - if online: - msg = self.tr("Network Status: online") - else: - msg = self.tr("Network Status: offline") - self.statusLabel.setText(msg) - - def __isOnline(self): - """ - Private method to check the online status. - - @return flag indicating the online status - @rtype bool - """ - if self.__networkConfigurationManager is not None: - return self.__networkConfigurationManager.isOnline() - else: - return True - @pyqtSlot(QAbstractButton) def on_buttonBox_clicked(self, button): """ @@ -304,13 +263,10 @@ """ Private slot to handle a change of the selection. """ - self.__downloadButton.setEnabled( - len(self.__selectedItems()) and - self.__isOnline()) - self.__downloadInstallButton.setEnabled( - len(self.__selectedItems()) and - self.__isOnline()) - self.__installButton.setEnabled(len(self.__selectedItems())) + enable = bool(self.__selectedItems()) + self.__downloadButton.setEnabled(enable) + self.__downloadInstallButton.setEnabled(enable) + self.__installButton.setEnabled(enable) def __updateList(self): """ @@ -485,31 +441,22 @@ @param filename local name of the file (string) @param doneMethod method to be called when done """ - if self.__isOnline(): - self.__updateButton.setEnabled(False) - self.__downloadButton.setEnabled(False) - self.__downloadInstallButton.setEnabled(False) - self.__closeButton.setEnabled(False) - self.__downloadCancelButton.setEnabled(True) - - self.statusLabel.setText(url) - - request = QNetworkRequest(QUrl(url)) - request.setAttribute(QNetworkRequest.CacheLoadControlAttribute, - QNetworkRequest.AlwaysNetwork) - reply = self.__networkManager.get(request) - reply.finished.connect( - lambda: self.__downloadFileDone(reply, filename, doneMethod)) - reply.downloadProgress.connect(self.__downloadProgress) - self.__replies.append(reply) - else: - E5MessageBox.warning( - self, - self.tr("Error downloading file"), - self.tr( - """<p>Could not download the requested file""" - """ from {0}.</p><p>Error: {1}</p>""" - ).format(url, self.tr("Computer is offline."))) + self.__updateButton.setEnabled(False) + self.__downloadButton.setEnabled(False) + self.__downloadInstallButton.setEnabled(False) + self.__closeButton.setEnabled(False) + self.__downloadCancelButton.setEnabled(True) + + self.statusLabel.setText(url) + + request = QNetworkRequest(QUrl(url)) + request.setAttribute(QNetworkRequest.CacheLoadControlAttribute, + QNetworkRequest.AlwaysNetwork) + reply = self.__networkManager.get(request) + reply.finished.connect( + lambda: self.__downloadFileDone(reply, filename, doneMethod)) + reply.downloadProgress.connect(self.__downloadProgress) + self.__replies.append(reply) def __downloadFileDone(self, reply, fileName, doneMethod): """ @@ -526,7 +473,6 @@ self.__updateButton.setEnabled(True) self.__closeButton.setEnabled(True) self.__downloadCancelButton.setEnabled(False) - self.__onlineStateChanged(self.__isOnline()) ok = True if reply in self.__replies: