42 QNetworkInformation, |
42 QNetworkInformation, |
43 ) |
43 ) |
44 |
44 |
45 from .Ui_PluginRepositoryDialog import Ui_PluginRepositoryDialog |
45 from .Ui_PluginRepositoryDialog import Ui_PluginRepositoryDialog |
46 |
46 |
47 from EricWidgets import EricMessageBox |
47 from eric7.EricWidgets import EricMessageBox |
48 from EricWidgets.EricMainWindow import EricMainWindow |
48 from eric7.EricWidgets.EricMainWindow import EricMainWindow |
49 from EricWidgets.EricApplication import ericApp |
49 from eric7.EricWidgets.EricApplication import ericApp |
50 |
50 |
51 from EricNetwork.EricNetworkProxyFactory import proxyAuthenticationRequired |
51 from eric7.EricNetwork.EricNetworkProxyFactory import proxyAuthenticationRequired |
52 |
52 |
53 try: |
53 try: |
54 from EricNetwork.EricSslErrorHandler import EricSslErrorHandler, EricSslErrorState |
54 from eric7.EricNetwork.EricSslErrorHandler import ( |
|
55 EricSslErrorHandler, |
|
56 EricSslErrorState, |
|
57 ) |
55 |
58 |
56 SSL_AVAILABLE = True |
59 SSL_AVAILABLE = True |
57 except ImportError: |
60 except ImportError: |
58 SSL_AVAILABLE = False |
61 SSL_AVAILABLE = False |
59 |
62 |
60 import Globals |
63 from eric7 import Globals, Preferences, Utilities |
61 import Utilities |
64 |
62 import Preferences |
65 from eric7.EricGui import EricPixmapCache |
63 |
|
64 import UI.PixmapCache |
|
65 |
66 |
66 from eric7config import getConfig |
67 from eric7config import getConfig |
67 |
68 |
68 |
69 |
69 class PluginRepositoryWidget(QWidget, Ui_PluginRepositoryDialog): |
70 class PluginRepositoryWidget(QWidget, Ui_PluginRepositoryDialog): |
118 if self.__integratedWidget: |
119 if self.__integratedWidget: |
119 self.__actionButtonsLayout = QHBoxLayout() |
120 self.__actionButtonsLayout = QHBoxLayout() |
120 self.__actionButtonsLayout.addStretch() |
121 self.__actionButtonsLayout.addStretch() |
121 |
122 |
122 self.__updateButton = QToolButton(self) |
123 self.__updateButton = QToolButton(self) |
123 self.__updateButton.setIcon(UI.PixmapCache.getIcon("reload")) |
124 self.__updateButton.setIcon(EricPixmapCache.getIcon("reload")) |
124 self.__updateButton.setToolTip(self.tr("Update")) |
125 self.__updateButton.setToolTip(self.tr("Update")) |
125 self.__updateButton.clicked.connect(self.__updateList) |
126 self.__updateButton.clicked.connect(self.__updateList) |
126 self.__actionButtonsLayout.addWidget(self.__updateButton) |
127 self.__actionButtonsLayout.addWidget(self.__updateButton) |
127 |
128 |
128 self.__downloadButton = QToolButton(self) |
129 self.__downloadButton = QToolButton(self) |
129 self.__downloadButton.setIcon(UI.PixmapCache.getIcon("download")) |
130 self.__downloadButton.setIcon(EricPixmapCache.getIcon("download")) |
130 self.__downloadButton.setToolTip(self.tr("Download")) |
131 self.__downloadButton.setToolTip(self.tr("Download")) |
131 self.__downloadButton.clicked.connect(self.__downloadButtonClicked) |
132 self.__downloadButton.clicked.connect(self.__downloadButtonClicked) |
132 self.__actionButtonsLayout.addWidget(self.__downloadButton) |
133 self.__actionButtonsLayout.addWidget(self.__downloadButton) |
133 |
134 |
134 self.__downloadInstallButton = QToolButton(self) |
135 self.__downloadInstallButton = QToolButton(self) |
135 self.__downloadInstallButton.setIcon(UI.PixmapCache.getIcon("downloadPlus")) |
136 self.__downloadInstallButton.setIcon( |
|
137 EricPixmapCache.getIcon("downloadPlus") |
|
138 ) |
136 self.__downloadInstallButton.setToolTip(self.tr("Download & Install")) |
139 self.__downloadInstallButton.setToolTip(self.tr("Download & Install")) |
137 self.__downloadInstallButton.clicked.connect( |
140 self.__downloadInstallButton.clicked.connect( |
138 self.__downloadInstallButtonClicked |
141 self.__downloadInstallButtonClicked |
139 ) |
142 ) |
140 self.__actionButtonsLayout.addWidget(self.__downloadInstallButton) |
143 self.__actionButtonsLayout.addWidget(self.__downloadInstallButton) |
141 |
144 |
142 self.__downloadCancelButton = QToolButton(self) |
145 self.__downloadCancelButton = QToolButton(self) |
143 self.__downloadCancelButton.setIcon(UI.PixmapCache.getIcon("cancel")) |
146 self.__downloadCancelButton.setIcon(EricPixmapCache.getIcon("cancel")) |
144 self.__downloadCancelButton.setToolTip(self.tr("Cancel")) |
147 self.__downloadCancelButton.setToolTip(self.tr("Cancel")) |
145 self.__downloadCancelButton.clicked.connect(self.__downloadCancel) |
148 self.__downloadCancelButton.clicked.connect(self.__downloadCancel) |
146 self.__actionButtonsLayout.addWidget(self.__downloadCancelButton) |
149 self.__actionButtonsLayout.addWidget(self.__downloadCancelButton) |
147 |
150 |
148 self.__installButton = QToolButton(self) |
151 self.__installButton = QToolButton(self) |
149 self.__installButton.setIcon(UI.PixmapCache.getIcon("plus")) |
152 self.__installButton.setIcon(EricPixmapCache.getIcon("plus")) |
150 self.__installButton.setToolTip(self.tr("Install")) |
153 self.__installButton.setToolTip(self.tr("Install")) |
151 self.__installButton.clicked.connect(self.__closeAndInstall) |
154 self.__installButton.clicked.connect(self.__closeAndInstall) |
152 self.__actionButtonsLayout.addWidget(self.__installButton) |
155 self.__actionButtonsLayout.addWidget(self.__installButton) |
153 |
156 |
154 self.__actionButtonsLayout.addStretch() |
157 self.__actionButtonsLayout.addStretch() |
497 self.__downloadInstallButton.setEnabled(len(self.__selectedItems())) |
500 self.__downloadInstallButton.setEnabled(len(self.__selectedItems())) |
498 self.__installButton.setEnabled(len(self.__selectedItems())) |
501 self.__installButton.setEnabled(len(self.__selectedItems())) |
499 ui = ericApp().getObject("UserInterface") if not self.__external else None |
502 ui = ericApp().getObject("UserInterface") if not self.__external else None |
500 if ui is not None: |
503 if ui is not None: |
501 ui.showNotification( |
504 ui.showNotification( |
502 UI.PixmapCache.getPixmap("plugin48"), |
505 EricPixmapCache.getPixmap("plugin48"), |
503 self.tr("Download Plugin Files"), |
506 self.tr("Download Plugin Files"), |
504 self.tr("""The requested plugins were downloaded."""), |
507 self.tr("""The requested plugins were downloaded."""), |
505 ) |
508 ) |
506 |
509 |
507 if self.__isDownloadInstall: |
510 if self.__isDownloadInstall: |
546 |
549 |
547 if os.path.exists(self.pluginRepositoryFile): |
550 if os.path.exists(self.pluginRepositoryFile): |
548 self.__repositoryMissing = False |
551 self.__repositoryMissing = False |
549 f = QFile(self.pluginRepositoryFile) |
552 f = QFile(self.pluginRepositoryFile) |
550 if f.open(QIODevice.OpenModeFlag.ReadOnly): |
553 if f.open(QIODevice.OpenModeFlag.ReadOnly): |
551 from EricXML.PluginRepositoryReader import PluginRepositoryReader |
554 from eric7.EricXML.PluginRepositoryReader import PluginRepositoryReader |
552 |
555 |
553 reader = PluginRepositoryReader(f, self.addEntry) |
556 reader = PluginRepositoryReader(f, self.addEntry) |
554 reader.readXML() |
557 reader.readXML() |
555 self.repositoryList.resizeColumnToContents(0) |
558 self.repositoryList.resizeColumnToContents(0) |
556 self.repositoryList.resizeColumnToContents(1) |
559 self.repositoryList.resizeColumnToContents(1) |
780 itm.setData(0, PluginRepositoryWidget.DescrRole, description) |
783 itm.setData(0, PluginRepositoryWidget.DescrRole, description) |
781 |
784 |
782 iconColumn = 0 if self.__integratedWidget else 1 |
785 iconColumn = 0 if self.__integratedWidget else 1 |
783 updateStatus = self.__updateStatus(filename, version) |
786 updateStatus = self.__updateStatus(filename, version) |
784 if updateStatus == PluginRepositoryWidget.PluginStatusUpToDate: |
787 if updateStatus == PluginRepositoryWidget.PluginStatusUpToDate: |
785 itm.setIcon(iconColumn, UI.PixmapCache.getIcon("empty")) |
788 itm.setIcon(iconColumn, EricPixmapCache.getIcon("empty")) |
786 itm.setToolTip(iconColumn, self.tr("up-to-date")) |
789 itm.setToolTip(iconColumn, self.tr("up-to-date")) |
787 elif updateStatus == PluginRepositoryWidget.PluginStatusNew: |
790 elif updateStatus == PluginRepositoryWidget.PluginStatusNew: |
788 itm.setIcon(iconColumn, UI.PixmapCache.getIcon("download")) |
791 itm.setIcon(iconColumn, EricPixmapCache.getIcon("download")) |
789 itm.setToolTip(iconColumn, self.tr("new download available")) |
792 itm.setToolTip(iconColumn, self.tr("new download available")) |
790 self.__newItems += 1 |
793 self.__newItems += 1 |
791 elif updateStatus == PluginRepositoryWidget.PluginStatusLocalUpdate: |
794 elif updateStatus == PluginRepositoryWidget.PluginStatusLocalUpdate: |
792 itm.setIcon(iconColumn, UI.PixmapCache.getIcon("updateLocal")) |
795 itm.setIcon(iconColumn, EricPixmapCache.getIcon("updateLocal")) |
793 itm.setToolTip(iconColumn, self.tr("update installable")) |
796 itm.setToolTip(iconColumn, self.tr("update installable")) |
794 self.__updateLocalItems += 1 |
797 self.__updateLocalItems += 1 |
795 elif updateStatus == PluginRepositoryWidget.PluginStatusRemoteUpdate: |
798 elif updateStatus == PluginRepositoryWidget.PluginStatusRemoteUpdate: |
796 itm.setIcon(iconColumn, UI.PixmapCache.getIcon("updateRemote")) |
799 itm.setIcon(iconColumn, EricPixmapCache.getIcon("updateRemote")) |
797 itm.setToolTip(iconColumn, self.tr("updated download available")) |
800 itm.setToolTip(iconColumn, self.tr("updated download available")) |
798 self.__updateRemoteItems += 1 |
801 self.__updateRemoteItems += 1 |
799 elif updateStatus == PluginRepositoryWidget.PluginStatusError: |
802 elif updateStatus == PluginRepositoryWidget.PluginStatusError: |
800 itm.setIcon(iconColumn, UI.PixmapCache.getIcon("warning")) |
803 itm.setIcon(iconColumn, EricPixmapCache.getIcon("warning")) |
801 itm.setToolTip(iconColumn, self.tr("error determining status")) |
804 itm.setToolTip(iconColumn, self.tr("error determining status")) |
802 |
805 |
803 def __updateStatus(self, filename, version): |
806 def __updateStatus(self, filename, version): |
804 """ |
807 """ |
805 Private method to check the given archive update status. |
808 Private method to check the given archive update status. |
1150 # step 3: delete entries of obsolete plug-ins |
1153 # step 3: delete entries of obsolete plug-ins |
1151 pluginRepositoryFile = os.path.join(Utilities.getConfigDir(), "PluginRepository") |
1154 pluginRepositoryFile = os.path.join(Utilities.getConfigDir(), "PluginRepository") |
1152 if os.path.exists(pluginRepositoryFile): |
1155 if os.path.exists(pluginRepositoryFile): |
1153 f = QFile(pluginRepositoryFile) |
1156 f = QFile(pluginRepositoryFile) |
1154 if f.open(QIODevice.OpenModeFlag.ReadOnly): |
1157 if f.open(QIODevice.OpenModeFlag.ReadOnly): |
1155 from EricXML.PluginRepositoryReader import PluginRepositoryReader |
1158 from eric7.EricXML.PluginRepositoryReader import PluginRepositoryReader |
1156 |
1159 |
1157 reader = PluginRepositoryReader(f, registerPlugin) |
1160 reader = PluginRepositoryReader(f, registerPlugin) |
1158 reader.readXML() |
1161 reader.readXML() |
1159 |
1162 |
1160 for pluginName in downloads: |
1163 for pluginName in downloads: |