--- a/src/eric7/PluginManager/PluginManager.py Wed Apr 23 17:23:57 2025 +0200 +++ b/src/eric7/PluginManager/PluginManager.py Wed Apr 23 18:02:09 2025 +0200 @@ -64,6 +64,8 @@ a plugin was activated @signal allPlugginsActivated() emitted at startup after all plugins have been activated + @signal allTypedPlugginsActivated(pluginType) emitted at startup after all + plugins of the type have been activated @signal pluginAboutToBeDeactivated(moduleName, pluginObject) emitted just before a plugin is deactivated @signal pluginDeactivated(moduleName, pluginObject) emitted just after @@ -76,6 +78,7 @@ pluginAboutToBeActivated = pyqtSignal(str, object) pluginActivated = pyqtSignal(str, object) allPlugginsActivated = pyqtSignal() + allTypedPlugginsActivated = pyqtSignal(str) pluginAboutToBeDeactivated = pyqtSignal(str, object) pluginDeactivated = pyqtSignal(str, object) pluginRepositoryFileDownloaded = pyqtSignal() @@ -617,8 +620,23 @@ for name in names: if name not in inactiveList: self.activatePlugin(name) + self.allPlugginsActivated.emit() + def activateTypedPlugins(self, pluginType): + """ + Public method to activate all plugins having the "autoactivate" attribute + set to True and being of the given plugin type. + + @param pluginType plugin type + @type str + """ + for name, module in self.__inactiveModules.items(): + if getPluginHeaderEntry(module, "pluginType", "") == pluginType: + self.activatePlugin(name) + + self.allTypedPlugginsActivated.emit(pluginType) + def activatePlugin(self, name, onDemand=False): """ Public method to activate a plugin. @@ -795,14 +813,14 @@ """ return getPluginHeaderEntry(module, "deactivateable", True) - def getPluginObject(self, type_, typename, maybeActive=False): + def getPluginObject(self, pluginType, pluginTypename, maybeActive=False): """ Public method to activate an on-demand plugin given by type and type name. - @param type_ type of the plugin to be activated + @param pluginType type of the plugin to be activated @type str - @param typename name of the plugin within the type category + @param pluginTypename name of the plugin within the type category @type str @param maybeActive flag indicating, that the plugin may be active already @@ -812,21 +830,22 @@ """ for name, module in self.__onDemandInactiveModules.items(): if ( - getPluginHeaderEntry(module, "pluginType", "") == type_ - and getPluginHeaderEntry(module, "pluginTypename", "") == typename + getPluginHeaderEntry(module, "pluginType", "") == pluginType + and getPluginHeaderEntry(module, "pluginTypename", "") == pluginTypename ): return self.activatePlugin(name, onDemand=True) if maybeActive: for name, module in self.__onDemandActiveModules.items(): if ( - getPluginHeaderEntry(module, "pluginType", "") == type_ - and getPluginHeaderEntry(module, "pluginTypename", "") == typename + getPluginHeaderEntry(module, "pluginType", "") == pluginType + and getPluginHeaderEntry(module, "pluginTypename", "") + == pluginTypename ): self.deactivatePlugin(name, onDemand=True) return self.activatePlugin(name, onDemand=True) - return None, f"no plugin module of type {type_}: {typename}" + return None, f"no plugin module of type {pluginType}: {pluginTypename}" def getPluginInfos(self): """ @@ -981,12 +1000,12 @@ self.shutdown.emit() - def getPluginDisplayStrings(self, type_): + def getPluginDisplayStrings(self, pluginType): """ Public method to get the display strings of all plugins of a specific type. - @param type_ type of the plugins + @param pluginType type of the plugins @type str @return dictionary with name as key and display string as value @rtype dict @@ -998,7 +1017,7 @@ self.__onDemandInactiveModules.values(), ): if ( - getPluginHeaderEntry(module, "pluginType", "") == type_ + getPluginHeaderEntry(module, "pluginType", "") == pluginType and getPluginHeaderEntry(module, "error", "") == "" ): plugin_name = getPluginHeaderEntry(module, "pluginTypename", "") @@ -1009,11 +1028,11 @@ return pluginDict - def getPluginPreviewPixmap(self, type_, name): + def getPluginPreviewPixmap(self, pluginType, name): """ Public method to get a preview pixmap of a plugin of a specific type. - @param type_ type of the plugin + @param pluginType type of the plugin @type str @param name name of the plugin type @type str @@ -1025,7 +1044,7 @@ self.__onDemandInactiveModules.values(), ): if ( - getPluginHeaderEntry(module, "pluginType", "") == type_ + getPluginHeaderEntry(module, "pluginType", "") == pluginType and getPluginHeaderEntry(module, "pluginTypename", "") == name ): if hasattr(module, "previewPix"): @@ -1494,7 +1513,7 @@ ## Methods to clear private data of plug-ins below ######################################################################## - def clearPluginsPrivateData(self, type_): + def clearPluginsPrivateData(self, pluginType): """ Public method to clear the private data of plug-ins of a specified type. @@ -1502,7 +1521,7 @@ Plugins supporting this functionality must support the module function 'clearPrivateData()' (and may have the module level attribute 'pluginType'). - @param type_ type of the plugin to clear private data for + @param pluginType type of the plugin to clear private data for @type str """ for module in itertools.chain( @@ -1511,7 +1530,7 @@ self.__activeModules.values(), self.__inactiveModules.values(), ): - if getPluginHeaderEntry(module, "pluginType", "") == type_ and hasattr( + if getPluginHeaderEntry(module, "pluginType", "") == pluginType and hasattr( module, "clearPrivateData" ): module.clearPrivateData()