Example #1
0
    def updateInfo(self):
        """ This method will update the information in the DB about this plugin type.
            It will call the lower-level layer ( MaKaC/plugins/__init__.py ) to retrieve
            information about its plugins, its options, etc.
        """

        #until we detect them, the plugins of this given Type are marked as present
        for plugin in self.getPluginList(includeNonPresent=True,
                                         includeNonActive=True):
            plugin.setPresent(False)

        #we get the list of modules (plugins) of this type
        pluginModules = Plugins.getPluginsByType(self.getName())

        #we loop through the plugins
        for pluginModule in pluginModules:
            if hasattr(pluginModule, "ignore") and pluginModule.ignore:
                continue

            #if it already existed, we mark it as present
            pluginName = pluginModule.pluginName
            if self.hasPlugin(pluginName):
                p = self.getPlugin(pluginName)
                if hasattr(pluginModule, "pluginDescription"):
                    p.setDescription(pluginModule.pluginDescription)
                p.setPresent(True)

            #if it didn't exist, we create it
            else:
                if hasattr(pluginModule, "pluginDescription"):
                    description = pluginModule.pluginDescription
                else:
                    description = None

                p = Plugin(pluginName, pluginModule.__name__, self,
                           description)
                self.addPlugin(p)

            if hasattr(pluginModule, "testPlugin") and pluginModule.testPlugin:
                p.setTestPlugin(pluginModule.testPlugin)

            if hasattr(pluginModule, "options") and hasattr(
                    pluginModule.options, "globalOptions"):
                p.updateAllOptions(pluginModule.options.globalOptions)

            if hasattr(pluginModule, "actions") and hasattr(
                    pluginModule.actions, "pluginActions"):
                p.updateAllActions(pluginModule.actions.pluginActions)

        retrievedPluginTypeOptions = Plugins.getOptionsByType(self.getName())
        self.updateAllOptions(retrievedPluginTypeOptions)

        retrievedPluginTypeActions = Plugins.getActionsByType(self.getName())
        self.updateAllActions(retrievedPluginTypeActions)

        self.__description = Plugins.getDescriptionByType(self.getName())

        self._visible = Plugins.getIsVisibleType(self.getName())
Example #2
0
    def updateInfo(self):
        """ This method will update the information in the DB about this plugin type.
            It will call the lower-level layer ( MaKaC/plugins/__init__.py ) to retrieve
            information about its plugins, its options, etc.
        """
        
        #until we detect them, the plugins of this given Type are marked as present
        for plugin in self.getPluginList(includeNonPresent = True, includeNonActive = True):
            plugin.setPresent(False)

        #we get the list of modules (plugins) of this type
        pluginModules = Plugins.getPluginsByType(self.getName())

        #we loop through the plugins
        for pluginModule in pluginModules:
            if hasattr(pluginModule, "ignore") and pluginModule.ignore:
                continue
            
            #if it already existed, we mark it as present
            pluginName = pluginModule.pluginName
            if self.hasPlugin(pluginName):
                p = self.getPlugin(pluginName)
                if hasattr(pluginModule, "pluginDescription"):
                    p.setDescription(pluginModule.pluginDescription)
                p.setPresent(True)

            #if it didn't exist, we create it
            else:
                if hasattr(pluginModule, "pluginDescription"):
                    description = pluginModule.pluginDescription
                else:
                    description = None
                
                p = Plugin(pluginName, pluginModule.__name__, self, description)
                self.addPlugin(p)
                
            if hasattr(pluginModule, "testPlugin") and pluginModule.testPlugin:
                p.setTestPlugin(pluginModule.testPlugin)
                
            if hasattr(pluginModule, "options") and hasattr(pluginModule.options, "globalOptions"):
                p.updateAllOptions(pluginModule.options.globalOptions)
                
            if hasattr(pluginModule, "actions") and hasattr(pluginModule.actions, "pluginActions"):
                p.updateAllActions(pluginModule.actions.pluginActions)

        
        retrievedPluginTypeOptions = Plugins.getOptionsByType(self.getName())
        self.updateAllOptions(retrievedPluginTypeOptions)
        
        retrievedPluginTypeActions = Plugins.getActionsByType(self.getName())
        self.updateAllActions(retrievedPluginTypeActions)
        
        self.__description = Plugins.getDescriptionByType(self.getName())
        
        self._visible = Plugins.getIsVisibleType(self.getName())