PluginManager/PluginManager.py

branch
Py2 comp.
changeset 3058
0a02c433f52d
parent 3057
10516539f238
parent 3022
57179e4cdadd
child 3060
5883ce99ee12
equal deleted inserted replaced
3057:10516539f238 3058:0a02c433f52d
159 if not os.path.exists(fname): 159 if not os.path.exists(fname):
160 try: 160 try:
161 f = open(fname, "w") 161 f = open(fname, "w")
162 f.close() 162 f.close()
163 except IOError: 163 except IOError:
164 return (False, 164 return (
165 False,
165 self.trUtf8("Could not create a package for {0}.")\ 166 self.trUtf8("Could not create a package for {0}.")\
166 .format(self.__develPluginFile)) 167 .format(self.__develPluginFile))
167 168
168 if Preferences.getPluginManager("ActivateExternal"): 169 if Preferences.getPluginManager("ActivateExternal"):
169 fname = os.path.join(self.pluginDirs["user"], "__init__.py") 170 fname = os.path.join(self.pluginDirs["user"], "__init__.py")
193 else: 194 else:
194 del self.pluginDirs["user"] 195 del self.pluginDirs["user"]
195 del self.pluginDirs["global"] 196 del self.pluginDirs["global"]
196 197
197 if not os.path.exists(self.pluginDirs["eric5"]): 198 if not os.path.exists(self.pluginDirs["eric5"]):
198 return (False, 199 return (
200 False,
199 self.trUtf8( 201 self.trUtf8(
200 "The internal plugin directory <b>{0}</b>" 202 "The internal plugin directory <b>{0}</b>"
201 " does not exits.").format(self.pluginDirs["eric5"])) 203 " does not exits.").format(self.pluginDirs["eric5"]))
202 204
203 return (True, "") 205 return (True, "")
552 if not hasattr(module, className): 554 if not hasattr(module, className):
553 raise PluginModuleFormatError( 555 raise PluginModuleFormatError(
554 module.eric5PluginModuleName, className) 556 module.eric5PluginModuleName, className)
555 pluginClass = getattr(module, className) 557 pluginClass = getattr(module, className)
556 if not hasattr(pluginClass, "__init__"): 558 if not hasattr(pluginClass, "__init__"):
557 raise PluginClassFormatError(module.eric5PluginModuleName, 559 raise PluginClassFormatError(
560 module.eric5PluginModuleName,
558 className, "__init__") 561 className, "__init__")
559 if not hasattr(pluginClass, "activate"): 562 if not hasattr(pluginClass, "activate"):
560 raise PluginClassFormatError(module.eric5PluginModuleName, 563 raise PluginClassFormatError(
564 module.eric5PluginModuleName,
561 className, "activate") 565 className, "activate")
562 if not hasattr(pluginClass, "deactivate"): 566 if not hasattr(pluginClass, "deactivate"):
563 raise PluginClassFormatError(module.eric5PluginModuleName, 567 raise PluginClassFormatError(
568 module.eric5PluginModuleName,
564 className, "deactivate") 569 className, "deactivate")
565 return True 570 return True
566 except PluginModuleFormatError as e: 571 except PluginModuleFormatError as e:
567 print(repr(e)) 572 print(repr(e))
568 return False 573 return False
992 downloadDir = self.__defaultDownloadDir 997 downloadDir = self.__defaultDownloadDir
993 if not os.path.exists(downloadDir): 998 if not os.path.exists(downloadDir):
994 try: 999 try:
995 os.mkdir(downloadDir, 0o755) 1000 os.mkdir(downloadDir, 0o755)
996 except (OSError, IOError) as err: 1001 except (OSError, IOError) as err:
997 E5MessageBox.critical(self.__ui, 1002 E5MessageBox.critical(
1003 self.__ui,
998 self.trUtf8("Plugin Manager Error"), 1004 self.trUtf8("Plugin Manager Error"),
999 self.trUtf8( 1005 self.trUtf8(
1000 """<p>The plugin download directory""" 1006 """<p>The plugin download directory"""
1001 """ <b>{0}</b> could not be created. Please""" 1007 """ <b>{0}</b> could not be created. Please"""
1002 """ configure it via the configuration""" 1008 """ configure it via the configuration"""

eric ide

mercurial