--- a/eric7/PluginManager/PluginRepositoryDialog.py Sun Sep 26 18:15:37 2021 +0200 +++ b/eric7/PluginManager/PluginRepositoryDialog.py Sun Sep 26 20:04:58 2021 +0200 @@ -19,7 +19,7 @@ ) from PyQt6.QtWidgets import ( QWidget, QDialogButtonBox, QAbstractButton, QTreeWidgetItem, QDialog, - QVBoxLayout, QMenu, QLabel + QVBoxLayout, QHBoxLayout, QMenu, QLabel, QToolButton ) from PyQt6.QtNetwork import ( QNetworkAccessManager, QNetworkRequest, QNetworkReply, QNetworkInformation @@ -96,27 +96,70 @@ if integrated: self.layout().setContentsMargins(0, 3, 0, 0) - self.__updateButton = self.buttonBox.addButton( - self.tr("Update"), QDialogButtonBox.ButtonRole.ActionRole) - self.__downloadButton = self.buttonBox.addButton( - self.tr("Download"), QDialogButtonBox.ButtonRole.ActionRole) + if self.__integratedWidget: + self.__actionButtonsLayout = QHBoxLayout() + self.__actionButtonsLayout.addStretch() + + self.__updateButton = QToolButton(self) + self.__updateButton.setIcon(UI.PixmapCache.getIcon("reload")) + self.__updateButton.setToolTip(self.tr("Update")) + self.__updateButton.clicked.connect(self.updateList) + self.__actionButtonsLayout.addWidget(self.__updateButton) + + self.__downloadButton = QToolButton(self) + self.__downloadButton.setIcon(UI.PixmapCache.getIcon("download")) + self.__downloadButton.setToolTip(self.tr("Download")) + self.__updateButton.clicked.connect(self.__downloadButtonClicked) + self.__actionButtonsLayout.addWidget(self.__downloadButton) + + self.__downloadInstallButton = QToolButton(self) + self.__downloadInstallButton.setIcon( + UI.PixmapCache.getIcon("downloadPlus")) + self.__downloadInstallButton.setToolTip( + self.tr("Download && Install")) + self.__downloadInstallButton.clicked.connect( + self.__downloadInstallButtonClicked) + self.__actionButtonsLayout.addWidget(self.__downloadInstallButton) + + self.__downloadCancelButton = QToolButton(self) + self.__downloadCancelButton.setIcon( + UI.PixmapCache.getIcon("cancel")) + self.__downloadCancelButton.setToolTip(self.tr("Cancel")) + self.__downloadCancelButton.clicked.connect(self.__downloadCancel) + self.__actionButtonsLayout.addWidget(self.__downloadCancelButton) + + self.__installButton = QToolButton(self) + self.__installButton.setIcon(UI.PixmapCache.getIcon("plus")) + self.__installButton.setToolTip(self.tr("Install")) + self.__installButton.clicked.connect(self.__closeAndInstall) + self.__actionButtonsLayout.addWidget(self.__installButton) + + self.__actionButtonsLayout.addStretch() + + self.layout().addLayout(self.__actionButtonsLayout) + self.buttonBox.hide() + else: + self.__updateButton = self.buttonBox.addButton( + self.tr("Update"), QDialogButtonBox.ButtonRole.ActionRole) + self.__downloadButton = self.buttonBox.addButton( + self.tr("Download"), QDialogButtonBox.ButtonRole.ActionRole) + self.__downloadInstallButton = self.buttonBox.addButton( + self.tr("Download && Install"), + QDialogButtonBox.ButtonRole.ActionRole) + self.__downloadCancelButton = self.buttonBox.addButton( + self.tr("Cancel"), QDialogButtonBox.ButtonRole.ActionRole) + self.__installButton = self.buttonBox.addButton( + self.tr("Close && Install"), + QDialogButtonBox.ButtonRole.ActionRole) + if not self.__integratedWidget: + self.__closeButton = self.buttonBox.addButton( + self.tr("Close"), QDialogButtonBox.ButtonRole.RejectRole) + self.__closeButton.setEnabled(True) + self.__downloadButton.setEnabled(False) - self.__downloadInstallButton = self.buttonBox.addButton( - self.tr("Download && Install"), - QDialogButtonBox.ButtonRole.ActionRole) self.__downloadInstallButton.setEnabled(False) - self.__downloadCancelButton = self.buttonBox.addButton( - self.tr("Cancel"), QDialogButtonBox.ButtonRole.ActionRole) self.__downloadCancelButton.setEnabled(False) - self.__installButton = self.buttonBox.addButton( - self.tr("Install") if self.__integratedWidget else - self.tr("Close && Install"), - QDialogButtonBox.ButtonRole.ActionRole) self.__installButton.setEnabled(False) - if not self.__integratedWidget: - self.__closeButton = self.buttonBox.addButton( - self.tr("Close"), QDialogButtonBox.ButtonRole.RejectRole) - self.__closeButton.setEnabled(True) self.repositoryUrlEdit.setText( Preferences.getUI("PluginRepositoryUrl7")) @@ -159,7 +202,7 @@ ): self.__reachabilityChanged( QNetworkInformation.instance().reachability()) - # TODO: remove this 'contextlib' with official relelase + # TODO: remove this 'contextlib' with official release import contextlib with contextlib.suppress(Exception): QNetworkInformation.instance().reachabilityChanged.connect( @@ -209,17 +252,31 @@ if button == self.__updateButton: self.updateList() elif button == self.__downloadButton: - self.__isDownloadInstall = False - self.__downloadPlugins() + self.__downloadButtonClicked() elif button == self.__downloadInstallButton: - self.__isDownloadInstall = True - self.__allDownloadedOk = True - self.__downloadPlugins() + self.__downloadInstallButtonClicked() elif button == self.__downloadCancelButton: self.__downloadCancel() elif button == self.__installButton: self.__closeAndInstall() + @pyqtSlot() + def __downloadButtonClicked(self): + """ + Private slot to handle a click of the Download button. + """ + self.__isDownloadInstall = False + self.__downloadPlugins() + + @pyqtSlot() + def __downloadInstallButtonClicked(self): + """ + Private slot to handle a click of the Download & Install button. + """ + self.__isDownloadInstall = True + self.__allDownloadedOk = True + self.__downloadPlugins() + def __formatDescription(self, lines): """ Private method to format the description.