PluginManager/PluginManager.py

changeset 3022
57179e4cdadd
parent 3020
542e97d4ecb3
child 3034
7ce719013078
child 3058
0a02c433f52d
equal deleted inserted replaced
3021:801289962f4e 3022:57179e4cdadd
157 if not os.path.exists(fname): 157 if not os.path.exists(fname):
158 try: 158 try:
159 f = open(fname, "w") 159 f = open(fname, "w")
160 f.close() 160 f.close()
161 except IOError: 161 except IOError:
162 return (False, 162 return (
163 False,
163 self.trUtf8("Could not create a package for {0}.")\ 164 self.trUtf8("Could not create a package for {0}.")\
164 .format(self.__develPluginFile)) 165 .format(self.__develPluginFile))
165 166
166 if Preferences.getPluginManager("ActivateExternal"): 167 if Preferences.getPluginManager("ActivateExternal"):
167 fname = os.path.join(self.pluginDirs["user"], "__init__.py") 168 fname = os.path.join(self.pluginDirs["user"], "__init__.py")
191 else: 192 else:
192 del self.pluginDirs["user"] 193 del self.pluginDirs["user"]
193 del self.pluginDirs["global"] 194 del self.pluginDirs["global"]
194 195
195 if not os.path.exists(self.pluginDirs["eric5"]): 196 if not os.path.exists(self.pluginDirs["eric5"]):
196 return (False, 197 return (
198 False,
197 self.trUtf8( 199 self.trUtf8(
198 "The internal plugin directory <b>{0}</b>" 200 "The internal plugin directory <b>{0}</b>"
199 " does not exits.").format(self.pluginDirs["eric5"])) 201 " does not exits.").format(self.pluginDirs["eric5"]))
200 202
201 return (True, "") 203 return (True, "")
550 if not hasattr(module, className): 552 if not hasattr(module, className):
551 raise PluginModuleFormatError( 553 raise PluginModuleFormatError(
552 module.eric5PluginModuleName, className) 554 module.eric5PluginModuleName, className)
553 pluginClass = getattr(module, className) 555 pluginClass = getattr(module, className)
554 if not hasattr(pluginClass, "__init__"): 556 if not hasattr(pluginClass, "__init__"):
555 raise PluginClassFormatError(module.eric5PluginModuleName, 557 raise PluginClassFormatError(
558 module.eric5PluginModuleName,
556 className, "__init__") 559 className, "__init__")
557 if not hasattr(pluginClass, "activate"): 560 if not hasattr(pluginClass, "activate"):
558 raise PluginClassFormatError(module.eric5PluginModuleName, 561 raise PluginClassFormatError(
562 module.eric5PluginModuleName,
559 className, "activate") 563 className, "activate")
560 if not hasattr(pluginClass, "deactivate"): 564 if not hasattr(pluginClass, "deactivate"):
561 raise PluginClassFormatError(module.eric5PluginModuleName, 565 raise PluginClassFormatError(
566 module.eric5PluginModuleName,
562 className, "deactivate") 567 className, "deactivate")
563 return True 568 return True
564 except PluginModuleFormatError as e: 569 except PluginModuleFormatError as e:
565 print(repr(e)) 570 print(repr(e))
566 return False 571 return False

eric ide

mercurial