def OnApply(self, event): """ Method called by PreferenceGUI class. - Active plug-in through pluginmanager - Write the plug-in list in the DEVSimPy config file """ ### list of plug-in names which are to write in DEVSimPy config file pluginsList = [] ### all listed plug-ins for i in xrange(self.GetItemCount()): module = self.GetPyData(i)[0] if inspect.ismodule(module): ### plug-in file path file = module.__file__ ### built-in module coming from empty module create by error manager if file is not None: ### get abspath and exclude .pyc name, ext = os.path.splitext(os.path.basename(file)) ### if plug-in is checked, we activate if self.IsChecked(i): pluginsList.append(name) enable_plugin(name) else: disable_plugin(name) ### config file writing self.mainW.cfg.Write('plugins', str(pluginsList)) self.mainW.cfg.Flush()
def OnApply(self, event): """ Method called by PreferenceGUI class. - Active plug-in through pluginmanager - Write the plug-in list in the DEVSimPy config file """ ### list of plug-in names which are to write in DEVSimPy config file pluginsList = [] ### all listed plug-ins for i in xrange(self.GetItemCount()): module = self.GetPyData(i)[0] if inspect.ismodule(module): ### plug-in file path file = module.__file__ ### built-in module coming from empty module create by error manager if file is not None: ### get abspath and exclude .pyc name,ext = os.path.splitext(os.path.basename(file)) ### if plug-in is checked, we activate it if self.IsChecked(i): pluginsList.append(name) enable_plugin(name) else: disable_plugin(name) ### config file writing self.mainW.cfg.Write('plugins', str(pluginsList)) self.mainW.cfg.Flush()
def Importing(self, root, basename): """ Importing module and set pydata object """ # check the loaded module during the start of plug-ins module = load_plugins(basename) ### if module is exception (or tuple) if not inspect.ismodule(module): error = str(module) module = imp.new_module(basename) module.__doc__ = error module.__file__ = None index = self.InsertItem(root, basename) if module.__file__ != None: ### only module to be activated is checked if basename in self.active_plugins_list: self.CheckItem(index) else: disable_plugin(basename) else: self.SetItemImage(index, 2) #### pyData setting self.SetPyData(index, (module, None))