PluginManager/PluginManager.py

changeset 5555
5ece4e830780
parent 5395
56efc13e456e
child 5588
6ba512d9f46a
diff -r c477ae02bf5f -r 5ece4e830780 PluginManager/PluginManager.py
--- a/PluginManager/PluginManager.py	Fri Feb 24 18:58:27 2017 +0100
+++ b/PluginManager/PluginManager.py	Fri Feb 24 18:59:38 2017 +0100
@@ -1034,7 +1034,7 @@
             pluginName in self.__onDemandActiveModules
     
     ###########################################################################
-    ## Specialized plugin module handling methods below
+    ## Specialized plug-in module handling methods below
     ###########################################################################
     
     ###########################################################################
@@ -1297,6 +1297,30 @@
         ignored = self.__sslErrorHandler.sslErrorsReply(reply, errors)[0]
         if ignored == E5SslErrorHandler.NotIgnored:
             self.__downloadCancelled = True
+    
+    ########################################################################
+    ## Methods to clear private data of plug-ins below
+    ########################################################################
+    
+    def clearPluginsPrivateData(self, type_):
+        """
+        Public method to clear the private data of plug-ins of a specified
+        type.
+        
+        Plugins supporting this functionality must support the module function
+        clearPrivateData() and have the module level attribute pluginType.
+        
+        @param type_ type of the plugin to be activated (string)
+        """
+        for name, module in \
+            list(self.__onDemandActiveModules.items()) + \
+            list(self.__onDemandInactiveModules.items()) + \
+            list(self.__activeModules.items()) + \
+                list(self.__inactiveModules.items()):
+            if getattr(module, "pluginType", "") == type_:
+                if hasattr(module, "clearPrivateData"):
+                    module.clearPrivateData()
+        # TODO: document this in the plug-ins paper
 
 #
 # eflag: noqa = M801

eric ide

mercurial