Esempio n. 1
0
	def OnApply(self, event):
		""" Method called by PreferenceGUI class.
				- Active plugin through pluginmanager
				- Write the plugin list in the DEVSimPy config file
		"""

		### list of plugin names which are to write in DEVSimPy conf file
		pluginsList = []
		### all listed plugins
		for i in xrange(self.GetItemCount()):
			module = self.GetPyData(i)[0]
			if inspect.ismodule(module):
				### plugin 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 plugin is checked, we activate
					if self.IsChecked(i):
						pluginsList.append(name)
						pluginmanager.enable_plugin(name)
					else:
						pluginmanager.disable_plugin(name)

		### config file writting
		self.mainW.cfg.Write("plugins", str(pluginsList))
		self.mainW.cfg.Flush()
Esempio n. 2
0
    def OnApply(self, event):
        """ Method called by PreferenceGUI class.
				- Active plugin through pluginmanager
				- Write the plugin list in the DEVSimPy config file
		"""

        ### list of plugin names which are to write in DEVSimPy conf file
        pluginsList = []
        ### all listed plugins
        for i in xrange(self.GetItemCount()):
            module = self.GetPyData(i)[0]
            if inspect.ismodule(module):
                ### plugin 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 plugin is checked, we activate
                    if self.IsChecked(i):
                        pluginsList.append(name)
                        pluginmanager.enable_plugin(name)
                    else:
                        pluginmanager.disable_plugin(name)

        ### config file writting
        self.mainW.cfg.Write("plugins", str(pluginsList))
        self.mainW.cfg.Flush()
Esempio n. 3
0
	def Importing(self, root, basename):
		""" Importing module and set pydata object 
		"""

		# check the loaded module during the start of plugins
		module = pluginmanager.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__ is not None:
			### only module to be activated is checked
			if basename in self.active_plugins_list:
				self.CheckItem(index)
			else:
				pluginmanager.disable_plugin(basename)
		else:
			self.SetItemImage(index, self.idx1)

		#### pyData setting
		self.SetPyData(index, (module, None))
Esempio n. 4
0
    def Importing(self, root, basename):
        """ Importing module and set pydata object 
		"""

        # check the loaded module during the start of plugins
        module = pluginmanager.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__ is not None:
            ### only module to be activated is checked
            if basename in self.active_plugins_list:
                self.CheckItem(index)
            else:
                pluginmanager.disable_plugin(basename)
        else:
            self.SetItemImage(index, self.idx1)

        #### pyData setting
        self.SetPyData(index, (module, None))