From: Pierre Date: Sun, 16 Dec 2012 17:36:01 +0000 (+0100) Subject: conf X-Git-Url: http://iramuteq.org/git?a=commitdiff_plain;h=e4e874212adccd8ac034d0a99d3304aca06b3f04;p=iramuteq conf --- diff --git a/functions.py b/functions.py index e77d3f2..f609e65 100644 --- a/functions.py +++ b/functions.py @@ -151,24 +151,31 @@ class DoConf : return parametres def makeoptions(self, sections, parametres, outfile = None) : + txt = '' for i, section in enumerate(sections) : + txt += '[%s]\n' % section if not self.conf.has_section(section) : self.conf.add_section(section) for option in parametres[i] : if isinstance(parametres[i][option], int) : self.conf.set(section, option, `parametres[i][option]`) + txt += '%s = %i\n' % (option, parametres[i][option]) elif isinstance(parametres[i][option], basestring) : self.conf.set(section, option, parametres[i][option].encode('utf8')) + txt += '%s = %s\n' % (option, parametres[i][option].encode('utf8')) elif isinstance(parametres[i][option], wx.Colour) : self.conf.set(section, option, str(parametres[i][option])) + txt += '%s = %s' % (option, str(parametres[i][option])) elif option == 'analyses' : pass else : self.conf.set(section, option, `parametres[i][option]`) + txt += '%s = %s' % (option, `parametres[i][option]`) if outfile is None : outfile = self.configfile with codecs.open(outfile, 'w', 'utf8') as f : - self.conf.write(f) + f.write(txt) + #self.conf.write(f) def totext(self, parametres) : #txt = ['Corpus']