class ConfigWizard(ConsoleUI): """ SWAML's config wizard @author: Sergio Fdez @license: GPL """ def requestData(self): """ Queries the user a new configuration """ self.config = Configuration() print 'Write your configuration options:' print '(default value goes between [...])' for var in self.config.config.keys(): defaultValue = str(self.config.config[var]) value = raw_input('\t - ' + var + '[' + defaultValue + ']: ') if (len(value) > 0): self.config.set(var, value) def printData(self): """ Dump on hard disk the configuration """ ini = ConfigParser.ConfigParser() ini.add_section(self.section) for var in self.config.config.keys(): ini.set(self.section, var, str(self.config.config[var])) try: file = open(self.output, 'w+') ini.write(file) file.flush() file.close() print 'new config file created in', self.output, 'with chosen parameters' except IOError, detail: print 'Error exporting coordinates config file: ' + str(detail)