/[cvs]/nfo/projects/netfraggle/bin/FraggleCtlModules.py
ViewVC logotype

Annotation of /nfo/projects/netfraggle/bin/FraggleCtlModules.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (hide annotations)
Sun Sep 5 12:17:20 2004 UTC (19 years, 10 months ago) by xabbu
Branch: MAIN
Changes since 1.4: +21 -9 lines
File MIME type: text/x-python
+ Modules Setup is being loaded at Startup now and can be saved in the modules configuration Dialog FraggleDialogModules
+ Saving modules to file modules.xml

1 xabbu 1.1 import os
2 xabbu 1.2 import string
3 xabbu 1.1
4     import fraggleParserXML
5     from fraggleEngine import *
6    
7    
8     def create(parent):
9     return FraggleCtlModules(parent)
10    
11     class FraggleCtlModules:
12    
13     def __init__(self,parent):
14 xabbu 1.3 self.modules = self.ScanModules()
15 xabbu 1.1 self.engine = parent
16 xabbu 1.5 self.modfile = os.path.join(self.engine.getDefaultDir(), 'modules.xml')
17 xabbu 1.1 pass
18    
19 xabbu 1.5 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 xabbu 1.1 def ScanModules(self):
28     os.chdir('..')
29     self.dir = os.listdir(os.path.join(os.getcwd(),'modules'))
30 xabbu 1.2 for i in self.dir:
31 xabbu 1.3 self.dir[self.dir.index(i)] = string.rstrip(i,'.py')
32    
33 xabbu 1.5 import re
34     regexp = re.compile('CVS$')
35 xabbu 1.2
36 xabbu 1.5 #print self.dir
37 xabbu 1.2
38     if len(self.dir) != 0:
39     try:
40     for i in self.dir:
41 xabbu 1.5 if regexp.match(i) == None:
42     try:
43     fmodules[i] = i
44     except NameError:
45     fmodules = {i:i}
46     #print fmodules
47 xabbu 1.3 try:
48 xabbu 1.5 return fmodules
49     except UnboundLocalError:
50     return None
51 xabbu 1.2 except ImportError:
52     pass
53 xabbu 1.3 return None
54    
55 xabbu 1.1
56    

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed