def loadPreferences(filename):
 global settingsList
 profileParser = ConfigParser.ConfigParser()
 try:
  profileParser.read(filename)
 except ConfigParser.ParsingError:
  return
 for set in settingsList:
  if set.isPreference():
   if profileParser.has_option('preference', set.getName()):
    set.setValue(unicode(profileParser.get('preference', set.getName()), 'utf-8', 'replace'))
 n = 0
 while profileParser.has_section(('machine_%d' % n)):
  for set in settingsList:
   if set.isMachineSetting():
    if profileParser.has_option(('machine_%d' % n), set.getName()):
     set.setValue(unicode(profileParser.get(('machine_%d' % n), set.getName()), 'utf-8', 'replace'), n)
  n += 1
 setActiveMachine(int(getPreferenceFloat('active_machine')))

def loadPreferences ( filename ) : global settingsList profileParser = ConfigParser . ConfigParser ( ) try : profileParser . read ( filename ) except ConfigParser . ParsingError : return for set in settingsList : if set . isPreference ( ) : if profileParser . has_option ( 'preference' , set . getName ( ) ) : set . setValue ( unicode ( profileParser . get ( 'preference' , set . getName ( ) ) , 'utf-8' , 'replace' ) ) n = 0 while profileParser . has_section ( ( 'machine_%d' % n ) ) : for set in settingsList : if set . isMachineSetting ( ) : if profileParser . has_option ( ( 'machine_%d' % n ) , set . getName ( ) ) : set . setValue ( unicode ( profileParser . get ( ( 'machine_%d' % n ) , set . getName ( ) ) , 'utf-8' , 'replace' ) , n ) n += 1 setActiveMachine ( int ( getPreferenceFloat ( 'active_machine' ) ) )
read a configuration file as global config .