--- a/src/eric7/PluginManager/PluginInfoDialog.py Wed Jul 13 11:16:20 2022 +0200 +++ b/src/eric7/PluginManager/PluginInfoDialog.py Wed Jul 13 14:55:47 2022 +0200 @@ -18,39 +18,40 @@ """ Class implementing the Plugin Info Dialog. """ + def __init__(self, pluginManager, parent=None): """ Constructor - + @param pluginManager reference to the plugin manager object @param parent parent of this dialog (QWidget) """ super().__init__(parent) self.setupUi(self) self.setWindowFlags(Qt.WindowType.Window) - + self.pm = pluginManager - + self.__autoActivateColumn = 3 self.__activeColumn = 4 - + self.pluginList.headerItem().setText(self.pluginList.columnCount(), "") - + # populate the list self.__populateList() self.pluginList.sortByColumn(0, Qt.SortOrder.AscendingOrder) - + self.__menu = QMenu(self) - self.__menu.addAction(self.tr('Show details'), self.__showDetails) + self.__menu.addAction(self.tr("Show details"), self.__showDetails) self.__activateAct = self.__menu.addAction( - self.tr('Activate'), self.__activatePlugin) + self.tr("Activate"), self.__activatePlugin + ) self.__deactivateAct = self.__menu.addAction( - self.tr('Deactivate'), self.__deactivatePlugin) - self.pluginList.setContextMenuPolicy( - Qt.ContextMenuPolicy.CustomContextMenu) - self.pluginList.customContextMenuRequested.connect( - self.__showContextMenu) - + self.tr("Deactivate"), self.__deactivatePlugin + ) + self.pluginList.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu) + self.pluginList.customContextMenuRequested.connect(self.__showContextMenu) + def __populateList(self): """ Private method to (re)populate the list of plugins. @@ -59,13 +60,13 @@ for info in self.pm.getPluginInfos(): self.__createEntry(info) self.pluginList.sortItems( - self.pluginList.sortColumn(), - self.pluginList.header().sortIndicatorOrder()) - + self.pluginList.sortColumn(), self.pluginList.header().sortIndicatorOrder() + ) + def __createEntry(self, info): """ Private method to create a list entry based on the provided info. - + @param info dictionary giving the info for the entry (as returned by PluginManager.getPluginInfos()) @type dict @@ -76,32 +77,28 @@ info["version"], (info["auto_activate"] and self.tr("Yes") or self.tr("On-Demand")), (info["active"] and self.tr("Yes") or self.tr("No")), - info["short_desc"] + info["short_desc"], ] itm = QTreeWidgetItem(self.pluginList, infoList) if info["error"]: # plugin error for col in range(self.pluginList.columnCount()): itm.setForeground(col, QBrush(Qt.GlobalColor.red)) - itm.setTextAlignment(self.__autoActivateColumn, - Qt.AlignmentFlag.AlignHCenter) - itm.setTextAlignment(self.__activeColumn, - Qt.AlignmentFlag.AlignHCenter) - - self.pluginList.header().resizeSections( - QHeaderView.ResizeMode.ResizeToContents) + itm.setTextAlignment(self.__autoActivateColumn, Qt.AlignmentFlag.AlignHCenter) + itm.setTextAlignment(self.__activeColumn, Qt.AlignmentFlag.AlignHCenter) + + self.pluginList.header().resizeSections(QHeaderView.ResizeMode.ResizeToContents) self.pluginList.header().setStretchLastSection(True) - + def __showContextMenu(self, coord): """ Private slot to show the context menu of the listview. - + @param coord the position of the mouse pointer (QPoint) """ itm = self.pluginList.itemAt(coord) if itm is not None: - autoactivate = (itm.text(self.__autoActivateColumn) == - self.tr("Yes")) + autoactivate = itm.text(self.__autoActivateColumn) == self.tr("Yes") if itm.text(self.__activeColumn) == self.tr("Yes"): self.__activateAct.setEnabled(False) self.__deactivateAct.setEnabled(autoactivate) @@ -109,12 +106,12 @@ self.__activateAct.setEnabled(autoactivate) self.__deactivateAct.setEnabled(False) self.__menu.popup(self.mapToGlobal(coord)) - + @pyqtSlot(QTreeWidgetItem, int) def on_pluginList_itemActivated(self, item, column): """ Private slot to show details about a plugin. - + @param item reference to the selected item (QTreeWidgetItem) @param column column number (integer) """ @@ -124,16 +121,17 @@ pass else: from .PluginDetailsDialog import PluginDetailsDialog + dlg = PluginDetailsDialog(details, self) dlg.show() - + def __showDetails(self): """ Private slot to handle the "Show details" context menu action. """ itm = self.pluginList.currentItem() self.on_pluginList_itemActivated(itm, 0) - + def __activatePlugin(self): """ Private slot to handle the "Deactivate" context menu action. @@ -143,7 +141,7 @@ self.pm.activatePlugin(moduleName) # repopulate the list self.__populateList() - + def __deactivatePlugin(self): """ Private slot to handle the "Activate" context menu action.