#!/usr/bin/env python
conf = file('.xconfigure/workingconf.txt')
#loads the working conf file for reading
sect = file('.xconfigure/modules/keyboardrepeatrate/section.txt')
#opens the file containing the split section (you will want this to point to the same directory as your module)
count = 0
#sets the counter
section = 'no'
#makes sure that it doesn't automatically go from the start
splitoff = ''
#sets up the splitoff string (doesn't hold any value)
splitsection = True
#sets the loop
part = 1
#part is 1
part1 = ''
part2 = ''
while splitsection:
line = conf.readline()
#reads the conf line by line
if linefind = line.count('AutoRepeat'):
#if the line contains AutoRepeat
section = 'yes'
#section is yes
part1 = part1 + line
#adds line to part 1
part = 2
#part2 starts here
else:
if part == 1:
if section == 'yes':
#if section is yes
splitoff = splitoff
#does zilch
else:
if len(line) == 0:
#if the length of line = 0
count = count + 1
#add one to the counter
part1 = part1 + line
if count == 2:
#if there are 2 on the counter
splitsection = False
#stop looping
else:
#otherwise
part1 = part1 + line
count = 0
#reset counter
else:
if section == 'yes':
#if section is yes
splitoff = splitoff
#does zilch
else:
#otherwise
if len(line) == 0:
#if the length of line = 0
count = count + 1
#add one to the counter
part2 = part2 + line
if count == 2:
#if there are 2 on the counter
splitsection = False
#stop looping
else:
#otherwise
part2 = part2 + line
count = 0
#reset counter
conf.close()
#closes the conf file in read mode
loopy = True
#prepares the next loop
secti = ''
#creates the secti string
while loopy:
#loop
se = sect.readline()
#read file one line at a time
if len(se) == 0:
#if the line has no characters
loopy = False
#stop the loop
else:
#otherwise
secti = secti + se
#add the line to the secti string
all = part1 + secti + part2
#puts it all together
conf = file('.xconfigure/workingconf.txt', 'w')
#loads the working conf file for writing
conf.write(all)
#write all to the workingconf.txt file