--- nfo/projects/netfraggle/bin/FraggleCtlModules.py 2004/09/05 12:17:20 1.5 +++ nfo/projects/netfraggle/bin/FraggleCtlModules.py 2004/09/21 18:04:42 1.6 @@ -23,31 +23,44 @@ def LoadModules(self): fraggleXml = fraggleParserXML.create(self) return fraggleXml.unmarshalXML(self.modfile) + + def SetViewport(self,viewport): + self.viewport = viewport + + def Dispatch(self,seldata,seltype): + print "Type: "+seltype + for i in self.modules: + print "Module: "+i + if i == seltype: + module = self.modules[i] + moduleInstance = module.create(self.viewport) + moduleInstance.load_content(seldata['3']) + print module def ScanModules(self): os.chdir('..') + sys.path.append(os.path.join(os.getcwd(),'modules')) self.dir = os.listdir(os.path.join(os.getcwd(),'modules')) for i in self.dir: self.dir[self.dir.index(i)] = string.rstrip(i,'.py') - import re - regexp = re.compile('CVS$') - #print self.dir if len(self.dir) != 0: try: for i in self.dir: - if regexp.match(i) == None: + if string.find(i,'CVS') == -1 and string.find(i,'.pyc') == -1: + #print i try: - fmodules[i] = i + fmodules[i] = __import__(i) except NameError: - fmodules = {i:i} + fmodules = {i:__import__(i)} #print fmodules - try: - return fmodules - except UnboundLocalError: - return None + try: + print fmodules + return fmodules + except UnboundLocalError: + return None except ImportError: pass return None