Пример #1
0
    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()
Пример #2
0
	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()