Subversion Repositories HomeAutomation

Rev

Rev 2137 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 2137 Rev 2228
Line 190... Line 190...
190
			
190
			
191
	return sectionLines
191
	return sectionLines
192
	
192
	
193
 
193
 
194
def updateConfigFile():
194
def updateConfigFile():
195
	print "Updating config.inc..."
195
	print "Updating config.inc...\n"
196
	modules = getLocalModules()
196
	modules = getLocalModules()
197
	moduleSections = {}
197
	moduleSections = {}
198
	applicationSection = []
198
	applicationSection = []
199
	moduleName="none"
199
	moduleName="none"
200
	if not os.path.exists("config.inc"):
200
	if not os.path.exists("config.inc"):
Line 202... Line 202...
202
		
202
		
203
		for moduleName in modules:
203
		for moduleName in modules:
204
			moduleSections[moduleName] = readConfigSection(localmoddir + "/" + moduleName + "/config.inc.template", moduleName)
204
			moduleSections[moduleName] = readConfigSection(localmoddir + "/" + moduleName + "/config.inc.template", moduleName)
205
	else:
205
	else:
206
		applicationSection = readConfigSection("config.inc", "application")
206
		applicationSection = readConfigSection("config.inc", "application")
207
		
207
		print "\tModules used:"
208
		for moduleName in modules:
208
		for moduleName in modules:
209
			moduleSections[moduleName] = readConfigSection("config.inc", moduleName)
209
			moduleSections[moduleName] = readConfigSection("config.inc", moduleName)
210
			
210
			print "\t\t"+moduleName
211
			if len(moduleSections[moduleName]) <= 1:
211
			if len(moduleSections[moduleName]) <= 1:
212
				moduleSections[moduleName] = readConfigSection(localmoddir + "/" + moduleName + "/config.inc.template", moduleName)
212
				moduleSections[moduleName] = readConfigSection(localmoddir + "/" + moduleName + "/config.inc.template", moduleName)
213
	
213
	
214
	timers = 0
214
	timers = 0
215
	pcints = 0
215
	pcints = 0
216
	
-
 
217
	moduleIds = getModuleIdsFromFile(moduleName)
-
 
218
	
216
	print ""
219
	for moduleName, moduleSection in moduleSections.iteritems():
217
	for moduleName, moduleSection in moduleSections.iteritems():
220
		c = 0
218
		c = 0
221
		for line in moduleSection:
219
		for line in moduleSection:
222
			if len(line) > 0:
220
			if len(line) > 0:
223
				if line[0] != '#':
221
				if line[0] != '#':
224
					if line.find("<ID>") != -1:
222
					if line.find("<ID>") != -1:
-
 
223
						moduleIds = getModuleIdsFromFile(moduleName)
225
						new_ID = getFreeModuleId(moduleIds)
224
						new_ID = getFreeModuleId(moduleIds)
226
						print "\nNew module id set to: "+hex(new_ID)+"\n"
225
						print "\nNew module id set to: "+hex(new_ID)+"\n"
227
						moduleIds.append(new_ID)
226
						moduleIds.append(new_ID)
228
						line = line.replace("<ID>", hex(new_ID))
227
						line = line.replace("<ID>", hex(new_ID))
229
					elif line.find("<TIMER>") != -1:
228
					elif line.find("<TIMER>") != -1: