PluginManager/PluginRepositoryDialog.py

changeset 5047
04e5dfbd3f3d
parent 4631
5c1a96925da4
child 5382
5b772524f302
equal deleted inserted replaced
5042:021d99e03961 5047:04e5dfbd3f3d
121 if SSL_AVAILABLE: 121 if SSL_AVAILABLE:
122 self.__sslErrorHandler = E5SslErrorHandler(self) 122 self.__sslErrorHandler = E5SslErrorHandler(self)
123 self.__networkManager.sslErrors.connect(self.__sslErrors) 123 self.__networkManager.sslErrors.connect(self.__sslErrors)
124 self.__replies = [] 124 self.__replies = []
125 125
126 self.__networkConfigurationManager = QNetworkConfigurationManager(self) 126 if Preferences.getUI("DynamicOnlineCheck"):
127 self.__onlineStateChanged( 127 self.__networkConfigurationManager = \
128 self.__networkConfigurationManager.isOnline()) 128 QNetworkConfigurationManager(self)
129 129 self.__onlineStateChanged(
130 self.__networkConfigurationManager.onlineStateChanged.connect( 130 self.__networkConfigurationManager.isOnline())
131 self.__onlineStateChanged) 131 self.__networkConfigurationManager.onlineStateChanged.connect(
132 self.__onlineStateChanged)
133 else:
134 self.__networkConfigurationManager = None
135 self.__onlineStateChanged(True)
132 136
133 self.__doneMethod = None 137 self.__doneMethod = None
134 self.__inDownload = False 138 self.__inDownload = False
135 self.__pluginsToDownload = [] 139 self.__pluginsToDownload = []
136 self.__pluginsDownloaded = [] 140 self.__pluginsDownloaded = []
154 if online: 158 if online:
155 msg = self.tr("Network Status: online") 159 msg = self.tr("Network Status: online")
156 else: 160 else:
157 msg = self.tr("Network Status: offline") 161 msg = self.tr("Network Status: offline")
158 self.statusLabel.setText(msg) 162 self.statusLabel.setText(msg)
163
164 def __isOnline(self):
165 """
166 Private method to check the online status.
167
168 @return flag indicating the online status
169 @rtype bool
170 """
171 if self.__networkConfigurationManager is not None:
172 return self.__networkConfigurationManager.isOnline()
173 else:
174 return True
159 175
160 @pyqtSlot(QAbstractButton) 176 @pyqtSlot(QAbstractButton)
161 def on_buttonBox_clicked(self, button): 177 def on_buttonBox_clicked(self, button):
162 """ 178 """
163 Private slot to handle the click of a button of the button box. 179 Private slot to handle the click of a button of the button box.
255 """ 271 """
256 Private slot to handle a change of the selection. 272 Private slot to handle a change of the selection.
257 """ 273 """
258 self.__downloadButton.setEnabled( 274 self.__downloadButton.setEnabled(
259 len(self.__selectedItems()) and 275 len(self.__selectedItems()) and
260 self.__networkConfigurationManager.isOnline()) 276 self.__isOnline())
261 self.__downloadInstallButton.setEnabled( 277 self.__downloadInstallButton.setEnabled(
262 len(self.__selectedItems()) and 278 len(self.__selectedItems()) and
263 self.__networkConfigurationManager.isOnline()) 279 self.__isOnline())
264 self.__installButton.setEnabled(len(self.__selectedItems())) 280 self.__installButton.setEnabled(len(self.__selectedItems()))
265 281
266 def __updateList(self): 282 def __updateList(self):
267 """ 283 """
268 Private slot to download a new list and display the contents. 284 Private slot to download a new list and display the contents.
420 436
421 @param url URL for the download (string) 437 @param url URL for the download (string)
422 @param filename local name of the file (string) 438 @param filename local name of the file (string)
423 @param doneMethod method to be called when done 439 @param doneMethod method to be called when done
424 """ 440 """
425 if self.__networkConfigurationManager.isOnline(): 441 if self.__isOnline():
426 self.__updateButton.setEnabled(False) 442 self.__updateButton.setEnabled(False)
427 self.__downloadButton.setEnabled(False) 443 self.__downloadButton.setEnabled(False)
428 self.__downloadInstallButton.setEnabled(False) 444 self.__downloadInstallButton.setEnabled(False)
429 self.__downloadCancelButton.setEnabled(True) 445 self.__downloadCancelButton.setEnabled(True)
430 446
458 from the internet. 474 from the internet.
459 """ 475 """
460 self.__updateButton.setEnabled(True) 476 self.__updateButton.setEnabled(True)
461 self.__downloadCancelButton.setEnabled(False) 477 self.__downloadCancelButton.setEnabled(False)
462 self.__onlineStateChanged( 478 self.__onlineStateChanged(
463 self.__networkConfigurationManager.isOnline()) 479 self.__isOnline())
464 480
465 ok = True 481 ok = True
466 reply = self.sender() 482 reply = self.sender()
467 if reply in self.__replies: 483 if reply in self.__replies:
468 self.__replies.remove(reply) 484 self.__replies.remove(reply)

eric ide

mercurial