PluginManager/PluginManager.py

changeset 415
59a0f9e90768
parent 245
de5c4effc747
child 438
f62a3f9d2e28
equal deleted inserted replaced
414:8c91e942d2da 415:59a0f9e90768
286 @param name name of the module to be loaded (string) 286 @param name name of the module to be loaded (string)
287 @param directory name of the plugin directory (string) 287 @param directory name of the plugin directory (string)
288 @param reload_ flag indicating to reload the module (boolean) 288 @param reload_ flag indicating to reload the module (boolean)
289 """ 289 """
290 try: 290 try:
291 fname = "%s.py" % os.path.join(directory, name) 291 fname = "{0}.py".format(os.path.join(directory, name))
292 module = imp.load_source(name, fname) 292 module = imp.load_source(name, fname)
293 if not hasattr(module, "autoactivate"): 293 if not hasattr(module, "autoactivate"):
294 module.error = \ 294 module.error = \
295 self.trUtf8("Module is missing the 'autoactivate' attribute.") 295 self.trUtf8("Module is missing the 'autoactivate' attribute.")
296 self.__failedModules[name] = module 296 self.__failedModules[name] = module
328 328
329 @param name name of the module to be unloaded (string) 329 @param name name of the module to be unloaded (string)
330 @param directory name of the plugin directory (string) 330 @param directory name of the plugin directory (string)
331 @return flag indicating success (boolean) 331 @return flag indicating success (boolean)
332 """ 332 """
333 fname = "%s.py" % os.path.join(directory, name) 333 fname = "{0}.py".format(os.path.join(directory, name))
334 if name in self.__onDemandActiveModules and \ 334 if name in self.__onDemandActiveModules and \
335 self.__onDemandActiveModules[name].eric5PluginModuleFilename == fname: 335 self.__onDemandActiveModules[name].eric5PluginModuleFilename == fname:
336 # cannot unload an ondemand plugin, that is in use 336 # cannot unload an ondemand plugin, that is in use
337 return False 337 return False
338 338

eric ide

mercurial