13 |
def __init__(self,parent): |
def __init__(self,parent): |
14 |
self.modules = 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 |
|
if regexp.match(i) == None: |
42 |
|
try: |
43 |
|
fmodules[i] = i |
44 |
|
except NameError: |
45 |
|
fmodules = {i:i} |
46 |
|
#print fmodules |
47 |
try: |
try: |
48 |
fmodules[i] = i |
return fmodules |
49 |
except NameError: |
except UnboundLocalError: |
50 |
fmodules = {i:i} |
return None |
|
print fmodules |
|
|
print self.dir |
|
|
|
|
|
#del fmodules['CVS'] |
|
|
return fmodules |
|
51 |
except ImportError: |
except ImportError: |
52 |
pass |
pass |
|
|
|
53 |
return None |
return None |
54 |
|
|
55 |
|
|