Пример #1
0
 def load_registered_plugin(self):
     '''
     read the settings and load registered plugin
     '''        
     for pluginid in self.settings.registered_plugin_ids:
         
         plugin = self.get_available_plugin_by_id(pluginid)
         # which cache storage we will used ?
         if self.settings.cache_storage == MEMORY_CACHE_STORE:
             cachePlugin = MemoryCachePlugin(plugin)
         elif self.settings.cache_storage == DISK_CACHE_STORE:
             cachePlugin = DiskCachePlugin(plugin)
         else:
             cachePlugin = MemoryCachePlugin(plugin)
             logging.warning("the current cache store " + str(self.settings.cache_storage) + " is unknown")
             logging.warning("will use " + MEMORY_CACHE_STORE + " for " + plugin.get_plugin_id())
             
         if  self.settings.cache_strategy == CachePlugin.CACHE_PREFERED_STATEGY:
             cachePlugin.setCachePrefered()
         elif self.settings.cache_strategy == CachePlugin.NETWORK_DATA_PREFERED_STRATEGY:
             cachePlugin.setNetworkPrefered()
         else:
             logging.warning("the current cache strategy " + str(self.settings.cache_strategy) + " is unknow")
             logging.warning("will use " + cachePlugin.cacheStrategy + " for " + cachePlugin.get_plugin_id())
         
         self.register_plugin(cachePlugin)
Пример #2
0
 def save_registered_plugin(self):
     '''
     save current registered plugin in the settiongs then save the settings
     '''
     self.settings.registered_plugin_ids[:]
     for plugin in self.registered_plugin:
         self.settings.registered_plugin_ids.append(plugin.get_plugin_id())
     self.save_settings()