25 QNetworkAccessManager, QNetworkRequest, QNetworkReply |
25 QNetworkAccessManager, QNetworkRequest, QNetworkReply |
26 ) |
26 ) |
27 |
27 |
28 from .Ui_PluginRepositoryDialog import Ui_PluginRepositoryDialog |
28 from .Ui_PluginRepositoryDialog import Ui_PluginRepositoryDialog |
29 |
29 |
30 from E5Gui import E5MessageBox |
30 from E5Gui import EricMessageBox |
31 from E5Gui.E5MainWindow import E5MainWindow |
31 from E5Gui.EricMainWindow import EricMainWindow |
32 from E5Gui.E5Application import e5App |
32 from E5Gui.EricApplication import ericApp |
33 |
33 |
34 from EricNetwork.EricNetworkProxyFactory import proxyAuthenticationRequired |
34 from EricNetwork.EricNetworkProxyFactory import proxyAuthenticationRequired |
35 try: |
35 try: |
36 from EricNetwork.EricSslErrorHandler import EricSslErrorHandler, EricSslErrorState |
36 from EricNetwork.EricSslErrorHandler import EricSslErrorHandler, EricSslErrorState |
37 SSL_AVAILABLE = True |
37 SSL_AVAILABLE = True |
340 Private method called, when the download of the plugins is finished. |
340 Private method called, when the download of the plugins is finished. |
341 """ |
341 """ |
342 self.__downloadButton.setEnabled(len(self.__selectedItems())) |
342 self.__downloadButton.setEnabled(len(self.__selectedItems())) |
343 self.__downloadInstallButton.setEnabled(len(self.__selectedItems())) |
343 self.__downloadInstallButton.setEnabled(len(self.__selectedItems())) |
344 self.__installButton.setEnabled(len(self.__selectedItems())) |
344 self.__installButton.setEnabled(len(self.__selectedItems())) |
345 ui = (e5App().getObject("UserInterface") |
345 ui = (ericApp().getObject("UserInterface") |
346 if not self.__external else None) |
346 if not self.__external else None) |
347 if ui is not None: |
347 if ui is not None: |
348 ui.showNotification( |
348 ui.showNotification( |
349 UI.PixmapCache.getPixmap("plugin48"), |
349 UI.PixmapCache.getPixmap("plugin48"), |
350 self.tr("Download Plugin Files"), |
350 self.tr("Download Plugin Files"), |
352 |
352 |
353 if self.__isDownloadInstall: |
353 if self.__isDownloadInstall: |
354 self.closeAndInstall.emit() |
354 self.closeAndInstall.emit() |
355 else: |
355 else: |
356 if ui is None: |
356 if ui is None: |
357 E5MessageBox.information( |
357 EricMessageBox.information( |
358 self, |
358 self, |
359 self.tr("Download Plugin Files"), |
359 self.tr("Download Plugin Files"), |
360 self.tr("""The requested plugins were downloaded.""")) |
360 self.tr("""The requested plugins were downloaded.""")) |
361 |
361 |
362 self.downloadProgress.setValue(0) |
362 self.downloadProgress.setValue(0) |
400 self.repositoryList.resizeColumnToContents(2) |
400 self.repositoryList.resizeColumnToContents(2) |
401 self.__resortRepositoryList() |
401 self.__resortRepositoryList() |
402 url = Preferences.getUI("PluginRepositoryUrl7") |
402 url = Preferences.getUI("PluginRepositoryUrl7") |
403 if url != self.repositoryUrlEdit.text(): |
403 if url != self.repositoryUrlEdit.text(): |
404 self.repositoryUrlEdit.setText(url) |
404 self.repositoryUrlEdit.setText(url) |
405 E5MessageBox.warning( |
405 EricMessageBox.warning( |
406 self, |
406 self, |
407 self.tr("Plugins Repository URL Changed"), |
407 self.tr("Plugins Repository URL Changed"), |
408 self.tr( |
408 self.tr( |
409 """The URL of the Plugins Repository has""" |
409 """The URL of the Plugins Repository has""" |
410 """ changed. Select the "Update" button to get""" |
410 """ changed. Select the "Update" button to get""" |
411 """ the new repository file.""")) |
411 """ the new repository file.""")) |
412 else: |
412 else: |
413 E5MessageBox.critical( |
413 EricMessageBox.critical( |
414 self, |
414 self, |
415 self.tr("Read plugins repository file"), |
415 self.tr("Read plugins repository file"), |
416 self.tr("<p>The plugins repository file <b>{0}</b> " |
416 self.tr("<p>The plugins repository file <b>{0}</b> " |
417 "could not be read. Select Update</p>") |
417 "could not be read. Select Update</p>") |
418 .format(self.pluginRepositoryFile)) |
418 .format(self.pluginRepositoryFile)) |
481 ok = False |
481 ok = False |
482 if ( |
482 if ( |
483 reply.error() != |
483 reply.error() != |
484 QNetworkReply.NetworkError.OperationCanceledError |
484 QNetworkReply.NetworkError.OperationCanceledError |
485 ): |
485 ): |
486 E5MessageBox.warning( |
486 EricMessageBox.warning( |
487 self, |
487 self, |
488 self.tr("Error downloading file"), |
488 self.tr("Error downloading file"), |
489 self.tr( |
489 self.tr( |
490 """<p>Could not download the requested file""" |
490 """<p>Could not download the requested file""" |
491 """ from {0}.</p><p>Error: {1}</p>""" |
491 """ from {0}.</p><p>Error: {1}</p>""" |
820 @return list of plugin filenames (list of strings) |
820 @return list of plugin filenames (list of strings) |
821 """ |
821 """ |
822 return self.cw.getDownloadedPlugins() |
822 return self.cw.getDownloadedPlugins() |
823 |
823 |
824 |
824 |
825 class PluginRepositoryWindow(E5MainWindow): |
825 class PluginRepositoryWindow(EricMainWindow): |
826 """ |
826 """ |
827 Main window class for the standalone dialog. |
827 Main window class for the standalone dialog. |
828 """ |
828 """ |
829 def __init__(self, parent=None): |
829 def __init__(self, parent=None): |
830 """ |
830 """ |
859 |
859 |
860 if ( |
860 if ( |
861 not os.path.isfile(applPath) or |
861 not os.path.isfile(applPath) or |
862 not proc.startDetached(sys.executable, args) |
862 not proc.startDetached(sys.executable, args) |
863 ): |
863 ): |
864 E5MessageBox.critical( |
864 EricMessageBox.critical( |
865 self, |
865 self, |
866 self.tr('Process Generation Error'), |
866 self.tr('Process Generation Error'), |
867 self.tr( |
867 self.tr( |
868 '<p>Could not start the process.<br>' |
868 '<p>Could not start the process.<br>' |
869 'Ensure that it is available as <b>{0}</b>.</p>' |
869 'Ensure that it is available as <b>{0}</b>.</p>' |
945 for removeFile in removeFiles: |
945 for removeFile in removeFiles: |
946 try: |
946 try: |
947 os.remove(os.path.join(downloadPath, removeFile)) |
947 os.remove(os.path.join(downloadPath, removeFile)) |
948 except OSError as err: |
948 except OSError as err: |
949 if not quiet: |
949 if not quiet: |
950 E5MessageBox.critical( |
950 EricMessageBox.critical( |
951 None, |
951 None, |
952 QCoreApplication.translate( |
952 QCoreApplication.translate( |
953 "PluginRepositoryWidget", |
953 "PluginRepositoryWidget", |
954 "Cleanup of Plugin Downloads"), |
954 "Cleanup of Plugin Downloads"), |
955 QCoreApplication.translate( |
955 QCoreApplication.translate( |
974 for removeFile in removeFiles: |
974 for removeFile in removeFiles: |
975 try: |
975 try: |
976 os.remove(os.path.join(downloadPath, removeFile)) |
976 os.remove(os.path.join(downloadPath, removeFile)) |
977 except OSError as err: |
977 except OSError as err: |
978 if not quiet: |
978 if not quiet: |
979 E5MessageBox.critical( |
979 EricMessageBox.critical( |
980 None, |
980 None, |
981 QCoreApplication.translate( |
981 QCoreApplication.translate( |
982 "PluginRepositoryWidget", |
982 "PluginRepositoryWidget", |
983 "Cleanup of Plugin Downloads"), |
983 "Cleanup of Plugin Downloads"), |
984 QCoreApplication.translate( |
984 QCoreApplication.translate( |