11 |
class FraggleCtlModules: |
class FraggleCtlModules: |
12 |
|
|
13 |
def __init__(self,parent): |
def __init__(self,parent): |
14 |
self.ScanModules() |
self.modules = self.ScanModules() |
15 |
self.engine = parent |
self.engine = parent |
16 |
|
self.modfile = os.path.join(self.engine.getDefaultDir(), 'modules.xml') |
17 |
pass |
pass |
18 |
|
|
19 |
|
def SaveModules(self,lmodules): |
20 |
|
fraggleXml = fraggleParserXML.create(self) |
21 |
|
fraggleXml.marshalXML(lmodules,self.modfile) |
22 |
|
|
23 |
|
def LoadModules(self): |
24 |
|
fraggleXml = fraggleParserXML.create(self) |
25 |
|
return fraggleXml.unmarshalXML(self.modfile) |
26 |
|
|
27 |
def ScanModules(self): |
def ScanModules(self): |
28 |
os.chdir('..') |
os.chdir('..') |
29 |
self.dir = os.listdir(os.path.join(os.getcwd(),'modules')) |
self.dir = os.listdir(os.path.join(os.getcwd(),'modules')) |
30 |
for i in self.dir: |
for i in self.dir: |
31 |
self.dir[self.dir.index(i)] = string.rstrip(i,'.py') |
self.dir[self.dir.index(i)] = string.rstrip(i,'.py') |
32 |
|
|
33 |
|
import re |
34 |
|
regexp = re.compile('CVS$') |
35 |
|
|
36 |
|
#print self.dir |
37 |
|
|
38 |
if len(self.dir) != 0: |
if len(self.dir) != 0: |
39 |
try: |
try: |
40 |
for i in self.dir: |
for i in self.dir: |
41 |
self.modules = {i:__import__(i)} |
if regexp.match(i) == None: |
42 |
print self.modules |
try: |
43 |
print self.dir |
fmodules[i] = i |
44 |
|
except NameError: |
45 |
|
fmodules = {i:i} |
46 |
|
#print fmodules |
47 |
|
try: |
48 |
|
return fmodules |
49 |
|
except UnboundLocalError: |
50 |
|
return None |
51 |
except ImportError: |
except ImportError: |
52 |
pass |
pass |
53 |
|
return None |
54 |
|
|
55 |
|
|
56 |
|
|