aboutsummaryrefslogtreecommitdiff
path: root/voctogui/lib/config.py
blob: b06075c14c403c419c328a956e853e92eee6a6f6 (plain)
  1. #!/usr/bin/python3
  2. import os.path
  3. from configparser import SafeConfigParser
  4. from lib.args import Args
  5. __all__ = ['Config']
  6. def getlist(self, section, option):
  7. return [x.strip() for x in self.get(section, option).split(',')]
  8. SafeConfigParser.getlist = getlist
  9. files = [
  10. os.path.join(os.path.dirname(os.path.realpath(__file__)), '../default-config.ini'),
  11. os.path.join(os.path.dirname(os.path.realpath(__file__)), '../config.ini'),
  12. '/etc/voctogui.ini',
  13. os.path.expanduser('~/.voctogui.ini'),
  14. ]
  15. if Args.ini_file is not None:
  16. files.append(Args.ini_file)
  17. Config = SafeConfigParser()
  18. Config.read(files)